mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 14:54:24 -04:00
Use workaround to fix build requirements in build isolation, and renable build isolation
This commit is contained in:
parent
db2ffea351
commit
96cf1e7ea9
3 changed files with 17 additions and 20 deletions
|
|
@ -40,7 +40,6 @@ parts:
|
|||
certbot:
|
||||
plugin: python
|
||||
source: .
|
||||
constraints: [$SNAPCRAFT_PART_SRC/snap-constraints.txt]
|
||||
python-packages:
|
||||
- git+https://github.com/certbot/python-augeas.git@certbot-patched
|
||||
- ./acme
|
||||
|
|
@ -75,7 +74,7 @@ parts:
|
|||
build-packages: [gcc, libffi-dev, libssl-dev, git, libaugeas-dev, python3-dev]
|
||||
build-environment:
|
||||
- SNAPCRAFT_PYTHON_VENV_ARGS: --system-site-packages
|
||||
- PIP_NO_BUILD_ISOLATION: "no"
|
||||
- PIP_CONSTRAINT: $SNAPCRAFT_PART_SRC/snap-constraints.txt
|
||||
override-pull: |
|
||||
snapcraftctl pull
|
||||
cd $SNAPCRAFT_PART_SRC
|
||||
|
|
|
|||
|
|
@ -82,17 +82,18 @@ def merge_requirements(tools_path, requirements, test_constraints, all_constrain
|
|||
fd.write(merged_requirements)
|
||||
|
||||
|
||||
def call_with_print(command):
|
||||
def call_with_print(command, env=None):
|
||||
if not env:
|
||||
env = os.environ
|
||||
print(command)
|
||||
subprocess.check_call(command, shell=True)
|
||||
subprocess.check_call(command, shell=True, env=env)
|
||||
|
||||
|
||||
def pip_install_with_print(args_str, disable_build_isolation=True):
|
||||
command = ['"', sys.executable, '" -m pip install --disable-pip-version-check ']
|
||||
if disable_build_isolation:
|
||||
command.append('--no-build-isolation ')
|
||||
command.append(args_str)
|
||||
call_with_print(''.join(command))
|
||||
def pip_install_with_print(args_str, env=None):
|
||||
if not env:
|
||||
env = os.environ
|
||||
command = ['"', sys.executable, '" -m pip install --disable-pip-version-check ', args_str]
|
||||
call_with_print(''.join(command), env=env)
|
||||
|
||||
|
||||
def main(args):
|
||||
|
|
@ -113,20 +114,22 @@ def main(args):
|
|||
else:
|
||||
certbot_normal_processing(tools_path, test_constraints)
|
||||
|
||||
env = os.environ.copy()
|
||||
env["PIP_CONSTRAINT"] = all_constraints
|
||||
|
||||
merge_requirements(tools_path, requirements, test_constraints, all_constraints)
|
||||
if requirements: # This branch is executed during the oldest tests
|
||||
# First step, install the transitive dependencies of oldest requirements
|
||||
# in respect with oldest constraints.
|
||||
pip_install_with_print('--constraint "{0}" --requirement "{1}"'
|
||||
.format(all_constraints, requirements))
|
||||
pip_install_with_print('--requirement "{0}"'.format(requirements),
|
||||
env=env)
|
||||
# Second step, ensure that oldest requirements themselves are effectively
|
||||
# installed using --force-reinstall, and avoid corner cases like the one described
|
||||
# in https://github.com/certbot/certbot/issues/7014.
|
||||
pip_install_with_print('--force-reinstall --no-deps --requirement "{0}"'
|
||||
.format(requirements))
|
||||
|
||||
pip_install_with_print('--constraint "{0}" {1}'.format(
|
||||
all_constraints, ' '.join(args)))
|
||||
pip_install_with_print(' '.join(args), env=env)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -35,12 +35,7 @@ def main():
|
|||
with open(requirements_filepath, 'w') as f:
|
||||
f.write(REQUIREMENTS)
|
||||
pip_install_args = '--requirement ' + requirements_filepath
|
||||
# We don't disable build isolation because we may have an older
|
||||
# version of pip that doesn't support the flag disabling it. We
|
||||
# expect these packages to already have usable wheels available
|
||||
# anyway so no building should be required.
|
||||
pip_install.pip_install_with_print(pip_install_args,
|
||||
disable_build_isolation=False)
|
||||
pip_install.pip_install_with_print(pip_install_args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in a new issue