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
a3348f28
Commit
a3348f28
authored
Sep 29, 2020
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use utils.pip for executor installs
parent
6400f423
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
22 deletions
+26
-22
poetry/installation/executor.py
+6
-15
poetry/utils/pip.py
+18
-6
tests/installation/test_executor.py
+2
-1
No files found.
poetry/installation/executor.py
View file @
a3348f28
...
@@ -24,6 +24,7 @@ from poetry.utils.env import EnvCommandError
...
@@ -24,6 +24,7 @@ from poetry.utils.env import EnvCommandError
from
poetry.utils.helpers
import
safe_rmtree
from
poetry.utils.helpers
import
safe_rmtree
from
poetry.utils.pip
import
pip_editable_install
from
poetry.utils.pip
import
pip_editable_install
from
..utils.pip
import
pip_install
from
.authenticator
import
Authenticator
from
.authenticator
import
Authenticator
from
.chef
import
Chef
from
.chef
import
Chef
from
.chooser
import
Chooser
from
.chooser
import
Chooser
...
@@ -475,12 +476,9 @@ class Executor(object):
...
@@ -475,12 +476,9 @@ class Executor(object):
)
)
)
)
self
.
_write
(
operation
,
message
)
self
.
_write
(
operation
,
message
)
return
pip_install
(
args
=
[
"install"
,
"--no-deps"
,
str
(
archive
)]
str
(
archive
),
self
.
_env
,
upgrade
=
operation
.
job_type
==
"update"
if
operation
.
job_type
==
"update"
:
)
args
.
insert
(
2
,
"-U"
)
return
self
.
run_pip
(
*
args
)
def
_update
(
self
,
operation
:
Union
[
Install
,
Update
])
->
int
:
def
_update
(
self
,
operation
:
Union
[
Install
,
Update
])
->
int
:
return
self
.
_install
(
operation
)
return
self
.
_install
(
operation
)
...
@@ -538,8 +536,6 @@ class Executor(object):
...
@@ -538,8 +536,6 @@ class Executor(object):
else
:
else
:
req
=
os
.
path
.
realpath
(
package
.
source_url
)
req
=
os
.
path
.
realpath
(
package
.
source_url
)
args
=
[
"install"
,
"--no-deps"
,
"-U"
]
pyproject
=
PyProjectTOML
(
os
.
path
.
join
(
req
,
"pyproject.toml"
))
pyproject
=
PyProjectTOML
(
os
.
path
.
join
(
req
,
"pyproject.toml"
))
if
pyproject
.
is_poetry_project
():
if
pyproject
.
is_poetry_project
():
...
@@ -574,17 +570,12 @@ class Executor(object):
...
@@ -574,17 +570,12 @@ class Executor(object):
with
builder
.
setup_py
():
with
builder
.
setup_py
():
if
package
.
develop
:
if
package
.
develop
:
return
pip_editable_install
(
req
,
self
.
_env
)
return
pip_editable_install
(
req
,
self
.
_env
)
return
pip_install
(
req
,
self
.
_env
,
upgrade
=
True
)
args
.
append
(
req
)
return
self
.
run_pip
(
*
args
)
if
package
.
develop
:
if
package
.
develop
:
return
pip_editable_install
(
req
,
self
.
_env
)
return
pip_editable_install
(
req
,
self
.
_env
)
args
.
append
(
req
)
return
pip_install
(
req
,
self
.
_env
,
upgrade
=
True
)
return
self
.
run_pip
(
*
args
)
def
_install_git
(
self
,
operation
:
Union
[
Install
,
Update
])
->
int
:
def
_install_git
(
self
,
operation
:
Union
[
Install
,
Update
])
->
int
:
from
poetry.core.vcs
import
Git
from
poetry.core.vcs
import
Git
...
...
poetry/utils/pip.py
View file @
a3348f28
from
pathlib
import
Path
from
typing
import
Union
from
poetry.exceptions
import
PoetryException
from
poetry.exceptions
import
PoetryException
from
poetry.utils._compat
import
Path
from
poetry.utils.env
import
Env
from
poetry.utils.env
import
Env
from
poetry.utils.env
import
ephemeral_environment
from
poetry.utils.env
import
ephemeral_environment
def
pip_install
(
def
pip_install
(
path
,
environment
,
editable
=
False
,
deps
=
False
,
upgrade
=
False
path
:
Union
[
Path
,
str
],
):
# type: (Path, Env, bool, bool, bool) -> None
environment
:
Env
,
editable
:
bool
=
False
,
deps
:
bool
=
False
,
upgrade
:
bool
=
False
,
)
->
Union
[
int
,
str
]:
path
=
Path
(
path
)
if
isinstance
(
path
,
str
)
else
path
path
=
Path
(
path
)
if
isinstance
(
path
,
str
)
else
path
args
=
[
"
pip"
,
"
install"
,
"--prefix"
,
str
(
environment
.
path
)]
args
=
[
"install"
,
"--prefix"
,
str
(
environment
.
path
)]
if
upgrade
:
if
upgrade
:
args
.
append
(
"--upgrade"
)
args
.
append
(
"--upgrade"
)
...
@@ -26,13 +32,19 @@ def pip_install(
...
@@ -26,13 +32,19 @@ def pip_install(
args
.
append
(
str
(
path
))
args
.
append
(
str
(
path
))
if
path
.
is_file
()
and
path
.
suffix
==
".whl"
:
return
environment
.
run_pip
(
*
args
)
with
ephemeral_environment
(
with
ephemeral_environment
(
executable
=
environment
.
python
,
pip
=
True
,
setuptools
=
True
executable
=
environment
.
python
,
pip
=
True
,
setuptools
=
True
)
as
env
:
)
as
env
:
return
env
.
run
(
*
args
)
return
env
.
run
(
"pip"
,
*
args
,
)
def
pip_editable_install
(
directory
,
environment
):
# type: (Path, Env) -> None
def
pip_editable_install
(
directory
:
Path
,
environment
:
Env
)
->
Union
[
int
,
str
]:
return
pip_install
(
return
pip_install
(
path
=
directory
,
environment
=
environment
,
editable
=
True
,
deps
=
False
,
upgrade
=
True
path
=
directory
,
environment
=
environment
,
editable
=
True
,
deps
=
False
,
upgrade
=
True
)
)
tests/installation/test_executor.py
View file @
a3348f28
...
@@ -13,6 +13,7 @@ from cleo.io.buffered_io import BufferedIO
...
@@ -13,6 +13,7 @@ from cleo.io.buffered_io import BufferedIO
from
poetry.config.config
import
Config
from
poetry.config.config
import
Config
from
poetry.core.packages.package
import
Package
from
poetry.core.packages.package
import
Package
from
poetry.core.utils._compat
import
PY36
from
poetry.installation.executor
import
Executor
from
poetry.installation.executor
import
Executor
from
poetry.installation.operations
import
Install
from
poetry.installation.operations
import
Install
from
poetry.installation.operations
import
Uninstall
from
poetry.installation.operations
import
Uninstall
...
@@ -69,7 +70,7 @@ def test_execute_executes_a_batch_of_operations(
...
@@ -69,7 +70,7 @@ def test_execute_executes_a_batch_of_operations(
mocker
,
config
,
pool
,
io
,
tmp_dir
,
mock_file_downloads
,
env
mocker
,
config
,
pool
,
io
,
tmp_dir
,
mock_file_downloads
,
env
):
):
pip_editable_install
=
mocker
.
patch
(
pip_editable_install
=
mocker
.
patch
(
"poetry.installation.executor.pip_editable_install"
"poetry.installation.executor.pip_editable_install"
,
unsafe
=
not
PY36
)
)
config
=
Config
()
config
=
Config
()
...
...
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