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

Add support for Python 2.7

parent 9b96d6db
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2,6 +2,11 @@

## [Unreleased]

### Added

- Added support for Python 2.7.


### Changes

- Improved dependency resolution time by using cache control.
+1 −1
Original line number Diff line number Diff line
__version__ = '0.7.1'
__version__ = '0.8.0a0'
+4 −4
Original line number Diff line number Diff line
from pathlib import Path
from typing import Any

from .locations import CONFIG_DIR
from .utils._compat import Path
from .utils.toml_file import TomlFile
from .utils.toml_file import TOMLFile


class Config:

    def __init__(self, file: TomlFile):
    def __init__(self, file):  # type: (TomlFile) -> None
        self._file = file
        if not self._file.exists():
            self._raw_content = {}
@@ -33,7 +33,7 @@ class Config:
    def content(self):
        return self._content

    def setting(self, setting_name: str) -> Any:
    def setting(self, setting_name):  # type: (str) -> Any
        """
        Retrieve a setting value.
        """
@@ -84,7 +84,7 @@ class Config:
        self._file.write(self._content)

    @classmethod
    def create(cls, file, base_dir=None) -> 'Config':
    def create(cls, file, base_dir=None):  # type: (...) -> Config
        if base_dir is None:
            base_dir = CONFIG_DIR

+7 −7
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ from .commands.debug import DebugResolveCommand
class Application(BaseApplication):

    def __init__(self):
        super().__init__('Poetry', __version__)
        super(Application, self).__init__('Poetry', __version__)

        self._poetry = None
        self._skip_io_configuration = False
@@ -47,10 +47,10 @@ class Application(BaseApplication):

        return self._poetry

    def reset_poetry(self) -> None:
    def reset_poetry(self):  # type: () -> None
        self._poetry = None

    def run(self, i=None, o=None) -> int:
    def run(self, i=None, o=None):  # type: (...) -> int
        if i is None:
            i = ArgvInput()

@@ -62,13 +62,13 @@ class Application(BaseApplication):
            self._skip_io_configuration = True
            i = RawArgvInput()

        return super().run(i, o)
        return super(Application, self).run(i, o)

    def do_run(self, i, o):
        name = self.get_command_name(i)

        if name not in ['run', 'script']:
            return super().do_run(i, o)
            return super(Application, self).do_run(i, o)

        command = self.find(name)

@@ -82,9 +82,9 @@ class Application(BaseApplication):
        if self._skip_io_configuration:
            return

        super().configure_io(i, o)
        super(Application, self).configure_io(i, o)

    def get_default_commands(self) -> list:
    def get_default_commands(self):  # type: () -> list
        commands = super(Application, self).get_default_commands()

        commands += [
+6 −4
Original line number Diff line number Diff line
@@ -103,7 +103,9 @@ If you do not specify a version constraint, poetry will choose a suitable one ba

        return status

    def _determine_requirements(self, requires: List[str]) -> List[str]:
    def _determine_requirements(self,
                                requires  # type: List[str]
                                ):  # type: (...) -> List[str]
        if not requires:
            return []

@@ -140,7 +142,7 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
    def _find_best_version_for_package(self,
                                       name,
                                       required_version=None
                                       ) -> Tuple[str, str]:
                                       ):  # type: (...) -> Tuple[str, str]
        from poetry.version.version_selector import VersionSelector

        selector = VersionSelector(self.poetry.pool)
@@ -157,7 +159,7 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
            selector.find_recommended_require_version(package)
        )

    def _parse_name_version_pairs(self, pairs: list) -> list:
    def _parse_name_version_pairs(self, pairs):  # type: (list) -> list
        result = []

        for i in range(len(pairs)):
@@ -177,7 +179,7 @@ If you do not specify a version constraint, poetry will choose a suitable one ba

        return result

    def _format_requirements(self, requirements: List[str]) -> dict:
    def _format_requirements(self, requirements):  # type: (List[str]) -> dict
        requires = {}
        requirements = self._parse_name_version_pairs(requirements)
        for requirement in requirements:
Loading