From 2595c767376516482bf0e02a706d3d4029acc340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Thu, 25 Aug 2022 20:58:10 +0200 Subject: [PATCH 1/2] repository: keep (uncanonicalized) pretty_name --- src/poetry/puzzle/provider.py | 2 +- src/poetry/repositories/cached.py | 7 +- src/poetry/repositories/legacy_repository.py | 2 +- src/poetry/repositories/pool.py | 3 +- src/poetry/repositories/repository.py | 6 +- .../masonry/builders/test_editable_builder.py | 5 +- .../fixtures/legacy/discord-py.html | 11 ++ .../dists/discord.py-2.0.0-py3-none-any.whl | Bin 0 -> 2290 bytes .../pypi.org/json/discord-py/2.0.0.json | 113 ++++++++++++++++++ tests/repositories/test_legacy_repository.py | 43 ++++--- tests/repositories/test_pool.py | 3 +- tests/repositories/test_pypi_repository.py | 24 ++-- tests/repositories/test_repository.py | 14 ++- 13 files changed, 188 insertions(+), 45 deletions(-) create mode 100644 tests/repositories/fixtures/legacy/discord-py.html create mode 100644 tests/repositories/fixtures/pypi.org/dists/discord.py-2.0.0-py3-none-any.whl create mode 100644 tests/repositories/fixtures/pypi.org/json/discord-py/2.0.0.json diff --git a/src/poetry/puzzle/provider.py b/src/poetry/puzzle/provider.py index b1fd6d10e19..92db9901251 100644 --- a/src/poetry/puzzle/provider.py +++ b/src/poetry/puzzle/provider.py @@ -528,7 +528,7 @@ def complete_package( dependency_package = DependencyPackage( dependency, self._pool.package( - package.name, + package.pretty_name, package.version, extras=list(dependency.extras), repository=dependency.source_name, diff --git a/src/poetry/repositories/cached.py b/src/poetry/repositories/cached.py index a4b6b6ad089..8c5b74a6089 100644 --- a/src/poetry/repositories/cached.py +++ b/src/poetry/repositories/cached.py @@ -6,6 +6,7 @@ from typing import Any from cachy import CacheManager +from packaging.utils import canonicalize_name from poetry.core.semver.helpers import parse_constraint from poetry.config.config import Config @@ -78,8 +79,10 @@ def get_release_info(self, name: NormalizedName, version: Version) -> PackageInf def package( self, - name: NormalizedName, + name: str, version: Version, extras: list[str] | None = None, ) -> Package: - return self.get_release_info(name, version).to_package(name=name, extras=extras) + return self.get_release_info(canonicalize_name(name), version).to_package( + name=name, extras=extras + ) diff --git a/src/poetry/repositories/legacy_repository.py b/src/poetry/repositories/legacy_repository.py index 51aece929d0..c4019b6f174 100644 --- a/src/poetry/repositories/legacy_repository.py +++ b/src/poetry/repositories/legacy_repository.py @@ -34,7 +34,7 @@ def __init__( super().__init__(name, url.rstrip("/"), config, disable_cache) def package( - self, name: NormalizedName, version: Version, extras: list[str] | None = None + self, name: str, version: Version, extras: list[str] | None = None ) -> Package: """ Retrieve the release information. diff --git a/src/poetry/repositories/pool.py b/src/poetry/repositories/pool.py index c7fdcac0115..edc53e71ba2 100644 --- a/src/poetry/repositories/pool.py +++ b/src/poetry/repositories/pool.py @@ -7,7 +7,6 @@ if TYPE_CHECKING: - from packaging.utils import NormalizedName from poetry.core.packages.dependency import Dependency from poetry.core.packages.package import Package from poetry.core.semver.version import Version @@ -134,7 +133,7 @@ def has_package(self, package: Package) -> bool: def package( self, - name: NormalizedName, + name: str, version: Version, extras: list[str] | None = None, repository: str | None = None, diff --git a/src/poetry/repositories/repository.py b/src/poetry/repositories/repository.py index 2d823bf7276..ee60bcf10c2 100644 --- a/src/poetry/repositories/repository.py +++ b/src/poetry/repositories/repository.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING +from packaging.utils import canonicalize_name from poetry.core.semver.helpers import parse_constraint from poetry.core.semver.version import Version from poetry.core.semver.version_constraint import VersionConstraint @@ -139,10 +140,11 @@ def find_links_for_package(self, package: Package) -> list[Link]: return [] def package( - self, name: NormalizedName, version: Version, extras: list[str] | None = None + self, name: str, version: Version, extras: list[str] | None = None ) -> Package: + canonicalized_name = canonicalize_name(name) for package in self.packages: - if name == package.name and package.version == version: + if canonicalized_name == package.name and package.version == version: return package.clone() raise PackageNotFound(f"Package {name} ({version}) not found.") diff --git a/tests/masonry/builders/test_editable_builder.py b/tests/masonry/builders/test_editable_builder.py index eda23be8eef..d8375198417 100644 --- a/tests/masonry/builders/test_editable_builder.py +++ b/tests/masonry/builders/test_editable_builder.py @@ -12,7 +12,6 @@ from cleo.io.null_io import NullIO from deepdiff import DeepDiff -from packaging.utils import canonicalize_name from poetry.core.semver.version import Version from poetry.factory import Factory @@ -243,9 +242,7 @@ def test_builder_setup_generation_runs_with_pip_editable(tmp_dir: str) -> None: # is the package installed? repository = InstalledRepository.load(venv) - package = repository.package( - canonicalize_name("extended-project"), Version.parse("1.2.3") - ) + package = repository.package("extended-project", Version.parse("1.2.3")) assert package.name == "extended-project" # check for the module built by build.py diff --git a/tests/repositories/fixtures/legacy/discord-py.html b/tests/repositories/fixtures/legacy/discord-py.html new file mode 100644 index 00000000000..af4a2212f26 --- /dev/null +++ b/tests/repositories/fixtures/legacy/discord-py.html @@ -0,0 +1,11 @@ + + + + Links for discord-py + +

Links for discord-py

+ discord.py-2.0.0-py3-none-any.whl
+ discord.py-2.0.0.tar.gz
+ + + diff --git a/tests/repositories/fixtures/pypi.org/dists/discord.py-2.0.0-py3-none-any.whl b/tests/repositories/fixtures/pypi.org/dists/discord.py-2.0.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..5a9e7fab81d3f185988fa7cd1f5a419435c5cf7c GIT binary patch literal 2290 zcmWIWW@h1H0D;Ut!9XwrN`ORDGK-V*i&FFoDg%J(M8GnymP&>qtCL1ir)#8V0E9q| zCAyh;Y5DpvjT{V1rG-LgHm_V;$Hc&3$-=;(gkPhNr?abHuxo12*}hu_0{ebzy3HwD zTJl@@>!sO>X&a>`o#0$5JO6sA*GXM1A+W z%-rREOsuRz^6bX1UjpneP4}O_zfQvKZOMDj(8CY@8%%rsF=dYNHuc9Vt}ec}|3cxK zs`axw_!eJF;SbqhO+nCmuLU;5M8Y(s#eP_mCpY!s8{MRZ|J$3 zw?ZB)K6dT7@D*+OFMP``_sQApIo~Cn^i9IB!(`X16JJE`z4I?I+_yE|-{XOMFnb?| zb7^_rgNI*t8mkwFCNSDPEkF44rlR8q$%`k=o(b&xDw1vS-um&a4k_Uk-_!e-Ie*@D zu0!#-yY-~YvEmXvW!Kl_zgsjxR4dW^!v3`xm-cS?CX#lu)-2~&fn2r6E6&RiYjT4A zEY0pe=Tf^NHeJ7i?c_c~#fiU1=zwVzbf2S@`ik=p|j^$)i(bT^aHg;qlf z)Y+2^7FI;P(}))GFaHv|tkC6A`Z|}u4L%cNo_C78I9W0=CuyeLWtkl&hwURD>GNDN zQs%g~a)}1h&8QVexm4$$cA2)jLpOD1)8uIiPp1@zo;s@buF8t?55s+p)u93_#3J_vf2s__EdJV`X2~o_;db)@NaHJ>ir5#_U56F-|qva-coi3 z24(!I*Vi?~(Zw;uaqbk~Vqo%Zd;d?gT6yk4GnFOsStof^OHNG@P*Zuk@N)A6^94t? zg?Os%*uPKPBZ{Zw(U(IK?|<+4t+-bI!p9bCxjNV6rKcoi+}|dgF;1D_p*_V@DV8nz zV%Qa~WvFjUsKt%ZsRwig&YA0cQ9Jx#^C^QXHGb2$pKnPmw3(h4 zct&aArXO7n-?i^~UDG~s$>4@d(?pRO(M|eo*AE_9VJ)J!XQz~*Mfjo<2IY4GbI+=O zR@aVoW2G{RyI0#eXLGZp@7Upfc}-}Fj%{)?r)1E1$>!M~r+<99 zz3_tn&aI!q7A<5d>|A+ipWBR}nXRnH9*8(C_~WTqbJvhHO*3rA@o9U16j`;*yXK~A zxbS}+NB=`DqcgJ4I5VqUl?=sM{-5-355L&AQs{87#K)Sr4?m-@JUs!Nxw z*kZKyGZuVVc=^k_{6*)q_v?GloRGF*k!|9G@GS8yRf?ZQWlDF?T_LA!B0beRiJN`4#UbGgp?+ z`rauxIo3b*ozC2k6XkDaURn8TP3N&jPj$QRGxK-yeYmJG{gjlGqSzgk7vGltzWam! zk(~d0Y3J2n@2=GO8(8@9)83k0U)H~V<&<|i#v?S^|LK)$X*YB;WHtxk7et-Y;X@o3Tx%*Es5!LCGIdJAexBml;wGF~DRG!V374f4GOMt50}F zYHE&dSZYymW`3TPf}x%PmwRenYEfcIevy?z5~z-dF9)en&@j+5HrF%M=1.3.0) ; extra == 'voice'", + "typing-extensions (<5,>=4.3) ; extra == 'test'", + "pytest-mock ; extra == 'test'", + "pytest-cov ; extra == 'test'", + "pytest-asyncio ; extra == 'test'", + "pytest ; extra == 'test'", + "coverage[toml] ; extra == 'test'", + "cchardet ; extra == 'speed'", + "Brotli ; extra == 'speed'", + "aiodns (>=1.1) ; extra == 'speed'", + "orjson (>=3.5.4) ; extra == 'speed'", + "typing-extensions (<5,>=4.3) ; extra == 'docs'", + "sphinxcontrib-websupport ; extra == 'docs'", + "sphinxcontrib-trio (==1.1.2) ; extra == 'docs'", + "sphinx (==4.4.0) ; extra == 'docs'", + "aiohttp (<4,>=3.7.4)" + ], + "requires_python": ">=3.8.0", + "summary": "A Python wrapper for the Discord API", + "version": "2.0.0", + "yanked": false, + "yanked_reason": null + }, + "last_serial": 14796560, + "urls": [ + { + "comment_text": "", + "digests": { + "md5": "4df2fceef99934d1fdac5a9b0aa94173", + "sha256": "18b06870bdc85d29e0d55f4a4b2abe9d7cdae2b197e23d49f82886ba27ba1aec" + }, + "downloads": -1, + "filename": "discord.py-2.0.0-py3-none-any.whl", + "has_sig": false, + "md5_digest": "4df2fceef99934d1fdac5a9b0aa94173", + "packagetype": "bdist_wheel", + "python_version": "py3", + "requires_python": ">=3.8.0", + "size": 1059049, + "upload_time": "2022-08-18T03:47:52", + "upload_time_iso_8601": "2022-08-18T03:47:52.438785Z", + "url": "https://files.pythonhosted.org/packages/0e/d9/7b057cab41c16144925ba4f96dab576a8ebb7b80a98d40e06bd94298eb3b/discord.py-2.0.0-py3-none-any.whl", + "yanked": false, + "yanked_reason": null + }, + { + "comment_text": "", + "digests": { + "md5": "3aaca51997210bd2ae4d4b5401c00ab7", + "sha256": "c36f26935938194c3465c2abf8ecfbbf5560c50b189f1b746d6f00d1e78c0d3b" + }, + "downloads": -1, + "filename": "discord.py-2.0.0.tar.gz", + "has_sig": false, + "md5_digest": "3aaca51997210bd2ae4d4b5401c00ab7", + "packagetype": "sdist", + "python_version": "source", + "requires_python": ">=3.8.0", + "size": 955054, + "upload_time": "2022-08-18T03:47:54", + "upload_time_iso_8601": "2022-08-18T03:47:54.173712Z", + "url": "https://files.pythonhosted.org/packages/4c/73/fb89115b07588bf7a46e9eca972b89dd62b5856abd52297fe130b41d9d63/discord.py-2.0.0.tar.gz", + "yanked": false, + "yanked_reason": null + } + ], + "vulnerabilities": [] +} diff --git a/tests/repositories/test_legacy_repository.py b/tests/repositories/test_legacy_repository.py index be1d646b50d..061471409d9 100644 --- a/tests/repositories/test_legacy_repository.py +++ b/tests/repositories/test_legacy_repository.py @@ -148,7 +148,7 @@ def test_missing_version() -> None: def test_get_package_information_fallback_read_setup() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("jupyter"), Version.parse("1.0.0")) + package = repo.package("jupyter", Version.parse("1.0.0")) assert package.source_type == "legacy" assert package.source_reference == repo.name @@ -164,9 +164,7 @@ def test_get_package_information_fallback_read_setup() -> None: def test_get_package_information_skips_dependencies_with_invalid_constraints() -> None: repo = MockRepository() - package = repo.package( - canonicalize_name("python-language-server"), Version.parse("0.21.2") - ) + package = repo.package("python-language-server", Version.parse("0.21.2")) assert package.name == "python-language-server" assert package.version.text == "0.21.2" @@ -199,6 +197,15 @@ def test_get_package_information_skips_dependencies_with_invalid_constraints() - ] +def test_package_not_canonicalized() -> None: + repo = MockRepository() + + package = repo.package("discord.py", Version.parse("2.0.0")) + + assert package.name == "discord-py" + assert package.pretty_name == "discord.py" + + def test_find_packages_no_prereleases() -> None: repo = MockRepository() @@ -255,7 +262,7 @@ def test_find_packages_yanked(constraint: str, expected: list[str]) -> None: def test_get_package_information_chooses_correct_distribution() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("isort"), Version.parse("4.3.4")) + package = repo.package("isort", Version.parse("4.3.4")) assert package.name == "isort" assert package.version.text == "4.3.4" @@ -268,7 +275,7 @@ def test_get_package_information_chooses_correct_distribution() -> None: def test_get_package_information_includes_python_requires() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("futures"), Version.parse("3.2.0")) + package = repo.package("futures", Version.parse("3.2.0")) assert package.name == "futures" assert package.version.text == "3.2.0" @@ -280,7 +287,7 @@ def test_get_package_information_sets_appropriate_python_versions_if_wheels_only ): repo = MockRepository() - package = repo.package(canonicalize_name("futures"), Version.parse("3.2.0")) + package = repo.package("futures", Version.parse("3.2.0")) assert package.name == "futures" assert package.version.text == "3.2.0" @@ -290,7 +297,7 @@ def test_get_package_information_sets_appropriate_python_versions_if_wheels_only def test_get_package_from_both_py2_and_py3_specific_wheels() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("ipython"), Version.parse("5.7.0")) + package = repo.package("ipython", Version.parse("5.7.0")) assert package.name == "ipython" assert package.version.text == "5.7.0" @@ -328,9 +335,7 @@ def test_get_package_from_both_py2_and_py3_specific_wheels() -> None: def test_get_package_from_both_py2_and_py3_specific_wheels_python_constraint() -> None: repo = MockRepository() - package = repo.package( - canonicalize_name("poetry-test-py2-py3-metadata-merge"), Version.parse("0.1.0") - ) + package = repo.package("poetry-test-py2-py3-metadata-merge", Version.parse("0.1.0")) assert package.name == "poetry-test-py2-py3-metadata-merge" assert package.version.text == "0.1.0" @@ -340,7 +345,7 @@ def test_get_package_from_both_py2_and_py3_specific_wheels_python_constraint() - def test_get_package_with_dist_and_universal_py3_wheel() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("ipython"), Version.parse("7.5.0")) + package = repo.package("ipython", Version.parse("7.5.0")) assert package.name == "ipython" assert package.version.text == "7.5.0" @@ -368,7 +373,7 @@ def test_get_package_with_dist_and_universal_py3_wheel() -> None: def test_get_package_retrieves_non_sha256_hashes() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("ipython"), Version.parse("7.5.0")) + package = repo.package("ipython", Version.parse("7.5.0")) expected = [ { @@ -387,7 +392,7 @@ def test_get_package_retrieves_non_sha256_hashes() -> None: def test_get_package_retrieves_non_sha256_hashes_mismatching_known_hash() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("ipython"), Version.parse("5.7.0")) + package = repo.package("ipython", Version.parse("5.7.0")) expected = [ { @@ -410,7 +415,7 @@ def test_get_package_retrieves_non_sha256_hashes_mismatching_known_hash() -> Non def test_get_package_retrieves_packages_with_no_hashes() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("jupyter"), Version.parse("1.0.0")) + package = repo.package("jupyter", Version.parse("1.0.0")) assert [ { @@ -432,7 +437,7 @@ def test_package_yanked( ) -> None: repo = MockRepository() - package = repo.package(canonicalize_name(package_name), Version.parse(version)) + package = repo.package(package_name, Version.parse(version)) assert package.name == package_name assert str(package.version) == version @@ -446,11 +451,11 @@ def _get_page(self, endpoint: str) -> SimpleRepositoryPage | None: return super()._get_page(f"/{endpoint.strip('/')}_partial_yank/") repo = MockRepository() - package = repo.package(canonicalize_name("futures"), Version.parse("3.2.0")) + package = repo.package("futures", Version.parse("3.2.0")) assert len(package.files) == 2 repo = SpecialMockRepository() - package = repo.package(canonicalize_name("futures"), Version.parse("3.2.0")) + package = repo.package("futures", Version.parse("3.2.0")) assert len(package.files) == 1 assert package.files[0]["file"].endswith(".tar.gz") @@ -467,7 +472,7 @@ def test_find_links_for_package_yanked( ) -> None: repo = MockRepository() - package = repo.package(canonicalize_name(package_name), Version.parse(version)) + package = repo.package(package_name, Version.parse(version)) links = repo.find_links_for_package(package) assert len(links) == 1 diff --git a/tests/repositories/test_pool.py b/tests/repositories/test_pool.py index 3353115eac7..74aa6750549 100644 --- a/tests/repositories/test_pool.py +++ b/tests/repositories/test_pool.py @@ -2,7 +2,6 @@ import pytest -from packaging.utils import canonicalize_name from poetry.core.semver.version import Version from poetry.repositories import Pool @@ -16,7 +15,7 @@ def test_pool_raises_package_not_found_when_no_package_is_found() -> None: pool.add_repository(Repository("repo")) with pytest.raises(PackageNotFound): - pool.package(canonicalize_name("foo"), Version.parse("1.0.0")) + pool.package("foo", Version.parse("1.0.0")) def test_pool(): diff --git a/tests/repositories/test_pypi_repository.py b/tests/repositories/test_pypi_repository.py index 2e398de7272..0b2ab78987f 100644 --- a/tests/repositories/test_pypi_repository.py +++ b/tests/repositories/test_pypi_repository.py @@ -9,7 +9,6 @@ import pytest -from packaging.utils import canonicalize_name from poetry.core.packages.dependency import Dependency from poetry.core.semver.version import Version from requests.exceptions import TooManyRedirects @@ -117,7 +116,7 @@ def test_find_packages_yanked(constraint: str, expected: list[str]) -> None: def test_package() -> None: repo = MockRepository() - package = repo.package(canonicalize_name("requests"), Version.parse("2.18.4")) + package = repo.package("requests", Version.parse("2.18.4")) assert package.name == "requests" assert len(package.requires) == 9 @@ -158,7 +157,7 @@ def test_package_yanked( ) -> None: repo = MockRepository() - package = repo.package(package_name, version) + package = repo.package(package_name, Version.parse(version)) assert package.name == package_name assert str(package.version) == version @@ -166,6 +165,15 @@ def test_package_yanked( assert package.yanked_reason == yanked_reason +def test_package_not_canonicalized() -> None: + repo = MockRepository() + + package = repo.package("discord.py", Version.parse("2.0.0")) + + assert package.name == "discord-py" + assert package.pretty_name == "discord.py" + + @pytest.mark.parametrize( "package_name, version, yanked, yanked_reason", [ @@ -178,7 +186,7 @@ def test_find_links_for_package_yanked( ) -> None: repo = MockRepository() - package = repo.package(package_name, version) + package = repo.package(package_name, Version.parse(version)) links = repo.find_links_for_package(package) assert len(links) == 2 @@ -190,7 +198,7 @@ def test_find_links_for_package_yanked( def test_fallback_on_downloading_packages() -> None: repo = MockRepository(fallback=True) - package = repo.package(canonicalize_name("jupyter"), Version.parse("1.0.0")) + package = repo.package("jupyter", Version.parse("1.0.0")) assert package.name == "jupyter" assert len(package.requires) == 6 @@ -209,7 +217,7 @@ def test_fallback_on_downloading_packages() -> None: def test_fallback_inspects_sdist_first_if_no_matching_wheels_can_be_found() -> None: repo = MockRepository(fallback=True) - package = repo.package(canonicalize_name("isort"), Version.parse("4.3.4")) + package = repo.package("isort", Version.parse("4.3.4")) assert package.name == "isort" assert len(package.requires) == 1 @@ -222,7 +230,7 @@ def test_fallback_inspects_sdist_first_if_no_matching_wheels_can_be_found() -> N def test_fallback_can_read_setup_to_get_dependencies() -> None: repo = MockRepository(fallback=True) - package = repo.package(canonicalize_name("sqlalchemy"), Version.parse("1.2.12")) + package = repo.package("sqlalchemy", Version.parse("1.2.12")) assert package.name == "sqlalchemy" assert len(package.requires) == 9 @@ -244,7 +252,7 @@ def test_fallback_can_read_setup_to_get_dependencies() -> None: def test_pypi_repository_supports_reading_bz2_files() -> None: repo = MockRepository(fallback=True) - package = repo.package(canonicalize_name("twisted"), Version.parse("18.9.0")) + package = repo.package("twisted", Version.parse("18.9.0")) assert package.name == "twisted" assert len(package.requires) == 71 diff --git a/tests/repositories/test_repository.py b/tests/repositories/test_repository.py index 4073d92e53a..aad77894ca3 100644 --- a/tests/repositories/test_repository.py +++ b/tests/repositories/test_repository.py @@ -2,7 +2,6 @@ import pytest -from packaging.utils import canonicalize_name from poetry.core.packages.package import Package from poetry.core.semver.version import Version @@ -53,11 +52,18 @@ def test_package_yanked( yanked: bool, yanked_reason: str, ) -> None: - package = black_repository.package( - canonicalize_name(package_name), Version.parse(version) - ) + package = black_repository.package(package_name, Version.parse(version)) assert package.name == package_name assert str(package.version) == version assert package.yanked is yanked assert package.yanked_reason == yanked_reason + + +def test_package_pretty_name_is_kept() -> None: + pretty_name = "Not_canoni-calized.name" + repo = Repository("repo") + repo.add_package(Package(pretty_name, "1.0")) + package = repo.package(pretty_name, Version.parse("1.0")) + + assert package.pretty_name == pretty_name From 8f88b37c0c996db77ebb4dff6a351d3d74eba117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Thu, 25 Aug 2022 22:38:05 +0200 Subject: [PATCH 2/2] locker: always use base_pep_508_name (for any constraint base_pep_508_name is equal to pretty_name) --- src/poetry/packages/locker.py | 7 +------ tests/installation/fixtures/update-with-locked-extras.test | 2 +- tests/installation/fixtures/with-pypi-repository.test | 6 +++--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/poetry/packages/locker.py b/src/poetry/packages/locker.py index 71290689da4..5a71f8a40c1 100644 --- a/src/poetry/packages/locker.py +++ b/src/poetry/packages/locker.py @@ -410,12 +410,7 @@ def _dump_package(self, package: Package) -> dict[str, Any]: if package.extras: extras = {} for name, deps in sorted(package.extras.items()): - # TODO: This should use dep.to_pep_508() once this is fixed - # https://github.com/python-poetry/poetry-core/pull/102 - extras[name] = sorted( - dep.base_pep_508_name if not dep.constraint.is_any() else dep.name - for dep in deps - ) + extras[name] = sorted(dep.base_pep_508_name for dep in deps) data["extras"] = extras diff --git a/tests/installation/fixtures/update-with-locked-extras.test b/tests/installation/fixtures/update-with-locked-extras.test index 4872311c702..3609212e222 100644 --- a/tests/installation/fixtures/update-with-locked-extras.test +++ b/tests/installation/fixtures/update-with-locked-extras.test @@ -11,7 +11,7 @@ python-versions = "*" "C" = {version = "^1.0", markers = "python_version >= \"2.7\" and python_version < \"2.8\""} [package.extras] -foo = ["b"] +foo = ["B"] [[package]] name = "B" diff --git a/tests/installation/fixtures/with-pypi-repository.test b/tests/installation/fixtures/with-pypi-repository.test index ac57e43ec7b..1bde9b82750 100644 --- a/tests/installation/fixtures/with-pypi-repository.test +++ b/tests/installation/fixtures/with-pypi-repository.test @@ -7,9 +7,9 @@ optional = false python-versions = "*" [package.extras] -dev = ["coverage", "hypothesis", "pympler", "pytest", "six", "sphinx", "zope-interface", "zope-interface"] -docs = ["sphinx", "zope-interface"] -tests = ["coverage", "hypothesis", "pympler", "pytest", "six", "zope-interface"] +dev = ["coverage", "hypothesis", "pympler", "pytest", "six", "sphinx", "zope.interface", "zope.interface"] +docs = ["sphinx", "zope.interface"] +tests = ["coverage", "hypothesis", "pympler", "pytest", "six", "zope.interface"] [[package]] name = "colorama"