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
7403a4db
Unverified
Commit
7403a4db
authored
Jun 11, 2020
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "get-poetry.py fallback to standard executables (#1878) (#2426)"
This reverts commit
f8128221
.
parent
d037b594
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
48 deletions
+4
-48
README.md
+0
-7
get-poetry.py
+4
-41
No files found.
README.md
View file @
7403a4db
...
@@ -23,13 +23,6 @@ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poet
...
@@ -23,13 +23,6 @@ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poet
Alternatively, you can download the
`get-poetry.py`
file and execute it separately.
Alternatively, you can download the
`get-poetry.py`
file and execute it separately.
The setup script must be able to find one of following executables in your shell's path environment:
-
`python`
(which can be a py3 or py2 interpreter)
-
`python3`
-
`py.exe -3`
(Windows)
-
`py.exe -2`
(Windows)
If you want to install prerelease versions, you can do so by passing
`--preview`
to
`get-poetry.py`
:
If you want to install prerelease versions, you can do so by passing
`--preview`
to
`get-poetry.py`
:
```
bash
```
bash
...
...
get-poetry.py
View file @
7403a4db
...
@@ -197,7 +197,8 @@ POETRY_LIB = os.path.join(POETRY_HOME, "lib")
...
@@ -197,7 +197,8 @@ POETRY_LIB = os.path.join(POETRY_HOME, "lib")
POETRY_LIB_BACKUP
=
os
.
path
.
join
(
POETRY_HOME
,
"lib-backup"
)
POETRY_LIB_BACKUP
=
os
.
path
.
join
(
POETRY_HOME
,
"lib-backup"
)
BIN
=
"""# -*- coding: utf-8 -*-
BIN
=
"""#!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import glob
import sys
import sys
import os
import os
...
@@ -216,7 +217,7 @@ if __name__ == "__main__":
...
@@ -216,7 +217,7 @@ if __name__ == "__main__":
main()
main()
"""
"""
BAT
=
u
(
'@echo off
\r\n
{python_executable}
"{poetry_bin}"
%*
\r\n
'
)
BAT
=
u
(
'@echo off
\r\n
python
"{poetry_bin}"
%*
\r\n
'
)
PRE_MESSAGE
=
"""# Welcome to {poetry}!
PRE_MESSAGE
=
"""# Welcome to {poetry}!
...
@@ -588,61 +589,23 @@ class Installer:
...
@@ -588,61 +589,23 @@ class Installer:
finally
:
finally
:
gz
.
close
()
gz
.
close
()
def
_which_python
(
self
):
"""Decides which python executable we'll embed in the launcher script."""
allowed_executables
=
[
"python"
,
"python3"
]
if
WINDOWS
:
allowed_executables
+=
[
"py.exe -3"
,
"py.exe -2"
]
# \d in regex ensures we can convert to int later
version_matcher
=
re
.
compile
(
r"^Python (?P<major>\d+)\.(?P<minor>\d+)\..+$"
)
fallback
=
None
for
executable
in
allowed_executables
:
try
:
raw_version
=
subprocess
.
check_output
(
executable
+
" --version"
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
.
decode
(
"utf-8"
)
except
subprocess
.
CalledProcessError
:
continue
match
=
version_matcher
.
match
(
raw_version
.
strip
())
if
match
and
tuple
(
map
(
int
,
match
.
groups
()))
>=
(
3
,
0
):
# favor the first py3 executable we can find.
return
executable
if
fallback
is
None
:
# keep this one as the fallback; it was the first valid executable we found.
fallback
=
executable
if
fallback
is
None
:
raise
RuntimeError
(
"No python executable found in shell environment. Tried: "
+
str
(
allowed_executables
)
)
return
fallback
def
make_bin
(
self
):
def
make_bin
(
self
):
if
not
os
.
path
.
exists
(
POETRY_BIN
):
if
not
os
.
path
.
exists
(
POETRY_BIN
):
os
.
mkdir
(
POETRY_BIN
,
0
o755
)
os
.
mkdir
(
POETRY_BIN
,
0
o755
)
python_executable
=
self
.
_which_python
()
if
WINDOWS
:
if
WINDOWS
:
with
open
(
os
.
path
.
join
(
POETRY_BIN
,
"poetry.bat"
),
"w"
)
as
f
:
with
open
(
os
.
path
.
join
(
POETRY_BIN
,
"poetry.bat"
),
"w"
)
as
f
:
f
.
write
(
f
.
write
(
u
(
u
(
BAT
.
format
(
BAT
.
format
(
python_executable
=
python_executable
,
poetry_bin
=
os
.
path
.
join
(
POETRY_BIN
,
"poetry"
)
.
replace
(
poetry_bin
=
os
.
path
.
join
(
POETRY_BIN
,
"poetry"
)
.
replace
(
os
.
environ
[
"USERPROFILE"
],
"
%
USERPROFILE
%
"
os
.
environ
[
"USERPROFILE"
],
"
%
USERPROFILE
%
"
)
,
)
)
)
)
)
)
)
with
open
(
os
.
path
.
join
(
POETRY_BIN
,
"poetry"
),
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
os
.
path
.
join
(
POETRY_BIN
,
"poetry"
),
"w"
,
encoding
=
"utf-8"
)
as
f
:
if
not
WINDOWS
:
f
.
write
(
u
(
"#!/usr/bin/env {}
\n
"
.
format
(
python_executable
)))
f
.
write
(
u
(
BIN
))
f
.
write
(
u
(
BIN
))
if
not
WINDOWS
:
if
not
WINDOWS
:
...
...
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