diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..59a5aa0 --- /dev/null +++ b/CHANGELOG.rst @@ -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). diff --git a/CMakeLists.txt b/CMakeLists.txt index 86be1ec..a9581ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile index 0d08f06..cf3eac9 100644 --- a/doc/doxygen/Doxyfile +++ b/doc/doxygen/Doxyfile @@ -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 diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py index cb0fdd9..e73f6ff 100644 --- a/doc/sphinx/conf.py +++ b/doc/sphinx/conf.py @@ -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. diff --git a/utils/srcmanip/set_version b/utils/srcmanip/set_version new file mode 100755 index 0000000..b2888d2 --- /dev/null +++ b/utils/srcmanip/set_version @@ -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()