mirror of
https://github.com/certbot/certbot.git
synced 2025-08-09 15:02:48 +03:00
Remove local-oldest-requirements files (#8863)
This is part of https://github.com/certbot/certbot/issues/8787. I got a +1 from our packagers at major distros in https://github.com/certbot/certbot/issues/8761. * remove local-oldest-requirements files * fix tests * fix some oldest tests * list packages on one line in tox.ini * add changelog entry
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# pip installs packages using pinned package versions. If CERTBOT_OLDEST is set
|
||||
# to 1, a combination of tools/oldest_constraints.txt,
|
||||
# tools/dev_constraints.txt, and local-oldest-requirements.txt contained in the
|
||||
# top level of the package's directory is used, otherwise,
|
||||
# tools/requirements.txt is used. If CERTBOT_OLDEST is set, this script must
|
||||
# be run with `-e <package-name>` and no other arguments.
|
||||
# to 1, a combination of tools/oldest_constraints.txt and
|
||||
# tools/dev_constraints.txt is used, otherwise, tools/requirements.txt is used.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
@@ -37,27 +34,13 @@ def find_tools_path():
|
||||
return os.path.dirname(readlink.main(__file__))
|
||||
|
||||
|
||||
def certbot_oldest_processing(tools_path, args, constraints_path):
|
||||
if args[0] != '-e' or len(args) != 2:
|
||||
raise ValueError('When CERTBOT_OLDEST is set, this script must be run '
|
||||
'with a single -e <path> argument.')
|
||||
# remove any extras such as [dev]
|
||||
pkg_dir = re.sub(r'\[\w+\]', '', args[1])
|
||||
def certbot_oldest_processing(tools_path, constraints_path):
|
||||
# The order of the files in this list matters as files specified later can
|
||||
# override the pinnings found in earlier files.
|
||||
pinning_files = [os.path.join(tools_path, 'dev_constraints.txt'),
|
||||
os.path.join(tools_path, 'oldest_constraints.txt')]
|
||||
requirements = os.path.join(pkg_dir, 'local-oldest-requirements.txt')
|
||||
# packages like acme don't have any local oldest requirements
|
||||
if os.path.isfile(requirements):
|
||||
# We add requirements to the end of the list so it can override
|
||||
# anything that it needs to.
|
||||
pinning_files.append(requirements)
|
||||
else:
|
||||
requirements = None
|
||||
with open(constraints_path, 'w') as fd:
|
||||
fd.write(merge_module.main(*pinning_files))
|
||||
return requirements
|
||||
|
||||
|
||||
def certbot_normal_processing(tools_path, constraints_path):
|
||||
@@ -91,27 +74,14 @@ def main(args):
|
||||
else:
|
||||
# Otherwise, we merge requirements to build the constraints and pin dependencies
|
||||
constraints_path = os.path.join(working_dir, 'constraints.txt')
|
||||
requirements = None
|
||||
if os.environ.get('CERTBOT_OLDEST') == '1':
|
||||
requirements = certbot_oldest_processing(tools_path, args, constraints_path)
|
||||
certbot_oldest_processing(tools_path, constraints_path)
|
||||
else:
|
||||
certbot_normal_processing(tools_path, constraints_path)
|
||||
|
||||
env = os.environ.copy()
|
||||
env["PIP_CONSTRAINT"] = constraints_path
|
||||
|
||||
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('--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))
|
||||
|
||||
print(' '.join(args))
|
||||
pip_install_with_print(' '.join(args), env=env)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user