Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python script to generate previous releases table #382

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ source/user/CYCAMORE_INSTALL.rst
source/user/DEPENDENCIES.rst
source/user/CYCAMORE_DEPS.rst
docs.zip
source/previous/release_table.rst

# Rever
rever/
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ gh-preview html:
wget -nv https://raw.githubusercontent.com/${CYCAMORE_GIT_FORK}/cycamore/${CYCAMORE_GIT_BRANCH}/DEPENDENCIES.rst -O source/user/CYCAMORE_DEPS.rst || \
curl https://raw.githubusercontent.com/${CYCAMORE_GIT_FORK}/cycamore/${CYCAMORE_GIT_BRANCH}/DEPENDENCIES.rst -L -o source/user/CYCAMORE_DEPS.rst

python3 source/releases.py
PYTHONDONTWRITEBYTECODE="TRUE" $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)
sed -i.bak 's/function top_offset([$$]node){ return [$$]node\[0\].getBoundingClientRect().top; }/function top_offset($$node){ return (typeof $$node[0] === "undefined") ? 0 : $$node[0].getBoundingClientRect().top; }/' ./gh-build/_static/cloud.js
sed -i.bak 's/ if (state == "collapsed"){/ if (typeof state === "undefined") {\n var state = "uncollapsed";\n };\n if (state == "collapsed"){/' ./gh-build/_static/cloud.js
Expand Down
108 changes: 1 addition & 107 deletions source/previous/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,110 +15,4 @@ have been included in the 1.5.0.

.. rst-class:: centered

========= ========== ================ ==============
Version Date Zip Tar
========= ========== ================ ==============
1.5.5 2019-01-14 `zip 1.5.5`_ `tar 1.5.5`_
1.5.0 2016-12-13 `zip 1.5.0`_ `tar 1.5.0`_
1.5.0 2016-12-13 `zip 1.5.0-rc1`_ `tar 1.5.0-rc1`_
1.4.1 2016-11-01 `zip 1.4.1`_ `tar 1.4.1`_
1.4.0 2016-10-31 `zip 1.4.0`_ `tar 1.4.0`_
1.4.0-rc3 2016-09-14 `zip 1.4.0-rc3`_ `tar 1.4.0-rc3`_
1.4.0-rc2 2016-08-29 `zip 1.4.0-rc2`_ `tar 1.4.0-rc2`_
1.4.0-rc1 2016-05-26 `zip 1.4.0-rc1`_ `tar 1.4.0-rc1`_
1.3.0 2015-05-27 `zip 1.3.0`_ `tar 1.3.0`_
1.3.0-rc6 2015-04-27 `zip 1.3.0-rc6`_ `tar 1.3.0-rc6`_
1.3.0-rc5 2015-04-27 `zip 1.3.0-rc5`_ `tar 1.3.0-rc5`_
1.3.0-rc4 2015-04-27 `zip 1.3.0-rc4`_ `tar 1.3.0-rc4`_
1.3.0-rc3 2015-04-27 `zip 1.3.0-rc3`_ `tar 1.3.0-rc3`_
1.3.0-rc2 2015-04-27 `zip 1.3.0-rc2`_ `tar 1.3.0-rc2`_
1.3.0-rc1 2015-04-27 `zip 1.3.0-rc1`_ `tar 1.3.0-rc1`_
1.2.0 2014-12-02 `zip 1.2.0`_ `tar 1.2.0`_
1.2.0-rc1 2014-11-25 `zip 1.2.0-rc1`_ `tar 1.2.0-rc1`_
1.1.0 2014-09-19 `zip 1.1.0`_ `tar 1.1.0`_
1.1.0-rc1 2014-09-16 `zip 1.1.0-rc1`_ `tar 1.1.0-rc1`_
1.0.0 2014-05-30 `zip 1.0.0`_ `tar 1.0.0`_
1.0.0-rc4 2014-05-30 `zip 1.0.0-rc4`_ `tar 1.0.0-rc4`_
1.0.0-rc3 2014-05-27 `zip 1.0.0-rc3`_ `tar 1.0.0-rc3`_
1.0.0-rc2 2014-05-26 `zip 1.0.0-rc2`_ `tar 1.0.0-rc2`_
1.0.0-rc1 2014-05-24 `zip 1.0.0-rc1`_ `tar 1.0.0-rc1`_
0.4.4 2014-05-01 `zip 0.4.4`_ `tar 0.4.4`_
0.4.2 2014-03-06 `zip 0.4.2`_ `tar 0.4.2`_
0.4.1 2014-02-27 `zip 0.4.1`_ `tar 0.4.1`_
0.4 2014-02-13 `zip 0.4`_ `tar 0.4`_
0.4-rc1 2014-02-09 `zip 0.4-rc1`_ `tar 0.4-rc1`_
0.3 2013-10-28 `zip 0.3`_ `tar 0.3`_
0.3-rc1 2013-10-25 `zip 0.3-rc1`_ `tar 0.3-rc1`_
0.2 2013-07-17 `zip 0.2`_ `tar 0.2`_
0.2-rc1 2013-07-12 `zip 0.2-rc1`_ `tar 0.2-rc1`_
0.1 2012-03-27 `zip 0.1`_ `tar 0.1`_
========= ========== ================ ==============

