Skip to content

Commit

Permalink
Release version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Oct 20, 2020
1 parent 59bf20c commit 0cb07ee
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 6 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**********
Change Log
**********

Notable project changes in various releases.


1.0
===

Added
-----

* Various improvements in the CMake-build system.

* CMake and PKG-Config export files when MpiFx is installed.


Changed
-------

* The Fypp-preprocessor is not shipped with MpiFx but is an external
requirement.

* Name convention for processes (master -> lead).
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include(MpiFxUtils)

include(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake)

project(MpiFx VERSION 0.1 LANGUAGES Fortran)
project(MpiFx VERSION 1.0 LANGUAGES Fortran)

setup_build_type()

Expand Down
4 changes: 2 additions & 2 deletions doc/doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.

PROJECT_NAME = "MPIFX"
PROJECT_NAME = "MpiFx"

# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = ""
PROJECT_NUMBER = "1.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
Expand Down
6 changes: 3 additions & 3 deletions doc/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@

# General information about the project.
project = u'MPIFX'
copyright = u'2013, B. Aradi'
copyright = u'2013-2020, DFTB+ developers group'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '12.12'
version = '1.0'

# The full version, including alpha/beta/rc tags.
release = '12.12'
release = '1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
105 changes: 105 additions & 0 deletions utils/srcmanip/set_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env python3

'''Tool for setting the version numbers in the project'''

import sys
import re
import os
import argparse

_DESCRIPTION = '''Set all version numbers in the project to a given value.
The list of files, where the project number is changed, is hardcoded in the
script.'''

_VERSION_PATTERN = r'\d+\.\d+(?:\.\d+)?(?:-\w+)?'

_FILES_AND_PATTERNS = [
#
('CMakeLists.txt',
r'project\(\s*MpiFx\s+VERSION\s+{}(\s+|\))'.format(_VERSION_PATTERN),
r'project(MpiFx VERSION {version}\1'),
#
('doc/doxygen/Doxyfile',
r'^PROJECT_NUMBER\s*=\s*([\'"]){}\1\s*$'.format(_VERSION_PATTERN),
'PROJECT_NUMBER = "{version}"\n'),
#
('doc/sphinx/conf.py',
r'version\s*=\s*([\'"]){}\1'.format(_VERSION_PATTERN),
"version = '{shortversion}'"),
#
('doc/sphinx/conf.py',
r'release\s*=\s*([\'"]){}\1'.format(_VERSION_PATTERN),
"release = '{version}'"),
]


def main():
'Main script executable.'

args = _parse_arguments()
version = args.version
shortversion = _get_short_version(version)
rootdir = os.path.join(os.path.dirname(sys.argv[0]), '../../')

_replace_in_registered_files(rootdir, version, shortversion)
_replace_in_changelog(rootdir, version)


def _parse_arguments():
'''Returns parsed command line arguments.'''

parser = argparse.ArgumentParser(description=_DESCRIPTION)
msg = 'Version to set'
parser.add_argument('version', help=msg)
args = parser.parse_args()

match = re.match(r'^{}$'.format(_VERSION_PATTERN), args.version)
if match is None:
parser.error("Invalid version string")

return args


def _get_short_version(version):
'''Returns the short version (without patch number).'''

return '.'.join(version.split('.')[0:2])


def _replace_in_registered_files(rootdir, version, shortversion):
'''Replaces the version number in various (registered) files.'''

for fname, regexp, repl in _FILES_AND_PATTERNS:
fname = os.path.join(rootdir, fname)
print("Replacments in '{}': ".format(fname), end='')
fp = open(fname, 'r')
txt = fp.read()
fp.close()
replacement = repl.format(version=version, shortversion=shortversion)
newtxt, nsub = re.subn(regexp, replacement, txt, flags=re.MULTILINE)
print(nsub)
fp = open(fname, 'w')
fp.write(newtxt)
fp.close()


def _replace_in_changelog(rootdir, version):
'''Replace version number in Change Log and adapt decoration below.'''

fname = os.path.join(rootdir, 'CHANGELOG.rst')
print("Replacments in '{}': ".format(fname), end='')
fp = open(fname, 'r')
txt = fp.read()
fp.close()
decoration = '=' * len(version)
newtxt, nsub = re.subn(
r'^Unreleased\s*\n=+', version + '\n' + decoration, txt,
count=1, flags=re.MULTILINE)
print(nsub)
fp = open(fname, 'w')
fp.write(newtxt)
fp.close()


if __name__ == '__main__':
main()

0 comments on commit 0cb07ee

Please sign in to comment.