14
0
forked from pool/python-poetry

- Update to 1.2.1

* Bump poetry-core to 1.2.0.
  * Bump poetry-plugin-export to ^1.0.7.
- Release 1.2.0
  * https://python-poetry.org/blog/announcing-poetry-1.2.0/
  * Dropping support for Python 2.7, 3.5 and 3.6 as runtimes
  * Dependency groups
  * Plugin support
  * Migration of the poetry export command
  * Support for yanked releases (PEP 592)
  * Support for Direct Origin URL records (PEP 610)
  * Subdirectory support for Git dependencies
  * Single page repository support
  * Synchronizing the environment with the lock file
  * Opting out of binary distributions
  * Native Python git client
  * Detection of the currently active Python (experimental)
  * PEP 508 dependency specification parsing
  * Comprehensive HTTPS certificate support
  * Non-verbose error handling
  * Management of setuptools and pip
  * Keyring backend issues
  * Usefulness of experimental.new-installer false
- Drop patches
  * poetry-1645-1.1.patch
  * poetry-4749-1.1.patch
  * use-new-name-of-MockFixture.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-poetry?expand=0&rev=46
This commit is contained in:
2022-10-09 12:59:53 +00:00
committed by Git OBS Bridge
parent 19504719f7
commit a94ab860ea
7 changed files with 58 additions and 743 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:806faa098b43e2264183bd1d45d7014e4f03e7e924d7b33e8cf3156be77e3c7b
size 2369585

3
poetry-1.2.1.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6be8d7e4c198045924a25efb90285b92918a0d7e539bfa1c76127cd41b01466c
size 2486608

View File

