Skip to content

Commit

Permalink
Use the latest version of poetry-core
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Mar 27, 2020
1 parent 9586739 commit a78669a
Show file tree
Hide file tree
Showing 54 changed files with 149 additions and 171 deletions.
4 changes: 4 additions & 0 deletions get-poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ def expanduser(path):
sys.path.insert(0, lib)
vendors = os.path.join(lib, "poetry", "_vendor"))
sys.path.insert(0, vendors)
if __name__ == "__main__":
from poetry.console import main
Expand Down
13 changes: 4 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions poetry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import os
import sys
from pkgutil import extend_path

from .__version__ import __version__ # noqa


_ROOT = os.path.dirname(os.path.realpath(__file__))
_VENDOR = os.path.join(_ROOT, "_vendor")
_CURRENT_VENDOR = os.path.join(
_VENDOR, "py{}".format(".".join(str(v) for v in sys.version_info[:2]))
)

# Add vendored dependencies to path.
sys.path.insert(0, _CURRENT_VENDOR)
__path__ = extend_path(__path__, __name__)
2 changes: 1 addition & 1 deletion poetry/console/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AddCommand(EnvCommand, InitCommand):

def handle(self):
from poetry.installation.installer import Installer
from poetry_core.semver import parse_constraint
from poetry.core.semver import parse_constraint
from tomlkit import inline_table

packages = self.argument("name")
Expand Down
2 changes: 1 addition & 1 deletion poetry/console/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BuildCommand(EnvCommand):
]

def handle(self):
from poetry_core.masonry import Builder
from poetry.core.masonry import Builder

fmt = "all"
if self.option("format"):
Expand Down
2 changes: 1 addition & 1 deletion poetry/console/commands/debug/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DebugResolveCommand(InitCommand):

def handle(self):
from poetry.io.null_io import NullIO
from poetry_core.packages import ProjectPackage
from poetry.core.packages import ProjectPackage
from poetry.puzzle import Solver
from poetry.repositories.pool import Pool
from poetry.repositories.repository import Repository
Expand Down
10 changes: 5 additions & 5 deletions poetry/console/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def handle(self):
from poetry.layouts import layout
from poetry.utils._compat import Path
from poetry.utils.env import SystemEnv
from poetry_core.vcs.git import GitConfig
from poetry.core.vcs.git import GitConfig

