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

Add missing modules

parent ea9726dc
Loading
Loading
Loading
Loading
+0 −14
Changes for poetry/masonry/builder.py: 0 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -21,20 +21,6 @@ class Builder:
        if fmt not in self._FORMATS:
            raise ValueError(f'Invalid format: {fmt}')

        self.check()

        builder = self._FORMATS[fmt](self._poetry, self._io)

        return builder.build()

    def check(self) -> None:
        package = self._poetry.package

        # Checking for disjunctive python versions
        if isinstance(package.python_constraint, MultiConstraint):
            if package.python_constraint.is_disjunctive():
                raise RuntimeError(
                    'Disjunctive python versions are not yet supported '
                    'when building packages. Rewrite your python requirements '
                    'in a conjunctive way.'
                )
+2 −8
Changes for poetry/masonry/builders/sdist.py: 2 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ from pprint import pformat
from typing import List

from poetry.packages import Dependency
from poetry.semver.constraints import MultiConstraint
from poetry.version.helpers import format_python_constraint

from ..utils.helpers import normalize_file_permissions

@@ -149,13 +149,7 @@ class SdistBuilder(Builder):
            extra.append("'entry_points': entry_points,")

        if self._package.python_versions != '*':
            constraint = self._package.python_constraint
            if isinstance(constraint, MultiConstraint):
                python_requires = ','.join(
                    [str(c).replace(' ', '') for c in constraint.constraints]
                )
            else:
                python_requires = str(constraint).replace(' ', '')
            python_requires = format_python_constraint(self._package.python_constraint)

            extra.append("'python_requires': {!r},".format(python_requires))

+2 −7
Changes for poetry/masonry/builders/wheel.py: 2 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ from poetry.__version__ import __version__
from poetry.semver.constraints import Constraint
from poetry.semver.constraints import MultiConstraint
from poetry.vcs import get_vcs
from poetry.version.helpers import format_python_constraint

from ..utils.helpers import normalize_file_permissions
from ..utils.tags import get_abbr_impl
@@ -311,13 +312,7 @@ class WheelBuilder(Builder):
            fp.write(f'Author-email: {author["email"]}\n')

        if self._package.python_versions != '*':
            constraint = self._package.python_constraint
            if isinstance(constraint, MultiConstraint):
                python_requires = ','.join(
                    [str(c).replace(' ', '') for c in constraint.constraints]
                )
            else:
                python_requires = str(constraint).replace(' ', '')
            python_requires = format_python_constraint(self._package.python_constraint)

            fp.write(f'Requires-Python: {python_requires}\n')

+1 −1
Changes for poetry/semver/constraints/multi_constraint.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -37,5 +37,5 @@ class MultiConstraint(BaseConstraint):
            constraints.append(str(constraint))

        return '{}'.format(
            (' ' if self._conjunctive else ' || ').join(constraints)
            (', ' if self._conjunctive else ' || ').join(constraints)
        )
+12 −5
Changes for poetry/semver/version_parser.py: 12 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -176,24 +176,31 @@ class VersionParser:
        # A partial version range is treated as an X-Range,
        # so the special character is in fact optional.
        m = re.match(
            '^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.[xX*])+$',
            '^(!=)?v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.[xX*])+$',
            constraint
        )
        if m:
            if m.group(3):
            if m.group(4):
                position = 2
            elif m.group(2):
            elif m.group(3):
                position = 1
            else:
                position = 0

            groups = m.groups()[1:]
            low_version = self._manipulate_version_string(
                m.groups(), position
                groups, position
            )
            high_version = self._manipulate_version_string(
                m.groups(), position, 1
                groups, position, 1
            )

            if m.group(1):
                if low_version == '0.0.0.0':
                    return Constraint('>=', high_version),

                return self.parse_constraints(f'<{low_version} || >={high_version}'),

            if low_version == '0.0.0.0':
                return Constraint('<', high_version),

Loading