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
032cfa98
Unverified
Commit
032cfa98
authored
Jun 14, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing uninstall operation after resolution
parent
d85c8125
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
3 deletions
+83
-3
poetry/installation/installer.py
+22
-3
tests/installation/test_installer.py
+61
-0
No files found.
poetry/installation/installer.py
View file @
032cfa98
...
...
@@ -187,13 +187,32 @@ class Installer:
):
# We resolve again by only using the lock file
pool
=
Pool
()
pool
.
add_repository
(
local_repo
)
# Making a new repo containing the packages
# newly resolved and the ones from the current lock file
locked_repository
=
self
.
_locker
.
locked_repository
(
True
)
repo
=
Repository
()
for
package
in
local_repo
.
packages
+
locked_repository
.
packages
:
if
not
repo
.
has_package
(
package
):
repo
.
add_package
(
package
)
pool
.
add_repository
(
repo
)
# We whitelist all packages to be sure
# that the latest ones are picked up
whitelist
=
[]
for
pkg
in
locked_repository
.
packages
:
whitelist
.
append
(
pkg
.
name
)
solver
=
Solver
(
self
.
_package
,
pool
,
self
.
_installed_repository
,
Repository
(),
NullIO
()
self
.
_package
,
pool
,
self
.
_installed_repository
,
locked_repository
,
NullIO
(),
)
ops
=
solver
.
solve
(
)
+
[
o
for
o
in
ops
if
o
.
job_type
==
"uninstall"
]
ops
=
solver
.
solve
(
use_latest
=
whitelist
)
# We need to filter operations so that packages
# not compatible with the current system,
...
...
tests/installation/test_installer.py
View file @
032cfa98
...
...
@@ -962,6 +962,67 @@ def test_run_install_duplicate_dependencies_different_constraints_with_lock(
assert
len
(
removals
)
==
0
def
test_run_update_uninstalls_after_removal_transient_dependency
(
installer
,
locker
,
repo
,
package
,
installed
):
locker
.
locked
(
True
)
locker
.
mock_lock_data
(
{
"package"
:
[
{
"name"
:
"A"
,
"version"
:
"1.0"
,
"category"
:
"main"
,
"optional"
:
False
,
"platform"
:
"*"
,
"python-versions"
:
"*"
,
"checksum"
:
[],
"dependencies"
:
{
"B"
:
{
"version"
:
"^1.0"
,
"python"
:
"<2.0"
}},
},
{
"name"
:
"B"
,
"version"
:
"1.0"
,
"category"
:
"dev"
,
"optional"
:
False
,
"platform"
:
"*"
,
"python-versions"
:
"*"
,
"checksum"
:
[],
},
],
"metadata"
:
{
"python-versions"
:
"*"
,
"platform"
:
"*"
,
"content-hash"
:
"123456789"
,
"hashes"
:
{
"A"
:
[],
"B"
:
[]},
},
}
)
package
.
add_dependency
(
"A"
)
package_a
=
get_package
(
"A"
,
"1.0"
)
package_a
.
add_dependency
(
"B"
,
{
"version"
:
"^1.0"
,
"python"
:
"<2.0"
})
package_b10
=
get_package
(
"B"
,
"1.0"
)
repo
.
add_package
(
package_a
)
repo
.
add_package
(
package_b10
)
installed
.
add_package
(
get_package
(
"A"
,
"1.0"
))
installed
.
add_package
(
get_package
(
"B"
,
"1.0"
))
installer
.
update
(
True
)
installer
.
run
()
print
(
locker
.
written_data
)
installs
=
installer
.
installer
.
installs
assert
len
(
installs
)
==
0
updates
=
installer
.
installer
.
updates
assert
len
(
updates
)
==
0
removals
=
installer
.
installer
.
removals
assert
len
(
removals
)
==
1
def
test_run_install_duplicate_dependencies_different_constraints_with_lock_update
(
installer
,
locker
,
repo
,
package
,
installed
):
...
...
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