Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
5cacba89
Commit
5cacba89
authored
May 19, 2022
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make dependency cache compatible with core 1.1.0a7
This change is required to allow for subdirectories.
parent
e1af707a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
3 deletions
+15
-3
pyproject.toml
+1
-0
src/poetry/mixology/version_solver.py
+9
-1
src/poetry/puzzle/provider.py
+1
-0
tests/mixology/version_solver/test_dependency_cache.py
+4
-2
No files found.
pyproject.toml
View file @
5cacba89
...
...
@@ -130,6 +130,7 @@ ignore_errors = true
module
=
[
'poetry.installation.executor'
,
'poetry.repositories.installed_repository'
,
'poetry.mixology.version_solver'
,
]
warn_unused_ignores
=
false
...
...
src/poetry/mixology/version_solver.py
View file @
5cacba89
...
...
@@ -19,6 +19,7 @@ from poetry.mixology.result import SolverResult
from
poetry.mixology.set_relation
import
SetRelation
from
poetry.mixology.term
import
Term
from
poetry.packages
import
DependencyPackage
from
poetry.utils._compat
import
metadata
if
TYPE_CHECKING
:
...
...
@@ -44,7 +45,14 @@ class DependencyCache:
self
.
cache
:
dict
[
tuple
[
str
,
str
|
None
,
str
|
None
,
str
|
None
],
list
[
DependencyPackage
]
]
=
{}
self
.
search_for
=
functools
.
lru_cache
(
maxsize
=
128
)(
self
.
_search_for
)
# TODO: re-enable cache when poetry-core upgrade is completed
self
.
search_for
=
functools
.
lru_cache
(
maxsize
=
128
if
metadata
.
version
(
"poetry-core"
)
# type: ignore[no-untyped-call]
!=
"1.1.0a7"
else
0
)(
self
.
_search_for
)
def
_search_for
(
self
,
dependency
:
Dependency
)
->
list
[
DependencyPackage
]:
key
=
(
...
...
src/poetry/puzzle/provider.py
View file @
5cacba89
...
...
@@ -236,6 +236,7 @@ class Provider:
Basically, we clone the repository in a temporary directory
and get the information we need by checking out the specified reference.
"""
# TODO: remove explicit subdirectory check once poetry-core is updated
# we ensure subdirectory match here as workaround until poetry-core is updated
# to >1.1.0a7
if
(
...
...
tests/mixology/version_solver/test_dependency_cache.py
View file @
5cacba89
...
...
@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING
from
poetry.factory
import
Factory
from
poetry.mixology.version_solver
import
DependencyCache
from
tests.compat
import
is_poetry_core_1_1_0a7_compat
from
tests.mixology.helpers
import
add_to_repo
...
...
@@ -37,8 +38,9 @@ def test_solver_dependency_cache_respects_source_type(
packages_pypi
=
cache
.
search_for
(
dependency_pypi
)
packages_git
=
cache
.
search_for
(
dependency_git
)
assert
cache
.
search_for
.
cache_info
()
.
hits
==
2
assert
cache
.
search_for
.
cache_info
()
.
currsize
==
2
if
not
is_poetry_core_1_1_0a7_compat
:
assert
cache
.
search_for
.
cache_info
()
.
hits
==
2
assert
cache
.
search_for
.
cache_info
()
.
currsize
==
2
assert
len
(
packages_pypi
)
==
len
(
packages_git
)
==
1
assert
packages_pypi
!=
packages_git
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment