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
cb14c70e
Commit
cb14c70e
authored
Mar 25, 2021
by
Arun Babu Neelicattu
Committed by
Steph Samson
Mar 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pip installer: fix installed script executable
parent
3c9ced2e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
poetry/utils/pip.py
+17
-4
tests/installation/test_executor.py
+1
-1
No files found.
poetry/utils/pip.py
View file @
cb14c70e
import
os
import
sys
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Union
from
typing
import
Union
from
poetry.exceptions
import
PoetryException
from
poetry.exceptions
import
PoetryException
from
poetry.utils.env
import
Env
from
poetry.utils.env
import
Env
from
poetry.utils.env
import
EnvCommandError
from
poetry.utils.env
import
ephemeral_environment
from
poetry.utils.env
import
ephemeral_environment
...
@@ -14,9 +18,13 @@ def pip_install(
...
@@ -14,9 +18,13 @@ def pip_install(
upgrade
:
bool
=
False
,
upgrade
:
bool
=
False
,
)
->
Union
[
int
,
str
]:
)
->
Union
[
int
,
str
]:
path
=
Path
(
path
)
if
isinstance
(
path
,
str
)
else
path
path
=
Path
(
path
)
if
isinstance
(
path
,
str
)
else
path
is_wheel
=
path
.
suffix
==
".whl"
args
=
[
"install"
,
"--prefix"
,
str
(
environment
.
path
)]
args
=
[
"install"
,
"--prefix"
,
str
(
environment
.
path
)]
if
not
is_wheel
:
args
.
insert
(
1
,
"--use-pep517"
)
if
upgrade
:
if
upgrade
:
args
.
append
(
"--upgrade"
)
args
.
append
(
"--upgrade"
)
...
@@ -32,16 +40,21 @@ def pip_install(
...
@@ -32,16 +40,21 @@ def pip_install(
args
.
append
(
str
(
path
))
args
.
append
(
str
(
path
))
if
path
.
is_file
()
and
path
.
suffix
==
".whl"
:
try
:
return
environment
.
run_pip
(
*
args
)
return
environment
.
run_pip
(
*
args
)
except
EnvCommandError
as
e
:
if
sys
.
version_info
<
(
3
,
7
)
and
not
is_wheel
:
# Under certain Python3.6 installs vendored pip wheel does not contain zip-safe
# pep517 lib. In this cases we create an isolated ephemeral virtual environment.
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
(
return
environment
.
run
(
"pip"
,
env
.
_bin
(
"pip"
)
,
*
args
,
*
args
,
env
=
{
**
os
.
environ
,
"PYTHONPATH"
:
str
(
env
.
purelib
)},
)
)
raise
PoetryException
(
f
"Failed to install {path.as_posix()}"
)
from
e
def
pip_editable_install
(
directory
:
Path
,
environment
:
Env
)
->
Union
[
int
,
str
]:
def
pip_editable_install
(
directory
:
Path
,
environment
:
Env
)
->
Union
[
int
,
str
]:
...
...
tests/installation/test_executor.py
View file @
cb14c70e
...
@@ -137,7 +137,7 @@ Package operations: 4 installs, 1 update, 1 removal
...
@@ -137,7 +137,7 @@ Package operations: 4 installs, 1 update, 1 removal
expected
=
set
(
expected
.
splitlines
())
expected
=
set
(
expected
.
splitlines
())
output
=
set
(
io
.
fetch_output
()
.
splitlines
())
output
=
set
(
io
.
fetch_output
()
.
splitlines
())
assert
expected
==
output
assert
expected
==
output
assert
4
==
len
(
env
.
executed
)
assert
5
==
len
(
env
.
executed
)
assert
0
==
return_code
assert
0
==
return_code
pip_editable_install
.
assert_called_once
()
pip_editable_install
.
assert_called_once
()
...
...
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