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
c8945eb1
Commit
c8945eb1
authored
Jan 15, 2023
by
Randy Döring
Committed by
Bjorn Neergaard
Feb 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
installer: deprecate old installer (setting `experimental.new-installer` to false)
parent
b304b0d5
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
45 deletions
+53
-45
src/poetry/console/application.py
+4
-1
src/poetry/console/commands/install.py
+4
-3
src/poetry/console/commands/lock.py
+4
-3
src/poetry/console/commands/update.py
+4
-3
src/poetry/installation/installer.py
+19
-1
src/poetry/utils/env.py
+11
-11
tests/console/commands/test_add.py
+2
-1
tests/console/conftest.py
+0
-1
tests/installation/test_installer.py
+0
-21
tests/installation/test_installer_old.py
+5
-0
tests/repositories/fixtures/pypi.org/dists/importlib_metadata-1.7.0-py2.py3-none-any.whl
+0
-0
tests/repositories/fixtures/pypi.org/dists/zipp-3.5.0-py3-none-any.whl
+0
-0
No files found.
src/poetry/console/application.py
View file @
c8945eb1
...
...
@@ -335,7 +335,10 @@ class Application(BaseApplication):
poetry
.
config
,
disable_cache
=
poetry
.
disable_cache
,
)
installer
.
use_executor
(
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
))
use_executor
=
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
if
not
use_executor
:
# only set if false because the method is deprecated
installer
.
use_executor
(
False
)
command
.
set_installer
(
installer
)
def
_load_plugins
(
self
,
io
:
IO
|
None
=
None
)
->
None
:
...
...
src/poetry/console/commands/install.py
View file @
c8945eb1
...
...
@@ -95,9 +95,10 @@ dependencies and not including the current project, run the command with the
from
poetry.masonry.builders.editable
import
EditableBuilder
self
.
installer
.
use_executor
(
self
.
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
)
use_executor
=
self
.
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
if
not
use_executor
:
# only set if false because the method is deprecated
self
.
installer
.
use_executor
(
False
)
if
self
.
option
(
"extras"
)
and
self
.
option
(
"all-extras"
):
self
.
line_error
(
...
...
src/poetry/console/commands/lock.py
View file @
c8945eb1
...
...
@@ -35,9 +35,10 @@ file.
loggers
=
[
"poetry.repositories.pypi_repository"
]
def
handle
(
self
)
->
int
:
self
.
installer
.
use_executor
(
self
.
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
)
use_executor
=
self
.
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
if
not
use_executor
:
# only set if false because the method is deprecated
self
.
installer
.
use_executor
(
False
)
if
self
.
option
(
"check"
):
if
self
.
poetry
.
locker
.
is_locked
()
and
self
.
poetry
.
locker
.
is_fresh
():
...
...
src/poetry/console/commands/update.py
View file @
c8945eb1
...
...
@@ -41,9 +41,10 @@ class UpdateCommand(InstallerCommand):
def
handle
(
self
)
->
int
:
packages
=
self
.
argument
(
"packages"
)
self
.
installer
.
use_executor
(
self
.
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
)
use_executor
=
self
.
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
if
not
use_executor
:
# only set if false because the method is deprecated
self
.
installer
.
use_executor
(
False
)
if
packages
:
self
.
installer
.
whitelist
({
name
:
"*"
for
name
in
packages
})
...
...
src/poetry/installation/installer.py
View file @
c8945eb1
from
__future__
import
annotations
import
warnings
from
typing
import
TYPE_CHECKING
from
cleo.io.null_io
import
NullIO
...
...
@@ -71,7 +73,7 @@ class Installer:
)
self
.
_executor
=
executor
self
.
_use_executor
=
Fals
e
self
.
_use_executor
=
Tru
e
self
.
_installer
=
self
.
_get_installer
()
if
installed
is
None
:
...
...
@@ -180,6 +182,14 @@ class Installer:
return
self
def
use_executor
(
self
,
use_executor
:
bool
=
True
)
->
Installer
:
warnings
.
warn
(
(
"Calling use_executor() is deprecated since it's true by default now"
" and deactivating it will be removed in a future release."
),
DeprecationWarning
,
stacklevel
=
2
,
)
self
.
_use_executor
=
use_executor
return
self
...
...
@@ -366,6 +376,14 @@ class Installer:
if
self
.
_use_executor
:
return
self
.
_executor
.
execute
(
operations
)
self
.
_io
.
write_error
(
"<warning>"
"Setting `experimental.new-installer` to false is deprecated and"
" slated for removal in an upcoming minor release.
\n
"
"(Despite of the setting's name the new installer is not experimental!)"
"</warning>"
)
if
not
operations
and
(
self
.
_execute_operations
or
self
.
_dry_run
):
self
.
_io
.
write_line
(
"No dependencies to install or update"
)
...
...
src/poetry/utils/env.py
View file @
c8945eb1
...
...
@@ -1917,6 +1917,17 @@ class NullEnv(SystemEnv):
self
.
_execute
=
execute
self
.
executed
:
list
[
list
[
str
]]
=
[]
@property
def
paths
(
self
)
->
dict
[
str
,
str
]:
if
self
.
_paths
is
None
:
self
.
_paths
=
self
.
get_paths
()
self
.
_paths
[
"platlib"
]
=
str
(
self
.
_path
/
"platlib"
)
self
.
_paths
[
"purelib"
]
=
str
(
self
.
_path
/
"purelib"
)
self
.
_paths
[
"scripts"
]
=
str
(
self
.
_path
/
"scripts"
)
self
.
_paths
[
"data"
]
=
str
(
self
.
_path
/
"data"
)
return
self
.
_paths
def
_run
(
self
,
cmd
:
list
[
str
],
**
kwargs
:
Any
)
->
int
|
str
:
self
.
executed
.
append
(
cmd
)
...
...
@@ -2044,17 +2055,6 @@ class MockEnv(NullEnv):
return
self
.
_sys_path
@property
def
paths
(
self
)
->
dict
[
str
,
str
]:
if
self
.
_paths
is
None
:
self
.
_paths
=
self
.
get_paths
()
self
.
_paths
[
"platlib"
]
=
str
(
self
.
_path
/
"platlib"
)
self
.
_paths
[
"purelib"
]
=
str
(
self
.
_path
/
"purelib"
)
self
.
_paths
[
"scripts"
]
=
str
(
self
.
_path
/
"scripts"
)
self
.
_paths
[
"data"
]
=
str
(
self
.
_path
/
"data"
)
return
self
.
_paths
def
get_marker_env
(
self
)
->
dict
[
str
,
Any
]:
if
self
.
_mock_marker_env
is
not
None
:
return
self
.
_mock_marker_env
...
...
tests/console/commands/test_add.py
View file @
c8945eb1
...
...
@@ -50,7 +50,8 @@ def tester(command_tester_factory: CommandTesterFactory) -> CommandTester:
@pytest.fixture
()
def
old_tester
(
tester
:
CommandTester
)
->
CommandTester
:
tester
.
command
.
installer
.
use_executor
(
False
)
with
pytest
.
warns
(
DeprecationWarning
):
tester
.
command
.
installer
.
use_executor
(
False
)
return
tester
...
...
tests/console/conftest.py
View file @
c8945eb1
...
...
@@ -166,7 +166,6 @@ def command_tester_factory(
executor
=
executor
or
TestExecutor
(
env
,
poetry
.
pool
,
poetry
.
config
,
tester
.
io
),
)
installer
.
use_executor
(
True
)
command
.
set_installer
(
installer
)
return
tester
...
...
tests/installation/test_installer.py
View file @
c8945eb1
...
...
@@ -197,8 +197,6 @@ def installer(
installed
=
installed
,
executor
=
Executor
(
env
,
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
(
True
)
return
installer
...
...
@@ -1961,8 +1959,6 @@ def test_installer_required_extras_should_not_be_removed_when_updating_single_de
installed
=
installed
,
executor
=
Executor
(
env
,
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
()
installer
.
update
(
True
)
installer
.
whitelist
([
"D"
])
installer
.
run
()
...
...
@@ -1996,7 +1992,6 @@ def test_installer_required_extras_should_not_be_removed_when_updating_single_de
installed
=
installed
,
executor
=
Executor
(
env
,
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
()
package
.
add_dependency
(
Factory
.
create_dependency
(
"poetry"
,
{
"version"
:
"^0.12.0"
}))
...
...
@@ -2025,8 +2020,6 @@ def test_installer_required_extras_should_not_be_removed_when_updating_single_de
installed
=
installed
,
executor
=
Executor
(
env
,
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
()
installer
.
update
(
True
)
installer
.
whitelist
([
"pytest"
])
installer
.
run
()
...
...
@@ -2057,8 +2050,6 @@ def test_installer_required_extras_should_be_installed(
installed
=
installed
,
executor
=
Executor
(
env
,
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
()
package
.
add_dependency
(
Factory
.
create_dependency
(
"cachecontrol"
,
{
"version"
:
"^0.12.5"
,
"extras"
:
[
"filecache"
]}
...
...
@@ -2085,8 +2076,6 @@ def test_installer_required_extras_should_be_installed(
installed
=
installed
,
executor
=
Executor
(
env
,
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
()
installer
.
update
(
True
)
installer
.
run
()
...
...
@@ -2200,8 +2189,6 @@ def test_installer_can_install_dependencies_from_forced_source(
installed
=
installed
,
executor
=
Executor
(
env
,
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
()
installer
.
update
(
True
)
installer
.
run
()
...
...
@@ -2267,7 +2254,6 @@ def test_run_installs_with_same_version_url_files(
NullIO
(),
),
)
installer
.
use_executor
(
True
)
installer
.
run
()
expected
=
fixture
(
"with-same-version-url-dependencies"
)
...
...
@@ -2332,8 +2318,6 @@ def test_installer_can_handle_old_lock_files(
installed
=
installed
,
executor
=
Executor
(
MockEnv
(),
pool
,
config
,
NullIO
()),
)
installer
.
use_executor
()
installer
.
run
()
assert
installer
.
executor
.
installations_count
==
6
...
...
@@ -2353,8 +2337,6 @@ def test_installer_can_handle_old_lock_files(
NullIO
(),
),
)
installer
.
use_executor
()
installer
.
run
()
# funcsigs will be added
...
...
@@ -2375,8 +2357,6 @@ def test_installer_can_handle_old_lock_files(
NullIO
(),
),
)
installer
.
use_executor
()
installer
.
run
()
# colorama will be added
...
...
@@ -2640,7 +2620,6 @@ def test_installer_distinguishes_locked_packages_by_source(
NullIO
(),
),
)
installer
.
use_executor
(
True
)
installer
.
run
()
# Results of installation are consistent with the platform requirements.
...
...
tests/installation/test_installer_old.py
View file @
c8945eb1
...
...
@@ -4,6 +4,7 @@ import itertools
from
pathlib
import
Path
from
typing
import
TYPE_CHECKING
from
typing
import
Any
import
pytest
...
...
@@ -40,6 +41,10 @@ RESERVED_PACKAGES = ("pip", "setuptools", "wheel")
class
Installer
(
BaseInstaller
):
def
__init__
(
self
,
*
args
:
Any
,
**
kwargs
:
Any
)
->
None
:
super
()
.
__init__
(
*
args
,
**
kwargs
)
self
.
_use_executor
=
False
def
_get_installer
(
self
)
->
NoopInstaller
:
return
NoopInstaller
()
...
...
tests/repositories/fixtures/pypi.org/dists/importlib_metadata-1.7.0-py2.py3-none-any.whl
0 → 100644
View file @
c8945eb1
File added
tests/repositories/fixtures/pypi.org/dists/zipp-3.5.0-py3-none-any.whl
0 → 100644
View file @
c8945eb1
File added
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