-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around https://bugs.debian.org/962654 by reinstalling pip in the virutalenv before installing dependencies for pypy or pypy3. Work around pypa/pip#8653 by using a version of pip prior to 20.2 for pypy. FIXME: This may reinstall pip 0 or more times depending on the package dependencies (e.g. for pyproject.toml build requires, tox deps, package deps). No config option for post-create commands. May need to create a tox hook package to do this properly. Signed-off-by: Kevin Locke <[email protected]>
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
# This file is part of packagename <https://github.com/kevinoid/packagename> | ||
# Made available under CC0 1.0 Universal, see LICENSE.txt | ||
# Copyright 2019-2020 Kevin Locke <[email protected]> | ||
""" | ||
Script to reinstall pip before running `pip install`. | ||
Workaround for https://bugs.debian.org/962654 | ||
""" | ||
|
||
import os | ||
import sys | ||
|
||
# Must be invoked with pip package (optionally version-constrained) as first | ||
# argument, install options+packages as subsequent options. | ||
if len(sys.argv) < 3 or not sys.argv[1].startswith("pip"): | ||
sys.stderr.write( | ||
'Usage: ' + sys.argv[0] + ' <pip version> [options] <packages...>\n') | ||
sys.exit(1) | ||
|
||
# Workaround is only needed on Debian (and derivatives) | ||
if os.path.exists('/etc/debian_version'): | ||
pip_exit_code = os.spawnl( | ||
os.P_WAIT, | ||
sys.executable, | ||
sys.executable, | ||
'-m', | ||
'pip', | ||
'install', | ||
'--force', | ||
sys.argv[1]) | ||
if pip_exit_code != 0: | ||
sys.exit(pip_exit_code) | ||
|
||
os.execv( | ||
sys.executable, | ||
[sys.executable, '-m', 'pip', 'install'] + sys.argv[2:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters