summaryrefslogtreecommitdiff
path: root/tools/read-dependencies
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2016-07-22 15:09:24 -0400
committerScott Moser <smoser@brickies.net>2016-08-03 16:00:52 -0400
commit72d6adcb2e4cb5911f7809b89835965d4bf04476 (patch)
tree64b33f605847b5b26f67e37882442ea0c3620552 /tools/read-dependencies
parenteed7fccdb9e59e5b2cc9e6d94af06f075c6ced67 (diff)
downloadvyos-cloud-init-72d6adcb2e4cb5911f7809b89835965d4bf04476.tar.gz
vyos-cloud-init-72d6adcb2e4cb5911f7809b89835965d4bf04476.zip
Update build tools to work with git
- Update HACKING.rst to include git instructions - update MANIFEST.in and .gitignore to ignore git-related things - replaced tarball generation scripts with git-based script - have the spec files correctly identify themselves as cheetah templates - make brpm work with git
Diffstat (limited to 'tools/read-dependencies')
-rwxr-xr-xtools/read-dependencies22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/read-dependencies b/tools/read-dependencies
index 6a6f3e12..9fc503eb 100755
--- a/tools/read-dependencies
+++ b/tools/read-dependencies
@@ -1,8 +1,13 @@
#!/usr/bin/env python
+# You might be tempted to rewrite this as a shell script, but you
+# would be surprised to discover that things like 'egrep' or 'sed' may
+# differ between Linux and *BSD.
+
import os
import re
import sys
+import subprocess
if 'CLOUD_INIT_TOP_D' in os.environ:
topd = os.path.realpath(os.environ.get('CLOUD_INIT_TOP_D'))
@@ -16,14 +21,21 @@ for fname in ("setup.py", "requirements.txt"):
sys.exit(1)
if len(sys.argv) > 1:
- reqfile = sys.argv[1]
+ reqfile = sys.argv[1]
else:
- reqfile = "requirements.txt"
-
+ reqfile = "requirements.txt"
+
with open(os.path.join(topd, reqfile), "r") as fp:
for line in fp:
- if not line.strip() or line.startswith("#"):
+ line = line.strip()
+ if not line or line.startswith("#"):
continue
- sys.stdout.write(re.split("[>=.<]*", line)[0].strip() + "\n")
+
+ # remove pip-style markers
+ dep = line.split(';')[0]
+
+ # remove version requirements
+ dep = re.split("[>=.<]*", dep)[0].strip()
+ print(dep)
sys.exit(0)