def merge_requirements(tools_path, test_constraints, all_constraints): merged_requirements = merge_module.main( os.path.join(tools_path, 'dev_constraints.txt'), test_constraints ) with open(all_constraints, 'w') as fd: fd.write(merged_requirements)
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')] with open(constraints_path, 'w') as fd: fd.write(merge_module.main(*pinning_files))
def merge_requirements(tools_path, requirements, test_constraints, all_constraints): # Order of the files in the merge function matters. # Indeed version retained for a given package will be the last version # found when following all requirements in the given order. # Here is the order by increasing priority: # 1) The general development constraints (tools/dev_constraints.txt) # 2) The general tests constraints (oldest_requirements.txt or # certbot-auto's dependency-requirements.txt for the normal processing) # 3) The local requirement file, typically local-oldest-requirement in oldest tests files = [os.path.join(tools_path, 'dev_constraints.txt'), test_constraints] if requirements: files.append(requirements) merged_requirements = merge_module.main(*files) with open(all_constraints, 'w') as fd: fd.write(merged_requirements)
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]) # 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