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
99b4da0c
Unverified
Commit
99b4da0c
authored
Oct 08, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of extras
parent
cc715ef8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
8 deletions
+61
-8
CHANGELOG.md
+1
-0
poetry/puzzle/provider.py
+1
-2
poetry/puzzle/solver.py
+10
-6
tests/console/commands/debug/test_resolve.py
+2
-0
tests/console/commands/test_add.py
+1
-0
tests/installation/fixtures/with-directory-dependency-poetry.test
+9
-0
tests/installation/test_installer.py
+1
-0
tests/puzzle/test_solver.py
+36
-0
No files found.
CHANGELOG.md
View file @
99b4da0c
...
...
@@ -18,6 +18,7 @@
-
Fixed a memory leak in the resolver.
-
Fixed a recursion error on duplicate dependencies with only different extras.
-
Fixed handling of extras.
## [0.11.5] - 2018-09-04
...
...
poetry/puzzle/provider.py
View file @
99b4da0c
...
...
@@ -383,8 +383,7 @@ class Provider:
dependencies
=
[
r
for
r
in
package
.
requires
if
r
.
is_activated
()
and
self
.
_package
.
python_constraint
.
allows_any
(
r
.
python_constraint
)
if
self
.
_package
.
python_constraint
.
allows_any
(
r
.
python_constraint
)
]
# Searching for duplicate dependencies
...
...
poetry/puzzle/solver.py
View file @
99b4da0c
...
...
@@ -160,12 +160,13 @@ class Solver:
category
,
optional
,
marker
,
depth
=
self
.
_get_tags_for_package
(
package
,
graph
)
depths
.
append
(
depth
)
package
.
category
=
category
package
.
optional
=
optional
package
.
marker
=
marker
depths
.
append
(
depth
)
return
packages
,
depths
def
_build_graph
(
...
...
@@ -194,6 +195,7 @@ class Solver:
return
graph
for
dependency
in
package
.
all_requires
:
is_activated
=
True
if
dependency
.
is_optional
():
if
not
package
.
is_root
()
and
(
not
previous_dep
or
not
previous_dep
.
extras
...
...
@@ -201,7 +203,7 @@ class Solver:
continue
is_activated
=
False
for
group
,
extras
in
package
.
extras
.
items
():
for
group
,
extra
_dep
s
in
package
.
extras
.
items
():
if
dep
:
extras
=
previous_dep
.
extras
elif
package
.
is_root
():
...
...
@@ -209,13 +211,12 @@ class Solver:
else
:
extras
=
[]
if
group
in
extras
:
if
group
in
extras
and
dependency
.
name
in
(
d
.
name
for
d
in
package
.
extras
[
group
]
):
is_activated
=
True
break
if
not
is_activated
:
continue
if
previous
and
previous
[
"name"
]
==
dependency
.
name
:
break
...
...
@@ -238,6 +239,9 @@ class Solver:
pkg
,
packages
,
graph
,
dependency
,
dep
or
dependency
)
if
not
is_activated
:
child_graph
[
"optional"
]
=
True
if
existing
:
existing
[
"marker"
]
=
existing
[
"marker"
]
.
union
(
child_graph
[
"marker"
]
...
...
tests/console/commands/debug/test_resolve.py
View file @
99b4da0c
...
...
@@ -60,6 +60,7 @@ cachy 0.2.0
def
test_debug_resolve_git_dependency
(
app
,
repo
):
repo
.
add_package
(
get_package
(
"pendulum"
,
"2.0.3"
))
repo
.
add_package
(
get_package
(
"cleo"
,
"0.6.5"
))
command
=
app
.
find
(
"debug:resolve"
)
tester
=
CommandTester
(
command
)
...
...
@@ -77,6 +78,7 @@ Resolving dependencies...
Resolution results:
- pendulum (2.0.3)
- cleo (0.6.5)
- demo (0.1.2)
"""
...
...
tests/console/commands/test_add.py
View file @
99b4da0c
...
...
@@ -104,6 +104,7 @@ def test_add_git_constraint(app, repo, installer):
tester
=
CommandTester
(
command
)
repo
.
add_package
(
get_package
(
"pendulum"
,
"1.4.4"
))
repo
.
add_package
(
get_package
(
"cleo"
,
"0.6.5"
))
tester
.
execute
(
[
...
...
tests/installation/fixtures/with-directory-dependency-poetry.test
View file @
99b4da0c
[[
package
]]
description
=
""
category
=
"main"
name
=
"cachy"
optional
=
true
python
-
versions
=
"*"
version
=
"0.2.0"
[[
package
]]
description
=
""
category
=
"main"
name
=
"pendulum"
optional
=
false
python
-
versions
=
"*"
...
...
@@ -27,5 +35,6 @@ content-hash = "123456789"
python
-
versions
=
"*"
[
metadata
.
hashes
]
cachy
=
[]
project
-
with
-
extras
=
[]
pendulum
=
[]
tests/installation/test_installer.py
View file @
99b4da0c
...
...
@@ -613,6 +613,7 @@ def test_run_installs_with_local_poetry_directory_and_extras(
package
.
add_dependency
(
"demo"
,
{
"path"
:
str
(
file_path
),
"extras"
:
[
"extras_a"
]})
repo
.
add_package
(
get_package
(
"pendulum"
,
"1.4.4"
))
repo
.
add_package
(
get_package
(
"cachy"
,
"0.2.0"
))
installer
.
run
()
...
...
tests/puzzle/test_solver.py
View file @
99b4da0c
...
...
@@ -913,6 +913,7 @@ def test_solver_can_resolve_git_dependencies(solver, repo, package):
ops
,
[
{
"job"
:
"install"
,
"package"
:
pendulum
},
{
"job"
:
"install"
,
"package"
:
cleo
},
{
"job"
:
"install"
,
"package"
:
get_package
(
"demo"
,
"0.1.2"
)},
],
)
...
...
@@ -1104,3 +1105,38 @@ def test_solver_does_not_raise_conflict_for_locked_conditional_dependencies(
{
"job"
:
"install"
,
"package"
:
package_b
},
],
)
def
test_solver_returns_extras_if_requested_in_dependencies_and_not_in_root_package
(
solver
,
repo
,
package
):
package
.
add_dependency
(
"A"
)
package
.
add_dependency
(
"B"
)
package
.
add_dependency
(
"C"
)
package_a
=
get_package
(
"A"
,
"1.0"
)
package_b
=
get_package
(
"B"
,
"1.0"
)
package_c
=
get_package
(
"C"
,
"1.0"
)
package_d
=
get_package
(
"D"
,
"1.0"
)
package_b
.
add_dependency
(
"C"
,
{
"version"
:
"^1.0"
,
"extras"
:
[
"foo"
]})
package_c
.
add_dependency
(
"D"
,
{
"version"
:
"^1.0"
,
"optional"
:
True
})
package_c
.
extras
=
{
"foo"
:
[
get_dependency
(
"D"
,
"^1.0"
)]}
repo
.
add_package
(
package_a
)
repo
.
add_package
(
package_b
)
repo
.
add_package
(
package_c
)
repo
.
add_package
(
package_d
)
ops
=
solver
.
solve
()
check_solver_result
(
ops
,
[
{
"job"
:
"install"
,
"package"
:
package_d
},
{
"job"
:
"install"
,
"package"
:
package_c
},
{
"job"
:
"install"
,
"package"
:
package_a
},
{
"job"
:
"install"
,
"package"
:
package_b
},
],
)
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