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

Improve classifiers management

parent a22683a8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7,12 +7,14 @@
- Added compatibility with Python 3.4 and 3.5.
- Added the `version` command to automatically bump the package's version.
- Added a standalone installer to install `poetry` isolated.
- Added support for classifiers in `pyproject.toml`.

### Changed

- Improved dependency resolution to avoid unnecessary operations.
- Improved dependency resolution speed.
- Improved CLI reactivity by deferring imports.
- License classifer is not automatically added to classifers.

### Fixed

+1 −1
Original line number Diff line number Diff line
@@ -10,6 +10,6 @@ class CheckCommand(Command):

    def handle(self):
        # Load poetry and display errors, if any
        _ = self.poetry
        self.poetry.check(self.poetry.config, strict=True)

        self.info('All set!')
+4 −0
Original line number Diff line number Diff line
@@ -50,6 +50,10 @@
            "type": "string",
            "description": "The path to the README file"
        },
        "classifiers":  {
            "type": "array",
            "description": "A list of trove classifers."
        },
        "dependencies": {
            "type": "object",
            "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
+2 −2
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ class Metadata:
        meta.home_page = package.homepage or package.repository_url
        meta.author = package.author_name
        meta.author_email = package.author_email
        meta.license = package.license
        meta.classifiers = package.classifiers
        meta.license = package.license.id
        meta.classifiers = package.all_classifiers

        # Version 1.2
        meta.maintainer = meta.author
+26 −4
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@ from poetry.semver.constraints import Constraint
from poetry.semver.constraints import EmptyConstraint
from poetry.semver.helpers import parse_stability
from poetry.semver.version_parser import VersionParser
from poetry.spdx import license_by_id
from poetry.spdx import License
from poetry.version import parse as parse_version

from .constraints.generic_constraint import GenericConstraint
@@ -68,7 +70,7 @@ class Package:
        self.homepage = None
        self.repository_url = None
        self.keywords = []
        self.license = None
        self._license = None
        self.readme = None

        self.source_type = ''
@@ -92,6 +94,8 @@ class Package:
        self.include = []
        self.exclude = []

        self.classifiers = []

        self._python_versions = '*'
        self._python_constraint = self._parser.parse_constraints('*')
        self._platform = '*'
@@ -189,8 +193,21 @@ class Package:
        return self._platform_constraint

    @property
    def classifiers(self):
        classifiers = []
    def license(self):
        return self._license

    @license.setter
    def license(self, value):
        if value is None:
            self._license = license
        elif isinstance(value, License):
            self._license = license
        else:
            self._license = license_by_id(value)
    
    @property
    def all_classifiers(self):
        classifiers = self.classifiers.copy()

        # Automatically set python classifiers
        parser = VersionParser()
@@ -210,7 +227,12 @@ class Package:
                    'Programming Language :: Python :: {}'.format(version)
                )

        return classifiers
        # Automatically set license classifers
        classifiers.append(self.license.classifier)

        classifiers = set(classifiers)

        return sorted(classifiers)

    def is_dev(self):
        return self._dev
Loading