Unverified Commit 95c0a9a0 authored by Sébastien Eustace's avatar Sébastien Eustace
Browse files

Add the build command with a tarball builder (sdist)

parent cdb2c621
Loading
Loading
Loading
Loading
+1 −1
Changes for poetry/__version__.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
__version__ = '0.3.0'
__version__ = '0.4.0-beta'
+2 −0
Changes for poetry/console/application.py: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ from poetry.utils.venv import Venv

from .commands import AboutCommand
from .commands import AddCommand
from .commands import BuildCommand
from .commands import InstallCommand
from .commands import LockCommand
from .commands import NewCommand
@@ -45,6 +46,7 @@ class Application(BaseApplication):
        return commands + [
            AboutCommand(),
            AddCommand(),
            BuildCommand(),
            InstallCommand(),
            LockCommand(),
            NewCommand(),
+1 −0
Changes for poetry/console/commands/__init__.py: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
from .about import AboutCommand
from .add import AddCommand
from .build import BuildCommand
from .install import InstallCommand
from .lock import LockCommand
from .new import NewCommand
+20 −0
Changes for poetry/console/commands/build.py: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
from .command import Command

from poetry.masonry import Builder


class BuildCommand(Command):
    """
    Builds a package, as a tarball and a wheel by default.

    build
        { --f|format=* : Limit the format to either wheel or sdist}
    """

    def handle(self):
        fmt = 'all'
        if self.option('format'):
            fmt = self.option('format')

        builder = Builder(self.poetry)
        builder.build(fmt)
+2 −10
Changes for poetry/layouts/layout.py: 2 added lines, 10 removed lines.
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-

import re

import toml

from poetry.utils.helpers import module_name
from poetry.vcs.git import Git

_canonicalize_regex = re.compile(r"[-_.]+")


TESTS_DEFAULT = """from {package_name} import __version__

@@ -21,7 +16,7 @@ class Layout(object):

    def __init__(self, project, version='0.1.0', readme_format='md', author=None):
        self._project = project
        self._package_name = self._canonicalize_name(project).replace('-', '_')
        self._package_name = module_name(project)
        self._version = version
        self._readme_format = readme_format
        self._dependencies = {}
@@ -118,6 +113,3 @@ class Layout(object):

        with poetry.open('w') as f:
            f.write(content)

    def _canonicalize_name(self, name: str) -> str:
        return _canonicalize_regex.sub("-", name).lower()
Loading