bugfix for pypy

This commit is contained in:
Grzegorz Bokota
2020-03-02 15:01:02 +01:00
parent 6e41e729fe
commit 281caf3d2e
+9 -14
View File
@@ -188,25 +188,20 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
if test_command:
# set up a virtual environment to install and test from, to make sure
# there are no dependencies that were pulled in at build time.
shell(['pip', 'install', '"virtualenv<20"'], env=env)
shell(['pip', 'install', 'virtualenv'], env=env)
venv_dir = tempfile.mkdtemp()
shell(['python', '-m', 'virtualenv', venv_dir], env=env)
virtualenv_env = env.copy()
if os.path.exists(os.path.join(venv_dir, 'Scripts')):
virtualenv_env['PATH'] = os.pathsep.join([
os.path.join(venv_dir, 'Scripts'),
virtualenv_env['PATH'],
])
elif os.path.exists(os.path.join(venv_dir, 'bin')):
venv_script_path = os.path.join(venv_dir, 'Scripts')
if os.path.exists(os.path.join(venv_dir, 'bin')):
# pypy2.7 bugfix
virtualenv_env['PATH'] = os.pathsep.join([
os.path.join(venv_dir, 'bin'),
virtualenv_env['PATH'],
])
else:
print("Fail to create virtualenv", file=sys.stderr)
sys.exit(2)
venv_script_path = os.pathsep.join([venv_script_path, os.path.join(venv_dir, 'bin')])
virtualenv_env['PATH'] = os.pathsep.join([
venv_script_path,
virtualenv_env['PATH'],
])
virtualenv_env["__CIBW_VIRTUALENV_PATH__"] = venv_dir
# check that we are using the Python from the virtual environment