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
2c2b3935
Unverified
Commit
2c2b3935
authored
Jun 08, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix package whitelisting on update
parent
a9dcf354
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
9 deletions
+81
-9
poetry/installation/installer.py
+8
-9
tests/installation/test_installer.py
+73
-0
No files found.
poetry/installation/installer.py
View file @
2c2b3935
...
...
@@ -48,7 +48,7 @@ class Installer:
self
.
_develop
=
[]
self
.
_execute_operations
=
True
self
.
_whitelist
=
{}
self
.
_whitelist
=
[]
self
.
_extras
=
[]
...
...
@@ -132,16 +132,15 @@ class Installer:
def
_do_install
(
self
,
local_repo
):
locked_repository
=
Repository
()
if
self
.
_update
:
if
self
.
_locker
.
is_locked
()
and
self
.
_whitelist
:
# If we update with a lock file present and
# we have whitelisted packages (the ones we want to update)
# we get the lock file packages to only update
# what is strictly needed.
#
# Otherwise, the lock file information is irrelevant
# since we want to update everything.
if
self
.
_locker
.
is_locked
():
locked_repository
=
self
.
_locker
.
locked_repository
(
True
)
# If no packages have been whitelisted (The ones we want to update),
# we whitelist every package in the lock file.
if
not
self
.
_whitelist
:
for
pkg
in
locked_repository
.
packages
:
self
.
_whitelist
.
append
(
pkg
.
name
)
# Checking extras
for
extra
in
self
.
_extras
:
if
extra
not
in
self
.
_package
.
extras
:
...
...
tests/installation/test_installer.py
View file @
2c2b3935
...
...
@@ -161,6 +161,79 @@ def test_run_with_dependencies(installer, locker, repo, package):
assert
locker
.
written_data
==
expected
def
test_run_update_after_removing_dependencies
(
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"
:
[],
},
{
"name"
:
"B"
,
"version"
:
"1.1"
,
"category"
:
"main"
,
"optional"
:
False
,
"platform"
:
"*"
,
"python-versions"
:
"*"
,
"checksum"
:
[],
},
{
"name"
:
"C"
,
"version"
:
"1.2"
,
"category"
:
"main"
,
"optional"
:
False
,
"platform"
:
"*"
,
"python-versions"
:
"*"
,
"checksum"
:
[],
},
],
"metadata"
:
{
"python-versions"
:
"*"
,
"platform"
:
"*"
,
"content-hash"
:
"123456789"
,
"hashes"
:
{
"A"
:
[],
"B"
:
[],
"C"
:
[]},
},
}
)
package_a
=
get_package
(
"A"
,
"1.0"
)
package_b
=
get_package
(
"B"
,
"1.1"
)
package_c
=
get_package
(
"C"
,
"1.2"
)
repo
.
add_package
(
package_a
)
repo
.
add_package
(
package_b
)
repo
.
add_package
(
package_c
)
installed
.
add_package
(
package_a
)
installed
.
add_package
(
package_b
)
installed
.
add_package
(
package_c
)
package
.
add_dependency
(
"A"
,
"~1.0"
)
package
.
add_dependency
(
"B"
,
"~1.1"
)
installer
.
update
(
True
)
installer
.
run
()
expected
=
fixture
(
"with-dependencies"
)
assert
locker
.
written_data
==
expected
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_whitelist_add
(
installer
,
locker
,
repo
,
package
):
locker
.
locked
(
True
)
locker
.
mock_lock_data
(
...
...
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