From 10d24f4b52be45d9e837e88c567fe5d24c67befd Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Thu, 10 Sep 2020 14:12:26 +0200 Subject: [PATCH] Call pipstrap during pip_install --- tools/_venv_common.py | 2 +- tools/pip_install.py | 11 ++++++++--- windows-installer/construct.py | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/_venv_common.py b/tools/_venv_common.py index 2b3014cce..555df9e3c 100644 --- a/tools/_venv_common.py +++ b/tools/_venv_common.py @@ -200,7 +200,7 @@ def install_packages(venv_name, pip_args): """ # Using the python executable from venv, we ensure to execute following commands in this venv. py_venv = get_venv_python_path(venv_name) - subprocess_with_print([py_venv, os.path.abspath('letsencrypt-auto-source/pieces/pipstrap.py')]) + # We only use this value during pip install because: # 1) We're really only adding it for installing cryptography, which happens here, and # 2) There are issues with calling it along with VIRTUALENV_NO_DOWNLOAD, which applies at the diff --git a/tools/pip_install.py b/tools/pip_install.py index 0a3961384..7745a7f8b 100755 --- a/tools/pip_install.py +++ b/tools/pip_install.py @@ -70,21 +70,26 @@ def merge_requirements(tools_path, requirements, test_constraints, all_constrain fd.write(merged_requirements) -def call_with_print(command): +def call_with_print(command, shell=False): print(command) - subprocess.check_call(command, shell=True) + subprocess.check_call(command, shell=shell) def pip_install_with_print(args_str): command = '"{0}" -m pip install --disable-pip-version-check {1}'.format(sys.executable, args_str) - call_with_print(command) + call_with_print(command, shell=True) def main(args): tools_path = find_tools_path() working_dir = tempfile.mkdtemp() + # Pin the build environment + repo_path = os.path.dirname(tools_path) + call_with_print([sys.executable, os.path.normpath( + os.path.join(repo_path, 'letsencrypt-auto-source/pieces/pipstrap.py'))]) + if os.environ.get('TRAVIS'): # When this script is executed on Travis, the following print will make the log # be folded until the end command is printed (see finally section). diff --git a/windows-installer/construct.py b/windows-installer/construct.py index ee7420ed7..225a74a4f 100644 --- a/windows-installer/construct.py +++ b/windows-installer/construct.py @@ -54,7 +54,6 @@ def _compile_wheels(repo_path, build_path, venv_python): def _prepare_build_tools(venv_path, venv_python, repo_path): print('Prepare build tools') subprocess.check_call([sys.executable, '-m', 'venv', venv_path]) - subprocess.check_call([venv_python, os.path.join(repo_path, 'letsencrypt-auto-source', 'pieces', 'pipstrap.py')]) subprocess.check_call([venv_python, os.path.join(repo_path, 'tools', 'pip_install.py'), 'pynsist']) subprocess.check_call(['choco', 'upgrade', '--allow-downgrade', '-y', 'nsis', '--version', NSIS_VERSION])