diff options
author | 2010-08-02 21:04:15 -0300 | |
---|---|---|
committer | 2010-08-02 21:04:15 -0300 | |
commit | aa3c7b9eb3aead9b2bf25d42b0adbeb4af9fe8e8 (patch) | |
tree | 7ea76d79652e825dc23749eba303b3d42b0bc0d7 | |
parent | added support to metadata.xml (diff) | |
download | g-octave-aa3c7b9eb3aead9b2bf25d42b0adbeb4af9fe8e8.tar.gz g-octave-aa3c7b9eb3aead9b2bf25d42b0adbeb4af9fe8e8.tar.bz2 g-octave-aa3c7b9eb3aead9b2bf25d42b0adbeb4af9fe8e8.zip |
added licenses support to the script requirements.py
-rwxr-xr-x | scripts/requirements.py | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/scripts/requirements.py b/scripts/requirements.py index 45d446f..2f8307e 100755 --- a/scripts/requirements.py +++ b/scripts/requirements.py @@ -45,6 +45,9 @@ def main(argv): # identifier => list of dependencies dependencies = dict() + + # list of licenses + licenses = list() for pkg in desc_tree.packages(): try: @@ -52,7 +55,10 @@ def main(argv): except exception.DescriptionTreeException as err: print('DescriptionTree error: %s' % err, file=sys.stderr) return 1 - + + if desc.license not in licenses: + licenses.append(desc.license) + deps = [] if desc.systemrequirements is not None: @@ -70,15 +76,19 @@ def main(argv): dependencies[my_match] = [my_dep] else: dependencies[my_match].append(my_dep) - - json_dict = dict(dependencies=dict()) + + json_dict = dict( + dependencies = dict(), + licenses = dict(), + ) try: with open(argv[1], 'r') as fp: json_dict = json.load(fp) except: pass - + + print('***** Dependencies *****\n') for dep in dependencies: s.execute(dep) print(dep) @@ -108,6 +118,33 @@ def main(argv): json_dict['dependencies'][dep_name] = select print('Selected: %s' % json_dict['dependencies'][dependencies[dep][0]]) print() + + print('***** Licenses *****\n') + for lic in licenses: + if lic in json_dict['licenses']: + if py3k: + temp = input( + '%s [%s]: ' % ( + lic, + json_dict['licenses'][lic], + ) + ) + else: + temp = raw_input( + '%s [%s]: ' % ( + lic, + json_dict['licenses'][lic], + ) + ) + if temp != '': + json_dict['licenses'][lic] = temp + else: + if py3k: + json_dict['licenses'][lic] = input('%s: ' % lic) + else: + json_dict['licenses'][lic] = raw_input('%s: ' % lic) + print('Selected: %s' % json_dict['licenses'][lic]) + print() try: with open(argv[1], 'w') as fp: |