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
25ecf42f
Commit
25ecf42f
authored
Sep 19, 2020
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sonnet: fix incorrect environment handling
parent
4d47e54f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
28 deletions
+14
-28
make-nix-release.sh
+1
-1
sonnet
+13
-27
No files found.
make-nix-release.sh
View file @
25ecf42f
...
...
@@ -19,6 +19,6 @@ else
POETRY
=
"
$PYTHON
-m poetry"
fi
$POETRY
config virtualenvs.
create
fals
e
$POETRY
config virtualenvs.
in-project
tru
e
$POETRY
install
--no-dev
$POETRY
run python sonnet make release
${
RUNTIMES
[@]
}
sonnet
View file @
25ecf42f
...
...
@@ -55,10 +55,7 @@ class MakeReleaseCommand(Command):
from
poetry
.
repositories
.
pool
import
Pool
from
poetry
.
repositories
.
repository
import
Repository
from
poetry
.
utils
.
_compat
import
Path
from
poetry
.
utils
.
_compat
import
decode
from
poetry
.
utils
.
_compat
import
encode
from
poetry
.
utils
.
_compat
import
subprocess
from
poetry
.
utils
.
env
import
GET_BASE_PREFIX
from
poetry
.
utils
.
env
import
EnvManager
from
poetry
.
utils
.
env
import
VirtualEnv
from
poetry
.
utils
.
helpers
import
temporary_directory
...
...
@@ -100,17 +97,12 @@ class MakeReleaseCommand(Command):
version
)
)
prefix
=
decode
(
subprocess
.
run
(
[
python
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
input
=
encode
(
GET_BASE_PREFIX
),
check
=
True
,
shell
=
WINDOWS
,
).
stdout
)
env
=
VirtualEnv
(
Path
(
prefix
.
strip
()),
base
=
Path
(
prefix
.
strip
()))
with
temporary_directory
()
as
tmp_venv_dir
:
venv_dir
=
Path
(
tmp_venv_dir
)
/
".venv"
EnvManager
.
build_venv
(
venv_dir
.
as_posix
(),
executable
=
python
)
env
=
VirtualEnv
(
venv_dir
,
venv_dir
)
solver
=
Solver
(
package
,
pool
,
Repository
(),
Repository
(),
self
.
io
)
with
solver
.
use_environment
(
env
):
ops
=
solver
.
solve
()
...
...
@@ -118,14 +110,13 @@ class MakeReleaseCommand(Command):
if
not
env
.
is_valid_for_marker
(
op
.
package
.
marker
):
op
.
skip
(
"Not needed for the current environment"
)
vendor_dir
=
Path
(
self
.
vendorize_for_python
(
python
,
env
,
[
op
.
package
for
op
in
ops
if
not
op
.
skipped
],
poetry_dir
,
version
,
)
vendor_dir
=
Path
(
os
.
path
.
join
(
poetry_dir
,
"_vendor"
,
"py{}"
.
format
(
python
))
)
created_files
+=
[
p
.
relative_to
(
Path
(
tmp_dir
))
...
...
@@ -227,7 +218,7 @@ class MakeReleaseCommand(Command):
except
subprocess
.
CalledProcessError
:
raise
RuntimeError
(
"Python {} is not available"
.
format
(
version
))
def
vendorize_for_python
(
self
,
python
,
packages
,
dest
,
python_version
):
def
vendorize_for_python
(
self
,
env
,
packages
,
dest
,
python_version
):
vendor_dir
=
os
.
path
.
join
(
dest
,
"_vendor"
,
"py{}"
.
format
(
python_version
))
bar
=
self
.
progress_bar
(
max
=
len
(
packages
))
...
...
@@ -239,19 +230,12 @@ class MakeReleaseCommand(Command):
)
bar
.
start
()
for
package
in
packages
:
subprocess
.
check_output
(
[
python
,
"-m"
,
"pip"
,
env
.
run_pip
(
"install"
,
"{}=={}"
.
format
(
package
.
name
,
package
.
version
),
"--no-deps"
,
"--target"
,
vendor_dir
,
],
stderr
=
subprocess
.
STDOUT
,
shell
=
WINDOWS
,
)
bar
.
advance
()
...
...
@@ -259,6 +243,8 @@ class MakeReleaseCommand(Command):
self
.
line
(
""
)
return
vendor_dir
class
MakeCommand
(
Command
):
"""
...
...
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