summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2019-12-22 12:37:15 -0700
committerCharles Harris <charlesr.harris@gmail.com>2019-12-22 14:55:23 -0700
commit483f570694d8bed245ce5391515ba4ee1a0202da (patch)
tree9d928cf269a15ed7c698fde64bf8f3edb04107ca
parent0ed32251e0b67002a0f6da894db2080f4ecdd4e1 (diff)
downloadnumpy-483f570694d8bed245ce5391515ba4ee1a0202da.tar.gz
MAINT: Update pavement.py for towncrier.
The update is needed so that the links generated by towncrier are converted in the README.md file generated for the github release documentation. The code is also simplified. [skip ci]
-rw-r--r--doc/HOWTO_RELEASE.rst.txt5
-rw-r--r--doc/source/release/1.18.0-notes.rst6
-rw-r--r--pavement.py60
3 files changed, 41 insertions, 30 deletions
diff --git a/doc/HOWTO_RELEASE.rst.txt b/doc/HOWTO_RELEASE.rst.txt
index f0231293f..99f6a0e40 100644
--- a/doc/HOWTO_RELEASE.rst.txt
+++ b/doc/HOWTO_RELEASE.rst.txt
@@ -106,9 +106,10 @@ You will need write permission for numpy-wheels in order to trigger wheel
builds.
- Python(s) from `python.org <https://python.org>`_ or linux distro.
-- cython
+- cython (pip)
- virtualenv (pip)
- Paver (pip)
+- pandoc `pandoc.org <https://www.pandoc.org>`_ or linux distro.
- numpy-wheels `<https://github.com/MacPython/numpy-wheels>`_ (clone)
@@ -379,7 +380,7 @@ Make the release
----------------
Build the changelog and notes for upload with::
- paver write_release_and_log
+ paver write_release
Build and archive documentation
diff --git a/doc/source/release/1.18.0-notes.rst b/doc/source/release/1.18.0-notes.rst
index 851e35b88..9ca742eab 100644
--- a/doc/source/release/1.18.0-notes.rst
+++ b/doc/source/release/1.18.0-notes.rst
@@ -366,9 +366,9 @@ Added two new configuration options. During the ``build_src`` subcommand, as
part of configuring NumPy, the files ``_numpyconfig.h`` and ``config.h`` are
created by probing support for various runtime functions and routines.
Previously, the very verbose compiler output during this stage clouded more
-important information. By default the output is silenced. Running ``runtests.py
---debug-info`` will add ``--verbose-cfg`` to the ``build_src`` subcommand,
-which will restore the previous behaviour.
+important information. By default the output is silenced. Running
+``runtests.py --debug-info`` will add ``--verbose-cfg`` to the ``build_src``
+subcommand,which will restore the previous behaviour.
Adding ``CFLAGS=-Werror`` to turn warnings into errors would trigger errors
during the configuration. Now ``runtests.py --warn-error`` will add
diff --git a/pavement.py b/pavement.py
index 889a552f6..352e375d2 100644
--- a/pavement.py
+++ b/pavement.py
@@ -182,6 +182,18 @@ def compute_sha256(idirs):
def write_release_task(options, filename='README'):
"""Append hashes of release files to release notes.
+ This appends file hashes to the release notes ane creates
+ four README files of the result in various formats:
+
+ - README.rst
+ - README.rst.gpg
+ - README.md
+ - README.md.gpg
+
+ The md file are created using `pandoc` so that the links are
+ properly updated. The gpg files are kept separate, so that
+ the unsigned files may be edited before signing if needed.
+
Parameters
----------
options :
@@ -192,46 +204,44 @@ def write_release_task(options, filename='README'):
"""
idirs = options.installers.installersdir
- source = paver.path.path(RELEASE_NOTES)
- target = paver.path.path(filename + '.rst')
- if target.exists():
- target.remove()
+ notes = paver.path.path(RELEASE_NOTES)
+ rst_readme = paver.path.path(filename + '.rst')
+ md_readme = paver.path.path(filename + '.md')
- tmp_target = paver.path.path(filename + '.md')
- source.copy(tmp_target)
+ # append hashes
+ with open(rst_readme, 'w') as freadme:
+ with open(notes) as fnotes:
+ freadme.write(fnotes.read())
- with open(str(tmp_target), 'a') as ftarget:
- ftarget.writelines("""
+ freadme.writelines("""
Checksums
=========
MD5
---
+::
""")
- ftarget.writelines([' %s\n' % c for c in compute_md5(idirs)])
- ftarget.writelines("""
+ freadme.writelines([f' {c}\n' for c in compute_md5(idirs)])
+ freadme.writelines("""
SHA256
------
+::
""")
- ftarget.writelines([' %s\n' % c for c in compute_sha256(idirs)])
+ freadme.writelines([f' {c}\n' for c in compute_sha256(idirs)])
- # Sign release
- cmd = ['gpg', '--clearsign', '--armor']
+ # generate md file using pandoc before signing
+ sh(f"pandoc -s -o {md_readme} {rst_readme}")
+
+ # Sign files
if hasattr(options, 'gpg_key'):
- cmd += ['--default-key', options.gpg_key]
- cmd += ['--output', str(target), str(tmp_target)]
- subprocess.check_call(cmd)
- print("signed %s" % (target,))
-
- # Change PR links for github posting, don't sign this
- # as the signing isn't markdown compatible.
- with open(str(tmp_target), 'r') as ftarget:
- mdtext = ftarget.read()
- mdtext = re.sub(r'^\* `(\#[0-9]*).*?`__', r'* \1', mdtext, flags=re.M)
- with open(str(tmp_target), 'w') as ftarget:
- ftarget.write(mdtext)
+ cmd = f'gpg --clearsign --armor --default_key {options.gpg_key}'
+ else:
+ cmd = 'gpg --clearsign --armor'
+
+ sh(cmd + f' --output {rst_readme}.gpg {rst_readme}')
+ sh(cmd + f' --output {md_readme}.gpg {md_readme}')
@task