.. _zip 1.5.5: https://github.com/cyclus/cyclus/archive/1.5.5.zip
.. _tar 1.5.5: https://github.com/cyclus/cyclus/arcive/1.5.5.tar.gz
.. _zip 1.5.0: https://github.com/cyclus/cyclus/archive/1.5.0.zip
.. _tar 1.5.0: https://github.com/cyclus/cyclus/archive/1.5.0.tar.gz
.. _zip 1.5.0-rc1: https://github.com/cyclus/cyclus/archive/1.5.0-rc1.zip
.. _tar 1.5.0-rc1: https://github.com/cyclus/cyclus/archive/1.5.0-rc1.tar.gz
.. _zip 1.4.1: https://github.com/cyclus/cyclus/archive/1.4.1.zip
.. _tar 1.4.1: https://github.com/cyclus/cyclus/archive/1.4.1.tar.gz
.. _zip 1.4.0: https://github.com/cyclus/cyclus/archive/1.4.0.zip
.. _tar 1.4.0: https://github.com/cyclus/cyclus/archive/1.4.0.tar.gz
.. _zip 1.4.0-rc3: https://github.com/cyclus/cyclus/archive/1.4.0-rc3.zip
.. _tar 1.4.0-rc3: https://github.com/cyclus/cyclus/archive/1.4.0-rc3.tar.gz
.. _zip 1.4.0-rc2: https://github.com/cyclus/cyclus/archive/1.4.0-rc2.zip
.. _tar 1.4.0-rc2: https://github.com/cyclus/cyclus/archive/1.4.0-rc2.tar.gz
.. _zip 1.4.0-rc1: https://github.com/cyclus/cyclus/archive/1.4.0-rc1.zip
.. _tar 1.4.0-rc1: https://github.com/cyclus/cyclus/archive/1.4.0-rc1.tar.gz
.. _zip 1.3.0: https://github.com/cyclus/cyclus/archive/1.3.0.zip
.. _tar 1.3.0: https://github.com/cyclus/cyclus/archive/1.3.0.tar.gz
.. _zip 1.3.0-rc6: https://github.com/cyclus/cyclus/archive/1.3.0-rc6.zip
.. _tar 1.3.0-rc6: https://github.com/cyclus/cyclus/archive/1.3.0-rc6.tar.gz
.. _zip 1.3.0-rc5: https://github.com/cyclus/cyclus/archive/1.3.0-rc5.zip
.. _tar 1.3.0-rc5: https://github.com/cyclus/cyclus/archive/1.3.0-rc5.tar.gz
.. _zip 1.3.0-rc4: https://github.com/cyclus/cyclus/archive/1.3.0-rc4.zip
.. _tar 1.3.0-rc4: https://github.com/cyclus/cyclus/archive/1.3.0-rc4.tar.gz
.. _zip 1.3.0-rc3: https://github.com/cyclus/cyclus/archive/1.3.0-rc3.zip
.. _tar 1.3.0-rc3: https://github.com/cyclus/cyclus/archive/1.3.0-rc3.tar.gz
.. _zip 1.3.0-rc2: https://github.com/cyclus/cyclus/archive/1.3.0-rc2.zip
.. _tar 1.3.0-rc2: https://github.com/cyclus/cyclus/archive/1.3.0-rc2.tar.gz
.. _zip 1.3.0-rc1: https://github.com/cyclus/cyclus/archive/1.3.0-rc1.zip
.. _tar 1.3.0-rc1: https://github.com/cyclus/cyclus/archive/1.3.0-rc1.tar.gz
.. _zip 1.2.0: https://github.com/cyclus/cyclus/archive/1.2.0.zip
.. _tar 1.2.0: https://github.com/cyclus/cyclus/archive/1.2.0.tar.gz
.. _zip 1.2.0-rc1: https://github.com/cyclus/cyclus/archive/1.2.0-rc1.zip
.. _tar 1.2.0-rc1: https://github.com/cyclus/cyclus/archive/1.2.0-rc1.tar.gz
.. _zip 1.1.0: https://github.com/cyclus/cyclus/archive/1.1.0.zip
.. _tar 1.1.0: https://github.com/cyclus/cyclus/archive/1.1.0.tar.gz
.. _zip 1.1.0-rc1: https://github.com/cyclus/cyclus/archive/1.1.0-rc1.zip
.. _tar 1.1.0-rc1: https://github.com/cyclus/cyclus/archive/1.1.0-rc1.tar.gz
.. _zip 1.0.0: https://github.com/cyclus/cyclus/archive/1.0.0.zip
.. _tar 1.0.0: https://github.com/cyclus/cyclus/archive/1.0.0.tar.gz
.. _zip 1.0.0-rc4: https://github.com/cyclus/cyclus/archive/1.0.0-rc4.zip
.. _tar 1.0.0-rc4: https://github.com/cyclus/cyclus/archive/1.0.0-rc4.tar.gz
.. _zip 1.0.0-rc3: https://github.com/cyclus/cyclus/archive/1.0.0-rc3.zip
.. _tar 1.0.0-rc3: https://github.com/cyclus/cyclus/archive/1.0.0-rc3.tar.gz
.. _zip 1.0.0-rc2: https://github.com/cyclus/cyclus/archive/1.0.0-rc2.zip
.. _tar 1.0.0-rc2: https://github.com/cyclus/cyclus/archive/1.0.0-rc2.tar.gz
.. _zip 1.0.0-rc1: https://github.com/cyclus/cyclus/archive/1.0.0-rc1.zip
.. _tar 1.0.0-rc1: https://github.com/cyclus/cyclus/archive/1.0.0-rc1.tar.gz
.. _zip 0.4.4: https://github.com/cyclus/cyclus/archive/0.4.4.zip
.. _tar 0.4.4: https://github.com/cyclus/cyclus/archive/0.4.4.tar.gz
.. _zip 0.4.2: https://github.com/cyclus/cyclus/archive/0.4.2.zip
.. _tar 0.4.2: https://github.com/cyclus/cyclus/archive/0.4.2.tar.gz
.. _zip 0.4.1: https://github.com/cyclus/cyclus/archive/0.4.1.zip
.. _tar 0.4.1: https://github.com/cyclus/cyclus/archive/0.4.1.tar.gz
.. _zip 0.4: https://github.com/cyclus/cyclus/archive/0.4.zip
.. _tar 0.4: https://github.com/cyclus/cyclus/archive/0.4.tar.gz
.. _zip 0.4-rc1: https://github.com/cyclus/cyclus/archive/0.4-rc1.zip
.. _tar 0.4-rc1: https://github.com/cyclus/cyclus/archive/0.4-rc1.tar.gz
.. _zip 0.3: https://github.com/cyclus/cyclus/archive/0.3.zip
.. _tar 0.3: https://github.com/cyclus/cyclus/archive/0.3.tar.gz
.. _zip 0.3-rc1: https://github.com/cyclus/cyclus/archive/0.3-rc1.zip
.. _tar 0.3-rc1: https://github.com/cyclus/cyclus/archive/0.3-rc1.tar.gz
.. _zip 0.2: https://github.com/cyclus/cyclus/archive/0.2.zip
.. _tar 0.2: https://github.com/cyclus/cyclus/archive/0.2.tar.gz
.. _zip 0.2-rc1: https://github.com/cyclus/cyclus/archive/0.2-rc1.zip
.. _tar 0.2-rc1: https://github.com/cyclus/cyclus/archive/0.2-rc1.tar.gz
.. _zip 0.1: https://github.com/cyclus/cyclus/archive/v0.1.zip
.. _tar 0.1: https://github.com/cyclus/cyclus/archive/v0.1.tar.gz
.. include:: release_table.rst
37 changes: 37 additions & 0 deletions source/releases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import urllib.request as request, json, os
from datetime import datetime

def main():
response = request.urlopen('https://api.github.com/repos/cyclus/cyclus/releases')
releases = json.loads(response.read())
table_text = \
'''.. list-table::
:widths: 25 25 25 25
:header-rows: 1

* - Version
- Date
- Zip
- Tar'''
for release in releases:
version = release['tag_name']
date = release['published_at']
date_object = datetime.strptime(date, "%Y-%m-%dT%H:%M:%SZ")
date_formatted = date_object.strftime("%m/%d/%Y")
zip_url = release['zipball_url']
tar_url = release['tarball_url']
table_text += f'''
* - {version}
bennibbelink marked this conversation as resolved.
Show resolved Hide resolved
- {date_formatted}
- `zip {version} <{zip_url}>`_
- `tar {version} <{tar_url}>`_'''

filename = os.path.dirname(os.path.realpath(__file__)) + '/previous/release_table.rst'

if not os.path.isfile(filename):
open(filename, 'x')
with open(filename, 'w') as f:
f.write(table_text)

if __name__ == "__main__":
main()