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
3bdc3972
Commit
3bdc3972
authored
Sep 06, 2022
by
Randy Döring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(env): remove duplicated implementations of get_pip_command()
parent
40780824
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
21 deletions
+2
-21
src/poetry/utils/env.py
+1
-20
tests/utils/test_env.py
+1
-1
No files found.
src/poetry/utils/env.py
View file @
3bdc3972
...
@@ -1393,7 +1393,7 @@ class Env:
...
@@ -1393,7 +1393,7 @@ class Env:
raise
NotImplementedError
()
raise
NotImplementedError
()
def
get_pip_command
(
self
,
embedded
:
bool
=
False
)
->
list
[
str
]:
def
get_pip_command
(
self
,
embedded
:
bool
=
False
)
->
list
[
str
]:
r
aise
NotImplementedError
()
r
eturn
[
self
.
python
,
self
.
pip_embedded
if
embedded
else
self
.
pip
]
def
get_supported_tags
(
self
)
->
list
[
Tag
]:
def
get_supported_tags
(
self
)
->
list
[
Tag
]:
raise
NotImplementedError
()
raise
NotImplementedError
()
...
@@ -1556,11 +1556,6 @@ class SystemEnv(Env):
...
@@ -1556,11 +1556,6 @@ class SystemEnv(Env):
def
get_python_implementation
(
self
)
->
str
:
def
get_python_implementation
(
self
)
->
str
:
return
platform
.
python_implementation
()
return
platform
.
python_implementation
()
def
get_pip_command
(
self
,
embedded
:
bool
=
False
)
->
list
[
str
]:
# If we're not in a venv, assume the interpreter we're running on
# has a pip and use that
return
[
sys
.
executable
,
self
.
pip_embedded
if
embedded
else
self
.
pip
]
def
get_paths
(
self
)
->
dict
[
str
,
str
]:
def
get_paths
(
self
)
->
dict
[
str
,
str
]:
# We can't use sysconfig.get_paths() because
# We can't use sysconfig.get_paths() because
# on some distributions it does not return the proper paths
# on some distributions it does not return the proper paths
...
@@ -1672,14 +1667,6 @@ class VirtualEnv(Env):
...
@@ -1672,14 +1667,6 @@ class VirtualEnv(Env):
implementation
:
str
=
self
.
marker_env
[
"platform_python_implementation"
]
implementation
:
str
=
self
.
marker_env
[
"platform_python_implementation"
]
return
implementation
return
implementation
def
get_pip_command
(
self
,
embedded
:
bool
=
False
)
->
list
[
str
]:
# We're in a virtualenv that is known to be sane,
# so assume that we have a functional pip
return
[
self
.
_bin
(
self
.
_executable
),
self
.
pip_embedded
if
embedded
else
self
.
pip
,
]
def
get_supported_tags
(
self
)
->
list
[
Tag
]:
def
get_supported_tags
(
self
)
->
list
[
Tag
]:
output
=
self
.
run_python_script
(
GET_SYS_TAGS
)
output
=
self
.
run_python_script
(
GET_SYS_TAGS
)
assert
isinstance
(
output
,
str
)
assert
isinstance
(
output
,
str
)
...
@@ -1858,12 +1845,6 @@ class NullEnv(SystemEnv):
...
@@ -1858,12 +1845,6 @@ class NullEnv(SystemEnv):
self
.
_execute
=
execute
self
.
_execute
=
execute
self
.
executed
:
list
[
list
[
str
]]
=
[]
self
.
executed
:
list
[
list
[
str
]]
=
[]
def
get_pip_command
(
self
,
embedded
:
bool
=
False
)
->
list
[
str
]:
return
[
self
.
_bin
(
self
.
_executable
),
self
.
pip_embedded
if
embedded
else
self
.
pip
,
]
def
_run
(
self
,
cmd
:
list
[
str
],
**
kwargs
:
Any
)
->
int
|
str
:
def
_run
(
self
,
cmd
:
list
[
str
],
**
kwargs
:
Any
)
->
int
|
str
:
self
.
executed
.
append
(
cmd
)
self
.
executed
.
append
(
cmd
)
...
...
tests/utils/test_env.py
View file @
3bdc3972
...
@@ -1392,7 +1392,7 @@ def test_build_environment_called_build_script_specified(
...
@@ -1392,7 +1392,7 @@ def test_build_environment_called_build_script_specified(
assert
env
==
ephemeral_env
assert
env
==
ephemeral_env
assert
env
.
executed
==
[
assert
env
.
executed
==
[
[
[
"python"
,
sys
.
executable
,
env
.
pip_embedded
,
env
.
pip_embedded
,
"install"
,
"install"
,
"--disable-pip-version-check"
,
"--disable-pip-version-check"
,
...
...
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