
painful, and not perfect, but at this point the output builds on a vivid system python2 (bddeb --python2) or python3. * remove use of cheetah by bddeb in favor of builtin renderer * add '--python2' flag to bddeb and knowledge of python 2 and python3 package names. * read-dependencies can now read test-requirements also. * differenciate from build-requirements and runtime requirements.
30 lines
813 B
Python
Executable File
30 lines
813 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import os
|
|
import re
|
|
import sys
|
|
|
|
if 'CLOUD_INIT_TOP_D' in os.environ:
|
|
topd = os.path.realpath(os.environ.get('CLOUD_INIT_TOP_D'))
|
|
else:
|
|
topd = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
|
|
|
for fname in ("setup.py", "requirements.txt"):
|
|
if not os.path.isfile(os.path.join(topd, fname)):
|
|
sys.stderr.write("Unable to locate '%s' file that should "
|
|
"exist in cloud-init root directory." % fname)
|
|
sys.exit(1)
|
|
|
|
if len(sys.argv) > 1:
|
|
reqfile = sys.argv[1]
|
|
else:
|
|
reqfile = "requirements.txt"
|
|
|
|
with open(os.path.join(topd, reqfile), "r") as fp:
|
|
for line in fp:
|
|
if not line.strip() or line.startswith("#"):
|
|
continue
|
|
sys.stdout.write(re.split("[>=.<]*", line)[0].strip() + "\n")
|
|
|
|
sys.exit(0)
|