Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
d1bf0d2a
Commit
d1bf0d2a
authored
Jan 12, 2020
by
Jason R. Coombs
Committed by
GitHub
Jan 12, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1962 from pypa/debt/pip-version
Rely on tox-pip-version to upgrade pip
parents
70b3ec0b
6cb025ea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
25 deletions
+20
-25
tools/tox_pip.py
tools/tox_pip.py
+15
-22
tox.ini
tox.ini
+5
-3
No files found.
tools/tox_pip.py
View file @
d1bf0d2a
import
os
import
shutil
import
subprocess
import
sys
from
glob
import
glob
VIRTUAL_ENV
=
os
.
environ
[
'VIRTUAL_ENV'
]
TOX_PIP_DIR
=
os
.
path
.
join
(
VIRTUAL_ENV
,
'pip'
)
def
remove_setuptools
():
"""
Remove setuptools from the current environment.
"""
print
(
"Removing setuptools"
)
cmd
=
[
sys
.
executable
,
'-m'
,
'pip'
,
'uninstall'
,
'-y'
,
'setuptools'
]
# set cwd to something other than '.' to avoid detecting
# '.' as the installed package.
subprocess
.
check_call
(
cmd
,
cwd
=
'.tox'
)
def
pip
(
args
):
# First things first, get a recent (stable) version of pip.
if
not
os
.
path
.
exists
(
TOX_PIP_DIR
):
subprocess
.
check_call
([
sys
.
executable
,
'-m'
,
'pip'
,
'--disable-pip-version-check'
,
'install'
,
'-t'
,
TOX_PIP_DIR
,
'pip'
])
shutil
.
rmtree
(
glob
(
os
.
path
.
join
(
TOX_PIP_DIR
,
'pip-*.dist-info'
))[
0
])
# And use that version.
pypath
=
os
.
environ
.
get
(
'PYTHONPATH'
)
pypath
=
pypath
.
split
(
os
.
pathsep
)
if
pypath
is
not
None
else
[]
pypath
.
insert
(
0
,
TOX_PIP_DIR
)
os
.
environ
[
'PYTHONPATH'
]
=
os
.
pathsep
.
join
(
pypath
)
# Fix call for setuptools editable install.
for
n
,
a
in
enumerate
(
args
):
if
a
==
'.'
:
args
[
n
]
=
os
.
getcwd
()
subprocess
.
check_call
([
sys
.
executable
,
'-m'
,
'pip'
]
+
args
,
cwd
=
TOX_PIP_DIR
)
# When installing '.', remove setuptools
'.'
in
args
and
remove_setuptools
()
cmd
=
[
sys
.
executable
,
'-m'
,
'pip'
]
+
args
subprocess
.
check_call
(
cmd
)
if
__name__
==
'__main__'
:
...
...
tox.ini
View file @
d1bf0d2a
...
...
@@ -6,15 +6,17 @@
[tox]
envlist
=
python
minversion
=
3.2
requires
=
tox-pip-version
>=
0.0.6
[helpers]
# Wrapper for calls to pip that make sure the version being used is a
# up-to-date, and to prevent the current working directory from being
# added to `sys.path`.
# Custom pip behavior
pip
=
python {toxinidir}/tools/tox_pip.py
[testenv]
deps
=
-r{toxinidir}/tests/requirements.txt
pip_version
=
pip
install_command
=
{[helpers]pip} install {opts} {packages}
list_dependencies_command
=
{[helpers]pip} freeze --all
setenv
=
COVERAGE_FILE={toxworkdir}/.coverage.{envname}
...
...
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