summaryrefslogtreecommitdiff
path: root/source/package_manifest.py
diff options
context:
space:
mode:
authorJustin Ely <ely@stsci.edu>2016-09-30 15:45:09 -0400
committerJoseph Hunkeler <jhunkeler@users.noreply.github.com>2016-09-30 15:45:09 -0400
commit767c217f3cd34e33f0aab5b7415badbe0733d8c2 (patch)
treef0c04a5c2c8eacff8e39df9db6498a638ae2650a /source/package_manifest.py
parentfb19feed0bc525bc58832a39cd9e11a717b68f8f (diff)
downloadastroconda-767c217f3cd34e33f0aab5b7415badbe0733d8c2.tar.gz
Create release_notes and package_manifest automatically (#24)
* auto creating release_notes and package_manifest release_notes now provide links to individual repository release notes instead of collecting them together Using anonymous access with github3. Note that this has API call restrictions, so can only do so many times within an hour before being blocked. setup.py install now runs the two scripts in source to generate the manifest and release notes rst files. minor changes to py scripts to use different org access calls, and defining output path to not be CWD. requirement and calls to pandoc have also been removed. files are written directly to rst instead of being written to md and converted. * Exclude non-astroconda packages from release_notes * change disclaimer at top of release notes
Diffstat (limited to 'source/package_manifest.py')
-rw-r--r--source/package_manifest.py91
1 files changed, 50 insertions, 41 deletions
diff --git a/source/package_manifest.py b/source/package_manifest.py
index a179888..5e9d80a 100644
--- a/source/package_manifest.py
+++ b/source/package_manifest.py
@@ -1,6 +1,13 @@
+from __future__ import print_function
+
import json
+import os
from collections import OrderedDict
-from urllib.request import urlopen
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
from pprint import pprint
ARCHITECTURE = [ 'linux-64', 'osx-64']
@@ -38,45 +45,47 @@ def get_repodata(architecture):
return data
+def generate_manifest():
+ python_versions = dict(
+ py27='2.7',
+ py34='3.4',
+ py35='3.5'
+ )
-if __name__ == '__main__':
+ with open(os.path.join('source', 'package_manifest.rst'), 'w+') as pfile:
+ print('Packages', file=pfile)
+ print('========\n\n', file=pfile)
+ print('{0}\n\n'.format(MESSAGE), file=pfile)
+
+ repo_data = OrderedDict()
+ for arch in ARCHITECTURE:
+ repo_data[arch] = get_repodata(arch)
+
+ metapackages = []
+ for mpkg, mpkg_version in METAPACKAGES:
+ for key, value in repo_data[arch].items():
+ if mpkg == repo_data[arch][key]['name']:
+ if mpkg_version == repo_data[arch][key]['version']:
+ metapackages.append(('-'.join([value['name'], value['version']]), value['build'], value['depends']))
+
+ print('{arch} metapackages'.format(arch=arch), file=pfile)
+ print('------------------------\n\n', file=pfile)
- python_versions = dict(
- py27='2.7',
- py34='3.4',
- py35='3.5'
- )
-
- with open('package_manifest.rst', 'w+') as pfile:
- print('Packages', file=pfile)
- print('========\n\n', file=pfile)
- print('{0}\n\n'.format(MESSAGE), file=pfile)
-
- repo_data = OrderedDict()
- for arch in ARCHITECTURE:
- repo_data[arch] = get_repodata(arch)
-
- metapackages = []
- for mpkg, mpkg_version in METAPACKAGES:
- for key, value in repo_data[arch].items():
- if mpkg == repo_data[arch][key]['name']:
- if mpkg_version == repo_data[arch][key]['version']:
- metapackages.append(('-'.join([value['name'], value['version']]), value['build'], value['depends']))
-
- print('{arch} metapackages'.format(arch=arch), file=pfile)
- print('------------------------\n\n', file=pfile)
-
- metapackages = sorted(metapackages, key=lambda k: k[0])
- for name, build, dependencies in metapackages:
- print('- **{name} ({python})**\n'.format(name=name, python=build), file=pfile)
- for pkg in dependencies:
- print(' - {:<20s}\n'.format(pkg), file=pfile)
-
- print('{arch} packages'.format(arch=arch), file=pfile)
- print('------------------------\n\n', file=pfile)
-
- _packages = sorted(repo_data[arch].values(), key=lambda k: k['name'])
- packages = set(['-'.join([d['name'], d['version']]) for d in _packages])
-
- for record in sorted(packages):
- print('- {name}\n'.format(name=record, header='-' * len(record)), file=pfile)
+ metapackages = sorted(metapackages, key=lambda k: k[0])
+ for name, build, dependencies in metapackages:
+ print('- **{name} ({python})**\n'.format(name=name, python=build), file=pfile)
+ for pkg in dependencies:
+ print(' - {:<20s}\n'.format(pkg), file=pfile)
+
+ print('{arch} packages'.format(arch=arch), file=pfile)
+ print('------------------------\n\n', file=pfile)
+
+ _packages = sorted(repo_data[arch].values(), key=lambda k: k['name'])
+ packages = set(['-'.join([d['name'], d['version']]) for d in _packages])
+
+ for record in sorted(packages):
+ print('- {name}\n'.format(name=record, header='-' * len(record)), file=pfile)
+
+
+if __name__ == '__main__':
+ generate_manifest()