Skip to content

Commit

Permalink
Create release_notes and package_manifest automatically (#24)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Justin Ely authored and jhunkeler committed Sep 30, 2016
1 parent fb19fee commit 767c217
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 2,069 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
build
source/*.html
TOKEN

source/package_manifest.rst
source/release_notes.rst
62 changes: 62 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
language: python

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false

# The apt packages below are needed for sphinx builds, which can no longer
# be installed with sudo apt-get.
addons:
apt:
packages:
- graphviz
- texlive-latex-extra
- dvipng

os:
- linux


python:
- 3.5

env:
global:
# SET DEFAULTS TO AVOID REPEATING IN MOST CASES
- SETUPTOOLS_VERSION=stable
- PIP_INSTALL='pip install'
- INSTALL_OPTIONAL=true
- SETUP_CMD='test'

before_install:

# USE UTF8 ENCODING. SHOULD BE DEFAULT, BUT THIS IS INSURANCE AGAINST
# FUTURE CHANGES
- export PYTHONIOENCODING=UTF8

# http://conda.pydata.org/docs/travis.html#the-travis-yml-file
- wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a

#CHECK INTERACTIVE MATPLOTLIB BACKENDS
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start


install:
- conda create -n test python=$TRAVIS_PYTHON_VERSION
- source activate test

# ADD STSCI ASTROCONDA CHANNEL
- conda config --add channels http://ssb.stsci.edu/astroconda

# RTD deps
- $PIP_INSTALL -r source/rtd-pip-requirements.txt


script:
- python setup.py install
22 changes: 22 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
from setuptools import setup, find_packages
from setuptools.command.install import install

import sys
sys.path.insert(0, 'source/')
import release_notes
import package_manifest

class MyInstall(install):
def run(self):
install.run(self)
release_notes.generate_release_notes()
package_manifest.generate_manifest()

setup(
name = 'astroconda',
version = '0.0.1',
author = 'Joseph Hunkeler',
cmdclass = {'install': MyInstall},
install_requires = ['pypandoc', 'github3.py']
)
91 changes: 50 additions & 41 deletions source/package_manifest.py
Original file line number Diff line number Diff line change
@@ -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']
Expand Down Expand Up @@ -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()

0 comments on commit 767c217

Please sign in to comment.