if (Path.cwd() / "pyproject.toml").exists():
self.line("<error>A pyproject.toml file already exists.</error>")
Expand Down Expand Up @@ -367,8 +367,8 @@ def _parse_requirements(
if url_parsed.scheme and url_parsed.netloc:
# Url
if url_parsed.scheme in ["git+https", "git+ssh"]:
from poetry_core.vcs.git import Git
from poetry_core.vcs.git import ParsedUrl
from poetry.core.vcs.git import Git
from poetry.core.vcs.git import ParsedUrl

parsed = ParsedUrl.parse(requirement)
url = Git.normalize_url(requirement)
Expand Down Expand Up @@ -481,7 +481,7 @@ def _format_requirements(
return requires

def _validate_author(self, author, default):
from poetry_core.packages.package import AUTHOR_REGEX
from poetry.core.packages.package import AUTHOR_REGEX

author = author or default

Expand All @@ -498,7 +498,7 @@ def _validate_author(self, author, default):
return author

def _validate_license(self, license):
from poetry_core.spdx import license_by_id
from poetry.core.spdx import license_by_id

if license:
license_by_id(license)
Expand Down
2 changes: 1 addition & 1 deletion poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def handle(self):
from clikit.io import NullIO
from poetry.installation.installer import Installer
from poetry.masonry.builders import EditableBuilder
from poetry_core.masonry.utils.module import ModuleOrPackageNotFound
from poetry.core.masonry.utils.module import ModuleOrPackageNotFound

installer = Installer(
self.io, self.env, self.poetry.package, self.poetry.locker, self.poetry.pool
Expand Down
4 changes: 2 additions & 2 deletions poetry/console/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class NewCommand(Command):

def handle(self):
from poetry.layouts import layout
from poetry_core.semver import parse_constraint
from poetry.core.semver import parse_constraint
from poetry.utils._compat import Path
from poetry.utils.env import SystemEnv
from poetry_core.vcs.git import GitConfig
from poetry.core.vcs.git import GitConfig

if self.option("src"):
layout_ = layout("src")
Expand Down
2 changes: 1 addition & 1 deletion poetry/console/commands/self/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def lib_backup(self):
def handle(self):
from poetry.__version__ import __version__
from poetry.repositories.pypi_repository import PyPiRepository
from poetry_core.semver import Version
from poetry.core.semver import Version
from poetry.utils._compat import Path

current = Path(__file__)
Expand Down
4 changes: 2 additions & 2 deletions poetry/console/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ShowCommand(EnvCommand):
def handle(self):
from clikit.utils.terminal import Terminal
from poetry.repositories.installed_repository import InstalledRepository
from poetry_core.semver import Version
from poetry.core.semver import Version

package = self.argument("package")

Expand Down Expand Up @@ -347,7 +347,7 @@ def find_latest_package(self, package, include_dev):
return selector.find_best_candidate(name, ">={}".format(package.pretty_version))

def get_update_status(self, latest, package):
from poetry_core.semver import parse_constraint
from poetry.core.semver import parse_constraint

if latest.full_pretty_version == package.full_pretty_version:
return "up-to-date"
Expand Down
2 changes: 1 addition & 1 deletion poetry/console/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def handle(self):
)

def increment_version(self, version, rule):
from poetry_core.semver import Version
from poetry.core.semver import Version

try:
version = Version.parse(version)
Expand Down
5 changes: 3 additions & 2 deletions poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from typing import Optional

from clikit.api.io.io import IO
from poetry_core.factory import Factory as BaseFactory
from poetry_core.utils.toml_file import TomlFile

from poetry.core.factory import Factory as BaseFactory
from poetry.core.utils.toml_file import TomlFile

from .config.config import Config
from .config.file_config_source import FileConfigSource
Expand Down
4 changes: 2 additions & 2 deletions poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from clikit.api.io import IO
from clikit.io import NullIO
from poetry_core.packages.package import Package
from poetry_core.semver import parse_constraint

from poetry.core.packages.package import Package
from poetry.core.semver import parse_constraint
from poetry.packages import Locker
from poetry.puzzle import Solver
from poetry.puzzle.operations import Install
Expand Down
6 changes: 3 additions & 3 deletions poetry/installation/pip_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def create_temporary_requirement(self, package):
return name

def install_directory(self, package):
from poetry_core.masonry.builder import SdistBuilder
from poetry.core.masonry.builder import SdistBuilder
from poetry.factory import Factory
from poetry.utils._compat import decode
from poetry.utils.env import NullEnv
Expand Down Expand Up @@ -229,8 +229,8 @@ def install_directory(self, package):
os.remove(setup)

def install_git(self, package):
from poetry_core.packages import Package
from poetry_core.vcs import Git
from poetry.core.packages import Package
from poetry.core.vcs import Git

src_dir = self._env.path / "src" / package.name
if src_dir.exists():
Expand Down
6 changes: 3 additions & 3 deletions poetry/layouts/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_version():
[tool.poetry.dev-dependencies]
"""

BUILD_SYSTEM_MIN_VERSION = "1.0.0"
BUILD_SYSTEM_MIN_VERSION = "1.0.0a5"
BUILD_SYSTEM_MAX_VERSION = None


Expand Down Expand Up @@ -109,8 +109,8 @@ def generate_poetry_content(self):
if BUILD_SYSTEM_MAX_VERSION is not None:
build_system_version += ",<" + BUILD_SYSTEM_MAX_VERSION

build_system.add("requires", ["poetry_core" + build_system_version])
build_system.add("build-backend", "poetry_core.masonry.api")
build_system.add("requires", ["poetry-core" + build_system_version])
build_system.add("build-backend", "poetry.core.masonry.api")

content.add("build-system", build_system)

Expand Down
10 changes: 5 additions & 5 deletions poetry/masonry/api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from poetry_core.masonry.api import build_sdist
from poetry_core.masonry.api import build_wheel
from poetry_core.masonry.api import get_requires_for_build_sdist
from poetry_core.masonry.api import get_requires_for_build_wheel
from poetry_core.masonry.api import prepare_metadata_for_build_wheel
from poetry.core.masonry.api import build_sdist
from poetry.core.masonry.api import build_wheel
from poetry.core.masonry.api import get_requires_for_build_sdist
from poetry.core.masonry.api import get_requires_for_build_wheel
from poetry.core.masonry.api import prepare_metadata_for_build_wheel


__all__ = [
Expand Down
7 changes: 3 additions & 4 deletions poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@

from collections import defaultdict

from poetry_core.masonry.builders.builder import Builder
from poetry_core.masonry.builders.sdist import SdistBuilder
from poetry_core.semver.version import Version

from poetry.core.masonry.builders.builder import Builder
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.semver.version import Version
from poetry.utils._compat import decode


Expand Down
4 changes: 2 additions & 2 deletions poetry/mixology/partial_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from typing import Dict
from typing import List

from poetry_core.packages import Dependency
from poetry_core.packages import Package
from poetry.core.packages import Dependency
from poetry.core.packages import Package

from .assignment import Assignment
from .incompatibility import Incompatibility
Expand Down
2 changes: 1 addition & 1 deletion poetry/mixology/term.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from typing import Union

from poetry_core.packages import Dependency
from poetry.core.packages import Dependency

from .set_relation import SetRelation

Expand Down
11 changes: 5 additions & 6 deletions poetry/mixology/version_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
from typing import List
from typing import Union

from poetry_core.packages import Dependency
from poetry_core.packages import Package
from poetry_core.packages import ProjectPackage
from poetry_core.semver import Version
from poetry_core.semver import VersionRange

from poetry.core.packages import Dependency
from poetry.core.packages import Package
from poetry.core.packages import ProjectPackage
from poetry.core.semver import Version
from poetry.core.semver import VersionRange
from poetry.puzzle.provider import Provider

from .failure import SolveFailure
Expand Down
6 changes: 3 additions & 3 deletions poetry/packages/locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
from hashlib import sha256
from typing import List

from poetry_core.packages.package import Dependency
from poetry_core.packages.package import Package
from poetry_core.version.markers import parse_marker
from tomlkit import document
from tomlkit import inline_table
from tomlkit import item
Expand All @@ -15,6 +12,9 @@

import poetry.repositories

from poetry.core.packages.package import Dependency
from poetry.core.packages.package import Package
from poetry.core.version.markers import parse_marker
from poetry.utils._compat import Path
from poetry.utils.toml_file import TomlFile

Expand Down
4 changes: 2 additions & 2 deletions poetry/poetry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import absolute_import
from __future__ import unicode_literals

from poetry_core.packages import ProjectPackage
from poetry_core.poetry import Poetry as BasePoetry
from poetry.core.packages import ProjectPackage
from poetry.core.poetry import Poetry as BasePoetry

from .__version__ import __version__
from .config.config import Config
Expand Down
6 changes: 3 additions & 3 deletions poetry/publishing/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

import requests

from poetry_core.masonry.metadata import Metadata
from poetry_core.masonry.utils.helpers import escape_name
from poetry_core.masonry.utils.helpers import escape_version
from requests import adapters
from requests.exceptions import HTTPError
from requests.packages.urllib3 import util
Expand All @@ -18,6 +15,9 @@
from requests_toolbelt.multipart import MultipartEncoderMonitor

from poetry.__version__ import __version__
from poetry.core.masonry.metadata import Metadata
from poetry.core.masonry.utils.helpers import escape_name
from poetry.core.masonry.utils.helpers import escape_version
from poetry.utils._compat import Path
from poetry.utils.helpers import normalize_version
from poetry.utils.patterns import wheel_file_re
Expand Down
Loading

0 comments on commit a78669a

Please sign in to comment.