@@ -1,565 +0,0 @@
Index: poetry-1.1.4/tests/config/test_config.py
===================================================================
--- poetry-1.1.4.orig/tests/config/test_config.py
+++ poetry-1.1.4/tests/config/test_config.py
@@ -10,8 +10,8 @@ def test_config_get_default_value(config
assert config.get(name) is value
-def test_config_get_processes_depended_on_values(config):
- assert os.path.join("/foo", "virtualenvs") == config.get("virtualenvs.path")
+def test_config_get_processes_depended_on_values(config, config_cache_dir):
+ assert str(config_cache_dir / "virtualenvs") == config.get("virtualenvs.path")
@pytest.mark.parametrize(
Index: poetry-1.1.4/tests/conftest.py
===================================================================
--- poetry-1.1.4.orig/tests/conftest.py
+++ poetry-1.1.4/tests/conftest.py
@@ -54,9 +54,21 @@ class Config(BaseConfig):
@pytest.fixture
-def config_source():
+def config_cache_dir(tmp_dir):
+ path = Path(tmp_dir) / ".cache" / "pypoetry"
+ path.mkdir(parents=True)
+ return path
+
+
+@pytest.fixture
+def config_virtualenvs_path(config_cache_dir):
+ return config_cache_dir / "virtualenvs"
+
+
+@pytest.fixture
+def config_source(config_cache_dir):
source = DictConfigSource()
- source.add_property("cache-dir", "/foo")
+ source.add_property("cache-dir", str(config_cache_dir))
return source
@@ -226,6 +238,7 @@ def project_factory(tmp_dir, config, rep
dependencies=None,
dev_dependencies=None,
pyproject_content=None,
+ poetry_lock_content=None,
install_deps=True,
):
project_dir = workspace / "poetry-fixture-{}".format(name)
@@ -249,6 +262,10 @@ def project_factory(tmp_dir, config, rep
dev_dependencies=dev_dependencies,
).create(project_dir, with_tests=False)
+ if poetry_lock_content:
+ lock_file = project_dir / "poetry.lock"
+ lock_file.write_text(data=poetry_lock_content, encoding="utf-8")
+
poetry = Factory().create_poetry(project_dir)
locker = TestLocker(
Index: poetry-1.1.4/tests/console/commands/test_config.py
===================================================================
--- poetry-1.1.4.orig/tests/console/commands/test_config.py
+++ poetry-1.1.4/tests/console/commands/test_config.py
@@ -25,35 +25,39 @@ def test_show_config_with_local_config_f
assert "" == tester.io.fetch_output()
-def test_list_displays_default_value_if_not_set(tester, config):
+def test_list_displays_default_value_if_not_set(tester, config, config_cache_dir):
tester.execute("--list")
- expected = """cache-dir = "/foo"
+ expected = """cache-dir = {cache}
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
-virtualenvs.path = {path} # /foo{sep}virtualenvs
+virtualenvs.path = {path} # {virtualenvs}
""".format(
- path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")), sep=os.path.sep
+ cache=json.dumps(str(config_cache_dir)),
+ path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")),
+ virtualenvs=str(config_cache_dir / "virtualenvs"),
)
assert expected == tester.io.fetch_output()
-def test_list_displays_set_get_setting(tester, config):
+def test_list_displays_set_get_setting(tester, config, config_cache_dir):
tester.execute("virtualenvs.create false")
tester.execute("--list")
- expected = """cache-dir = "/foo"
+ expected = """cache-dir = {cache}
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = false
virtualenvs.in-project = null
-virtualenvs.path = {path} # /foo{sep}virtualenvs
+virtualenvs.path = {path} # {virtualenvs}
""".format(
- path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")), sep=os.path.sep
+ cache=json.dumps(str(config_cache_dir)),
+ path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")),
+ virtualenvs=str(config_cache_dir / "virtualenvs"),
)
assert 0 == config.set_config_source.call_count
@@ -81,19 +85,21 @@ def test_display_single_local_setting(co
assert expected == tester.io.fetch_output()
-def test_list_displays_set_get_local_setting(tester, config):
+def test_list_displays_set_get_local_setting(tester, config, config_cache_dir):
tester.execute("virtualenvs.create false --local")
tester.execute("--list")
- expected = """cache-dir = "/foo"
+ expected = """cache-dir = {cache}
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = false
virtualenvs.in-project = null
-virtualenvs.path = {path} # /foo{sep}virtualenvs
+virtualenvs.path = {path} # {virtualenvs}
""".format(
- path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")), sep=os.path.sep
+ cache=json.dumps(str(config_cache_dir)),
+ path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")),
+ virtualenvs=str(config_cache_dir / "virtualenvs"),
)
assert 1 == config.set_config_source.call_count
Index: poetry-1.1.4/tests/console/commands/test_lock.py
===================================================================
--- poetry-1.1.4.orig/tests/console/commands/test_lock.py
+++ poetry-1.1.4/tests/console/commands/test_lock.py
@@ -1,11 +1,8 @@
-import shutil
-import sys
-
import pytest
-from poetry.factory import Factory
from poetry.packages import Locker
from poetry.utils._compat import Path
+from tests.helpers import get_package
@pytest.fixture
@@ -19,18 +16,26 @@ def tester(command_tester_factory):
@pytest.fixture
-def poetry_with_old_lockfile(fixture_dir, source_dir):
- project_dir = source_dir / "project"
- shutil.copytree(str(fixture_dir("old_lock")), str(project_dir))
- poetry = Factory().create_poetry(cwd=project_dir)
- return poetry
-
-
-@pytest.mark.skipif(
- sys.platform == "win32", reason="does not work on windows under ci environments"
-)
-def test_lock_no_update(command_tester_factory, poetry_with_old_lockfile, http):
- http.disable()
+def poetry_with_old_lockfile(project_factory, fixture_dir, source_dir):
+ source = fixture_dir("old_lock")
+ pyproject_content = (source / "pyproject.toml").read_text(encoding="utf-8")
+ poetry_lock_content = (source / "poetry.lock").read_text(encoding="utf-8")
+ return project_factory(
+ name="foobar",
+ pyproject_content=pyproject_content,
+ poetry_lock_content=poetry_lock_content,
+ )
+
+
+def test_lock_no_update(command_tester_factory, poetry_with_old_lockfile, repo):
+ repo.add_package(get_package("sampleproject", "1.3.1"))
+ repo.add_package(get_package("sampleproject", "2.0.0"))
+
+ locker = Locker(
+ lock=poetry_with_old_lockfile.pyproject.file.path.parent / "poetry.lock",
+ local_config=poetry_with_old_lockfile.locker._local_config,
+ )
+ poetry_with_old_lockfile.set_locker(locker)
locked_repository = poetry_with_old_lockfile.locker.locked_repository(
with_dev_reqs=True
Index: poetry-1.1.4/tests/fixtures/old_lock/poetry.lock
===================================================================
--- poetry-1.1.4.orig/tests/fixtures/old_lock/poetry.lock
+++ poetry-1.1.4/tests/fixtures/old_lock/poetry.lock
@@ -1,153 +1,19 @@
[[package]]
category = "main"
-description = "Python package for providing Mozilla's CA Bundle."
-name = "certifi"
-optional = false
-python-versions = "*"
-version = "2020.6.20"
-
-[[package]]
-category = "main"
-description = "Universal encoding detector for Python 2 and 3"
-name = "chardet"
-optional = false
-python-versions = "*"
-version = "3.0.4"
-
-[[package]]
-category = "main"
-description = "A Python library for the Docker Engine API."
-name = "docker"
-optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
-version = "4.3.1"
-
-[package.dependencies]
-pywin32 = "227"
-requests = ">=2.14.2,<2.18.0 || >2.18.0"
-six = ">=1.4.0"
-websocket-client = ">=0.32.0"
-
-[package.extras]
-ssh = ["paramiko (>=2.4.2)"]
-tls = ["pyOpenSSL (>=17.5.0)", "cryptography (>=1.3.4)", "idna (>=2.0.0)"]
-
-[[package]]
-category = "main"
-description = "Internationalized Domain Names in Applications (IDNA)"
-name = "idna"
-optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
-version = "2.10"
-
-[[package]]
-category = "main"
-description = "Python for Window Extensions"
-marker = "sys_platform == \"win32\""
-name = "pywin32"
-optional = false
-python-versions = "*"
-version = "227"
-
-[[package]]
-category = "main"
-description = "Python HTTP for Humans."
-name = "requests"
-optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
-version = "2.24.0"
-
-[package.dependencies]
-certifi = ">=2017.4.17"
-chardet = ">=3.0.2,<4"
-idna = ">=2.5,<3"
-urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26"
-
-[package.extras]
-security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
-socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
-
-[[package]]
-category = "main"
-description = "Python 2 and 3 compatibility utilities"
-name = "six"
-optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
-version = "1.15.0"
-
-[[package]]
-category = "main"
-description = "HTTP library with thread-safe connection pooling, file post, and more."
-name = "urllib3"
+description = "A sample Python project"
+name = "sampleproject"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
-version = "1.25.10"
-
-[package.extras]
-brotli = ["brotlipy (>=0.6.0)"]
-secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"]
-socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
-
-[[package]]
-category = "main"
-description = "WebSocket client for Python. hybi13 is supported."
-name = "websocket-client"
-optional = false
-python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
-version = "0.57.0"
-
-[package.dependencies]
-six = "*"
+version = "1.3.1"
[metadata]
-content-hash = "bb4c2f3c089b802c1930b6acbeed04711d93e9cdfd9a003eb17518a6d9f350c6"
+content-hash = "c8c2c9d899e47bac3972e029ef0e71b75d5df98a28eebef25a75640a19aac177"
lock-version = "1.0"
python-versions = "^3.8"
[metadata.files]
-certifi = [
- {file = "certifi-2020.6.20-py2.py3-none-any.whl", hash = "sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"},
- {file = "certifi-2020.6.20.tar.gz", hash = "sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"},
-]
-chardet = [
- {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"},
- {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"},
-]
-docker = [
- {file = "docker-4.3.1-py2.py3-none-any.whl", hash = "sha256:13966471e8bc23b36bfb3a6fb4ab75043a5ef1dac86516274777576bed3b9828"},
- {file = "docker-4.3.1.tar.gz", hash = "sha256:bad94b8dd001a8a4af19ce4becc17f41b09f228173ffe6a4e0355389eef142f2"},
-]
-idna = [
- {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
- {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
-]
-pywin32 = [
- {file = "pywin32-227-cp27-cp27m-win32.whl", hash = "sha256:371fcc39416d736401f0274dd64c2302728c9e034808e37381b5e1b22be4a6b0"},
- {file = "pywin32-227-cp27-cp27m-win_amd64.whl", hash = "sha256:4cdad3e84191194ea6d0dd1b1b9bdda574ff563177d2adf2b4efec2a244fa116"},
- {file = "pywin32-227-cp35-cp35m-win32.whl", hash = "sha256:f4c5be1a293bae0076d93c88f37ee8da68136744588bc5e2be2f299a34ceb7aa"},
- {file = "pywin32-227-cp35-cp35m-win_amd64.whl", hash = "sha256:a929a4af626e530383a579431b70e512e736e9588106715215bf685a3ea508d4"},
- {file = "pywin32-227-cp36-cp36m-win32.whl", hash = "sha256:300a2db938e98c3e7e2093e4491439e62287d0d493fe07cce110db070b54c0be"},
- {file = "pywin32-227-cp36-cp36m-win_amd64.whl", hash = "sha256:9b31e009564fb95db160f154e2aa195ed66bcc4c058ed72850d047141b36f3a2"},
- {file = "pywin32-227-cp37-cp37m-win32.whl", hash = "sha256:47a3c7551376a865dd8d095a98deba954a98f326c6fe3c72d8726ca6e6b15507"},
- {file = "pywin32-227-cp37-cp37m-win_amd64.whl", hash = "sha256:31f88a89139cb2adc40f8f0e65ee56a8c585f629974f9e07622ba80199057511"},
- {file = "pywin32-227-cp38-cp38-win32.whl", hash = "sha256:7f18199fbf29ca99dff10e1f09451582ae9e372a892ff03a28528a24d55875bc"},
- {file = "pywin32-227-cp38-cp38-win_amd64.whl", hash = "sha256:7c1ae32c489dc012930787f06244426f8356e129184a02c25aef163917ce158e"},
- {file = "pywin32-227-cp39-cp39-win32.whl", hash = "sha256:c054c52ba46e7eb6b7d7dfae4dbd987a1bb48ee86debe3f245a2884ece46e295"},
- {file = "pywin32-227-cp39-cp39-win_amd64.whl", hash = "sha256:f27cec5e7f588c3d1051651830ecc00294f90728d19c3bf6916e6dba93ea357c"},
-]
-requests = [
- {file = "requests-2.24.0-py2.py3-none-any.whl", hash = "sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"},
- {file = "requests-2.24.0.tar.gz", hash = "sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b"},
-]
-six = [
- {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
- {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},
-]
-urllib3 = [
- {file = "urllib3-1.25.10-py2.py3-none-any.whl", hash = "sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461"},
- {file = "urllib3-1.25.10.tar.gz", hash = "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"},
-]
-websocket-client = [
- {file = "websocket_client-0.57.0-py2.py3-none-any.whl", hash = "sha256:0fc45c961324d79c781bab301359d5a1b00b13ad1b10415a4780229ef71a5549"},
- {file = "websocket_client-0.57.0.tar.gz", hash = "sha256:d735b91d6d1692a6a181f2a8c9e0238e5f6373356f561bb9dc4c7af36f452010"},
+sampleproject = [
+ {file = "sampleproject-1.3.1-py2.py3-none-any.whl", hash = "sha256:26c9172e08244873b0e09c574a229bf2c251c67723a05e08fd3ec0c5ee423796"},
+ {file = "sampleproject-1.3.1-py3-none-any.whl", hash = "sha256:75bb5bb4e74a1b77dc0cff25ebbacb54fe1318aaf99a86a036cefc86ed885ced"},
+ {file = "sampleproject-1.3.1.tar.gz", hash = "sha256:3593ca2f1e057279d70d6144b14472fb28035b1da213dde60906b703d6f82c55"},
]
Index: poetry-1.1.4/tests/fixtures/old_lock/pyproject.toml
===================================================================
--- poetry-1.1.4.orig/tests/fixtures/old_lock/pyproject.toml
+++ poetry-1.1.4/tests/fixtures/old_lock/pyproject.toml
@@ -6,7 +6,7 @@ authors = ["Poetry Developer <developer@
[tool.poetry.dependencies]
python = "^3.8"
-docker = "^4.3.1"
+sampleproject = ">=1.3.1"
[tool.poetry.dev-dependencies]
Index: poetry-1.1.4/tests/installation/test_chef.py
===================================================================
--- poetry-1.1.4.orig/tests/installation/test_chef.py
+++ poetry-1.1.4/tests/installation/test_chef.py
@@ -60,7 +60,7 @@ def test_get_cached_archives_for_link(co
}
-def test_get_cache_directory_for_link(config):
+def test_get_cache_directory_for_link(config, config_cache_dir):
chef = Chef(
config,
MockEnv(
@@ -71,8 +71,11 @@ def test_get_cache_directory_for_link(co
directory = chef.get_cache_directory_for_link(
Link("https://files.python-poetry.org/poetry-1.1.0.tar.gz")
)
+
expected = Path(
- "/foo/artifacts/ba/63/13/283a3b3b7f95f05e9e6f84182d276f7bb0951d5b0cc24422b33f7a4648"
+ "{}/artifacts/ba/63/13/283a3b3b7f95f05e9e6f84182d276f7bb0951d5b0cc24422b33f7a4648".format(
+ config_cache_dir.as_posix()
+ )
)
assert expected == directory
Index: poetry-1.1.4/tests/installation/test_executor.py
===================================================================
--- poetry-1.1.4.orig/tests/installation/test_executor.py
+++ poetry-1.1.4/tests/installation/test_executor.py
@@ -126,9 +126,11 @@ Package operations: 4 installs, 1 update
assert 5 == len(env.executed)
-def test_execute_shows_skipped_operations_if_verbose(config, pool, io):
+def test_execute_shows_skipped_operations_if_verbose(
+ config, pool, io, config_cache_dir
+):
config = Config()
- config.merge({"cache-dir": "/foo"})
+ config.merge({"cache-dir": config_cache_dir.as_posix()})
env = MockEnv()
executor = Executor(env, pool, config, io)
Index: poetry-1.1.4/tests/masonry/builders/test_editable_builder.py
===================================================================
--- poetry-1.1.4.orig/tests/masonry/builders/test_editable_builder.py
+++ poetry-1.1.4/tests/masonry/builders/test_editable_builder.py
@@ -176,9 +176,9 @@ if __name__ == '__main__':
def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts(
- extended_poetry,
+ extended_poetry, tmp_dir
):
- env = MockEnv(path=Path("/foo"))
+ env = MockEnv(path=Path(tmp_dir) / "foo")
builder = EditableBuilder(extended_poetry, env, NullIO())
builder.build()
@@ -219,8 +219,8 @@ def test_builder_installs_proper_files_w
assert len(paths) == len(expected)
-def test_builder_should_execute_build_scripts(extended_without_setup_poetry):
- env = MockEnv(path=Path("/foo"))
+def test_builder_should_execute_build_scripts(extended_without_setup_poetry, tmp_dir):
+ env = MockEnv(path=Path(tmp_dir) / "foo")
builder = EditableBuilder(extended_without_setup_poetry, env, NullIO())
builder.build()
Index: poetry-1.1.4/tests/utils/test_env.py
===================================================================
--- poetry-1.1.4.orig/tests/utils/test_env.py
+++ poetry-1.1.4/tests/utils/test_env.py
@@ -118,7 +118,9 @@ def test_env_get_venv_with_venv_folder_p
assert venv.path == in_project_venv_dir
-def build_venv(path, executable=None): # type: (Union[Path,str], Optional[str]) -> ()
+def build_venv(
+ path, executable=None, flags=None
+): # type: (Union[Path,str], Optional[str], bool) -> ()
os.mkdir(str(path))
@@ -156,7 +158,7 @@ def test_activate_activates_non_existing
venv_name = EnvManager.generate_env_name("simple-project", str(poetry.file.parent))
m.assert_called_with(
- Path(tmp_dir) / "{}-py3.7".format(venv_name), executable="python3.7"
+ Path(tmp_dir) / "{}-py3.7".format(venv_name), executable="python3.7",
)
envs_file = TOMLFile(Path(tmp_dir) / "envs.toml")
@@ -274,7 +276,7 @@ def test_activate_activates_different_vi
env = manager.activate("python3.6", NullIO())
m.assert_called_with(
- Path(tmp_dir) / "{}-py3.6".format(venv_name), executable="python3.6"
+ Path(tmp_dir) / "{}-py3.6".format(venv_name), executable="python3.6",
)
assert envs_file.exists()
@@ -326,7 +328,7 @@ def test_activate_activates_recreates_fo
env = manager.activate("python3.7", NullIO())
build_venv_m.assert_called_with(
- Path(tmp_dir) / "{}-py3.7".format(venv_name), executable="python3.7"
+ Path(tmp_dir) / "{}-py3.7".format(venv_name), executable="python3.7",
)
remove_venv_m.assert_called_with(Path(tmp_dir) / "{}-py3.7".format(venv_name))
@@ -634,7 +636,7 @@ def test_run_with_input_non_zero_return(
def test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_ones_first(
- manager, poetry, config, mocker
+ manager, poetry, config, mocker, config_virtualenvs_path
):
if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"]
@@ -654,12 +656,12 @@ def test_create_venv_tries_to_find_a_com
manager.create_venv(NullIO())
m.assert_called_with(
- Path("/foo/virtualenvs/{}-py3.7".format(venv_name)), executable="python3"
+ config_virtualenvs_path / "{}-py3.7".format(venv_name), executable="python3",
)
def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific_ones(
- manager, poetry, config, mocker
+ manager, poetry, config, mocker, config_virtualenvs_path
):
if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"]
@@ -678,7 +680,7 @@ def test_create_venv_tries_to_find_a_com
manager.create_venv(NullIO())
m.assert_called_with(
- Path("/foo/virtualenvs/{}-py3.9".format(venv_name)), executable="python3.9"
+ config_virtualenvs_path / "{}-py3.9".format(venv_name), executable="python3.9",
)
@@ -737,7 +739,7 @@ def test_create_venv_does_not_try_to_fin
def test_create_venv_uses_patch_version_to_detect_compatibility(
- manager, poetry, config, mocker
+ manager, poetry, config, mocker, config_virtualenvs_path
):
if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"]
@@ -761,17 +763,14 @@ def test_create_venv_uses_patch_version_
assert not check_output.called
m.assert_called_with(
- Path(
- "/foo/virtualenvs/{}-py{}.{}".format(
- venv_name, version.major, version.minor
- )
- ),
+ config_virtualenvs_path
+ / "{}-py{}.{}".format(venv_name, version.major, version.minor),
executable=None,
)
def test_create_venv_uses_patch_version_to_detect_compatibility_with_executable(
- manager, poetry, config, mocker
+ manager, poetry, config, mocker, config_virtualenvs_path
):
if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"]
@@ -798,11 +797,8 @@ def test_create_venv_uses_patch_version_
assert check_output.called
m.assert_called_with(
- Path(
- "/foo/virtualenvs/{}-py{}.{}".format(
- venv_name, version.major, version.minor - 1
- )
- ),
+ config_virtualenvs_path
+ / "{}-py{}.{}".format(venv_name, version.major, version.minor - 1),
executable="python{}.{}".format(version.major, version.minor - 1),
)

View File

@@ -1,108 +0,0 @@
Index poetry-1.1.10
Index: poetry-1.1.12/pyproject.toml
===================================================================
--- poetry-1.1.12.orig/pyproject.toml
+++ poetry-1.1.12/pyproject.toml
@@ -40,7 +40,8 @@ html5lib = "^1.0"
shellingham = "^1.1"
tomlkit = ">=0.7.0,<1.0.0"
pexpect = "^4.7.0"
-packaging = "^20.4"
+# packaging uses calver, so version is unclamped
+packaging = ">=20.4"
virtualenv = { version = "^20.0.26" }
# The typing module is not in the stdlib in Python 2.7
Index: poetry-1.1.12/poetry/utils/env.py
===================================================================
--- poetry-1.1.12.orig/poetry/utils/env.py
+++ poetry-1.1.12/poetry/utils/env.py
@@ -7,7 +7,6 @@ import re
import shutil
import sys
import sysconfig
-import textwrap
from contextlib import contextmanager
from copy import deepcopy
@@ -44,6 +43,25 @@ from poetry.utils.helpers import is_dir_
from poetry.utils.helpers import paths_csv
+GET_SYS_TAGS = f"""
+import importlib.util
+import json
+import sys
+
+from pathlib import Path
+
+spec = importlib.util.spec_from_file_location("packaging", Path(r"{packaging.__file__}"))
+packaging = importlib.util.module_from_spec(spec)
+sys.modules[spec.name] = packaging
+
+spec = importlib.util.spec_from_file_location("packaging.tags", Path(r"{packaging.tags.__file__}"))
+packaging_tags = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(packaging_tags)
+
+print(json.dumps([(t.interpreter, t.abi, t.platform) for t in packaging_tags.sys_tags()]))
+"""
+
+
GET_ENVIRONMENT_INFO = """\
import json
import os
@@ -1382,32 +1400,7 @@ class VirtualEnv(Env):
return [self._bin(self._pip_executable)]
def get_supported_tags(self): # type: () -> List[Tag]
- file_path = Path(packaging.tags.__file__)
- if file_path.suffix == ".pyc":
- # Python 2
- file_path = file_path.with_suffix(".py")
-
- with file_path.open(encoding="utf-8") as f:
- script = decode(f.read())
-
- script = script.replace(
- "from ._typing import TYPE_CHECKING, cast",
- "TYPE_CHECKING = False\ncast = lambda type_, value: value",
- )
- script = script.replace(
- "from ._typing import MYPY_CHECK_RUNNING, cast",
- "MYPY_CHECK_RUNNING = False\ncast = lambda type_, value: value",
- )
-
- script += textwrap.dedent(
- """
- import json
-
- print(json.dumps([(t.interpreter, t.abi, t.platform) for t in sys_tags()]))
- """
- )
-
- output = self.run_python_script(script)
+ output = self.run(self._executable, "-", input_=GET_SYS_TAGS)
return [Tag(*t) for t in json.loads(output)]
Index: poetry-1.1.12/tests/utils/test_env.py
===================================================================
--- poetry-1.1.12.orig/tests/utils/test_env.py
+++ poetry-1.1.12/tests/utils/test_env.py
@@ -97,6 +97,16 @@ def test_env_shell_commands_with_stdinpu
)
+def test_env_get_supported_tags_matches_inside_virtualenv(tmp_dir, manager):
+ venv_path = Path(tmp_dir) / "Virtual Env"
+ manager.build_venv(str(venv_path))
+ venv = VirtualEnv(venv_path)
+
+ import packaging.tags
+
+ assert venv.get_supported_tags() == list(packaging.tags.sys_tags())
+
+
@pytest.fixture
def in_project_venv_dir(poetry):
os.environ.pop("VIRTUAL_ENV", None)

View File

@@ -1,3 +1,34 @@
-------------------------------------------------------------------
Sun Oct 9 12:43:51 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 1.2.1
* Bump poetry-core to 1.2.0.
* Bump poetry-plugin-export to ^1.0.7.
- Release 1.2.0
* https://python-poetry.org/blog/announcing-poetry-1.2.0/
* Dropping support for Python 2.7, 3.5 and 3.6 as runtimes
* Dependency groups
* Plugin support
* Migration of the poetry export command
* Support for yanked releases (PEP 592)
* Support for Direct Origin URL records (PEP 610)
* Subdirectory support for Git dependencies
* Single page repository support
* Synchronizing the environment with the lock file
* Opting out of binary distributions
* Native Python git client
* Detection of the currently active Python (experimental)
* PEP 508 dependency specification parsing
* Comprehensive HTTPS certificate support
* Non-verbose error handling
* Management of setuptools and pip
* Keyring backend issues
* Usefulness of experimental.new-installer false
- Drop patches
* poetry-1645-1.1.patch
* poetry-4749-1.1.patch
* use-new-name-of-MockFixture.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Aug 26 16:23:30 UTC 2022 - Ben Greiner <code@bnavigator.de> Fri Aug 26 16:23:30 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@@ -16,10 +16,8 @@
# #
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-poetry Name: python-poetry
Version: 1.1.15 Version: 1.2.1
Release: 0 Release: 0
Summary: Python dependency management and packaging Summary: Python dependency management and packaging
License: MIT License: MIT
@@ -27,52 +25,52 @@ Group: Development/Languages/Python
URL: https://python-poetry.org/ URL: https://python-poetry.org/
# PyPI sdist doesnt contain tests # PyPI sdist doesnt contain tests
Source: https://github.com/python-poetry/poetry/archive/%{version}.tar.gz#/poetry-%{version}.tar.gz Source: https://github.com/python-poetry/poetry/archive/%{version}.tar.gz#/poetry-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/python-poetry/poetry/pull/3255#issuecomment-713442094 -- remove external http call requirement for lock --no-update
Patch0: poetry-1645-1.1.patch
# PATCH-FIX-UPSTREAM https://github.com/python-poetry/poetry/commit/9591e88492508d4dba260952d53266a0032c04c7
Patch1: use-new-name-of-MockFixture.patch
# PATCH-FIX-UPSTREAM https://github.com/python-poetry/poetry/pull/4749 -- make compatible with packaging >= 21
Patch2: poetry-4749-1.1.patch
BuildRequires: %{python_module CacheControl >= 0.12.9} BuildRequires: %{python_module CacheControl >= 0.12.9}
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module cachy >= 0.3.0} BuildRequires: %{python_module cachy >= 0.3.0}
BuildRequires: %{python_module cleo >= 0.8.1} BuildRequires: %{python_module cleo >= 1.0.0~a5}
BuildRequires: %{python_module clikit >= 0.6.2}
BuildRequires: %{python_module crashtest >= 0.3.0} BuildRequires: %{python_module crashtest >= 0.3.0}
BuildRequires: %{python_module html5lib >= 1.0} BuildRequires: %{python_module html5lib >= 1.0}
BuildRequires: %{python_module importlib-metadata if %python-base < 3.6} BuildRequires: %{python_module importlib-metadata >= 4.4 if %python-base < 3.10}
BuildRequires: %{python_module jsonschema >= 4.10.0}
BuildRequires: %{python_module keyring >= 21.2.0} BuildRequires: %{python_module keyring >= 21.2.0}
BuildRequires: %{python_module plugin-export >= 1.0.7}
BuildRequires: %{python_module poetry-core >= 1.2.0}
# cachecontrol[filecache] # cachecontrol[filecache]
BuildRequires: %{python_module lockfile >= 0.9} BuildRequires: %{python_module lockfile >= 0.9}
BuildRequires: %{python_module packaging >= 20.4} BuildRequires: %{python_module packaging >= 20.4}
BuildRequires: %{python_module pexpect >= 4.7.0} BuildRequires: %{python_module pexpect >= 4.7.0}
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: %{python_module pkginfo >= 1.4} BuildRequires: %{python_module pkginfo >= 1.5}
BuildRequires: %{python_module poetry-core >= 1.0.7}
BuildRequires: %{python_module requests >= 2.18} BuildRequires: %{python_module requests >= 2.18}
BuildRequires: %{python_module requests-toolbelt >= 0.9.1} BuildRequires: %{python_module requests-toolbelt >= 0.9.1}
BuildRequires: %{python_module shellingham >= 1.1} BuildRequires: %{python_module shellingham >= 1.5}
BuildRequires: %{python_module tomlkit >= 0.7.0} BuildRequires: %{python_module tomlkit >= 0.11.4}
BuildRequires: %{python_module virtualenv >= 20.0.26} BuildRequires: %{python_module virtualenv >= 20.4.7}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-CacheControl >= 0.12.9 Requires: python-CacheControl >= 0.12.9
Requires: python-cachy >= 0.3.0 Requires: python-cachy >= 0.3.0
Requires: python-cleo >= 0.8.1 Requires: python-cleo >= 1.0.0~a5
Requires: python-clikit >= 0.6.2
Requires: python-crashtest >= 0.3.0 Requires: python-crashtest >= 0.3.0
Requires: python-html5lib >= 1.0 Requires: python-html5lib >= 1.0
Requires: python-jsonschema >= 4.10.0
Requires: python-keyring >= 21.2.0 Requires: python-keyring >= 21.2.0
Requires: python-plugin-export >= 1.0.7
Requires: python-poetry-core >= 1.2.0
# cachecontrol[filecache] # cachecontrol[filecache]
Requires: python-lockfile >= 0.9 Requires: python-lockfile >= 0.9
Requires: python-packaging >= 20.4 Requires: python-packaging >= 20.4
Requires: python-pexpect >= 4.7.0 Requires: python-pexpect >= 4.7.0
Requires: python-pkginfo >= 1.4 Requires: python-pkginfo >= 1.5
Requires: python-poetry-core >= 1.0.7
Requires: python-requests >= 2.18 Requires: python-requests >= 2.18
Requires: python-requests-toolbelt >= 0.9.1 Requires: python-requests-toolbelt >= 0.9.1
Requires: python-shellingham >= 1.1 Requires: python-shellingham >= 1.5
Requires: python-tomlkit >= 0.7.0 Requires: python-tomlkit >= 0.11.4
Requires: python-virtualenv >= 20.0.26 Requires: python-virtualenv >= 20.47
%if 0%{?python_version_nodots} < 310
Requires: python-importlib-metadata >= 4.4
%endif
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun):update-alternatives Requires(postun):update-alternatives
Recommends: git-core Recommends: git-core
@@ -91,8 +89,8 @@ Python dependency management and packaging made easy.
%prep %prep
%autosetup -p1 -n poetry-%{version} %autosetup -p1 -n poetry-%{version}
rm poetry/_vendor/.gitignore rm src/poetry/_vendor/.gitignore
rmdir poetry/_vendor rmdir src/poetry/_vendor
find poetry -name '*.py' -executable -print0 | xargs -0 chmod a-x find poetry -name '*.py' -executable -print0 | xargs -0 chmod a-x
%build %build

View File

@@ -1,41 +0,0 @@
From: Antonio Larrosa <alarrosa@suse.com>
This is mainly like
https://github.com/python-poetry/poetry/commit/9591e88492508d4dba260952d53266a0032c04c7
but without changing most package versions which is unrelated to this change.
Index: poetry-1.1.13/tests/repositories/test_installed_repository.py
===================================================================
--- poetry-1.1.13.orig/tests/repositories/test_installed_repository.py
+++ poetry-1.1.13/tests/repositories/test_installed_repository.py
@@ -2,7 +2,7 @@ from typing import Optional
import pytest
-from pytest_mock.plugin import MockFixture
+from pytest_mock.plugin import MockerFixture
from poetry.core.packages import Package
from poetry.repositories.installed_repository import InstalledRepository
@@ -53,7 +53,7 @@ def env(): # type: () -> MockEnv
@pytest.fixture
-def repository(mocker, env): # type: (MockFixture, MockEnv) -> InstalledRepository
+def repository(mocker, env): # type: (MockerFixture, MockEnv) -> InstalledRepository
mocker.patch(
"poetry.utils._compat.metadata.Distribution.discover",
return_value=INSTALLED_RESULTS,
Index: poetry-1.1.13/pyproject.toml
===================================================================
--- poetry-1.1.13.orig/pyproject.toml
+++ poetry-1.1.13/pyproject.toml
@@ -70,7 +70,7 @@ pytest = [
{version = "^6.2.5", python = ">=3.6"}
]
pytest-cov = "^2.5"
-pytest-mock = "^1.9"
+pytest-mock = "^3.5"
pre-commit = { version = "^2.6", python = "^3.6.1" }
tox = "^3.0"
pytest-sugar = "^0.9.2"