mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
* Add tools/merge_requirements.py
* Revert "Fix oldest tests by pinning Google DNS deps (#5000)"
This reverts commit f68fba2be2.
* Add tools/oldest_constraints.txt
* Remove oldest constraints from tox.ini
* Rename dev constraints file
* Update tools/pip_install.sh
* Update install_and_test.sh
* Fix pip_install.sh
* Don't cat when you can cp
* Add ng-httpsclient to dev constraints for oldest tests
* Bump tested setuptools version
* Update dev_constraints comment
* Better document oldest dependencies
* test against oldest versions we say we require
* Update dev constraints
* Properly handle empty lines
* Update constraints gen in pip_install
* Remove duplicated zope.component
* Reduce pyasn1-modules dependency
* Remove blank line
* pin back google-api-python-client
* pin back uritemplate
* pin josepy for oldest tests
* Undo changes to install_and_test.sh
* Update install_and_test.sh description
* use split instead of partition
61 lines
1.5 KiB
Python
Executable file
61 lines
1.5 KiB
Python
Executable file
#!/usr/bin/env python
|
|
"""Merges multiple Python requirements files into one file.
|
|
|
|
Requirements files specified later take precedence over earlier ones. Only
|
|
simple SomeProject==1.2.3 format is currently supported.
|
|
|
|
"""
|
|
|
|
from __future__ import print_function
|
|
|
|
import sys
|
|
|
|
|
|
def read_file(file_path):
|
|
"""Reads in a Python requirements file.
|
|
|
|
:param str file_path: path to requirements file
|
|
|
|
:returns: mapping from a project to its pinned version
|
|
:rtype: dict
|
|
|
|
"""
|
|
d = {}
|
|
with open(file_path) as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
if line and not line.startswith('#'):
|
|
project, version = line.split('==')
|
|
if not version:
|
|
raise ValueError("Unexpected syntax '{0}'".format(line))
|
|
d[project] = version
|
|
return d
|
|
|
|
|
|
def print_requirements(requirements):
|
|
"""Prints requirements to stdout.
|
|
|
|
:param dict requirements: mapping from a project to its pinned version
|
|
|
|
"""
|
|
print('\n'.join('{0}=={1}'.format(k, v)
|
|
for k, v in sorted(requirements.items())))
|
|
|
|
|
|
def merge_requirements_files(*files):
|
|
"""Merges multiple requirements files together and prints the result.
|
|
|
|
Requirement files specified later in the list take precedence over earlier
|
|
files.
|
|
|
|
:param tuple files: paths to requirements files
|
|
|
|
"""
|
|
d = {}
|
|
for f in files:
|
|
d.update(read_file(f))
|
|
print_requirements(d)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
merge_requirements_files(*sys.argv[1:])
|