diff --git a/bin/dunepackaging.py b/bin/dunepackaging.py index ac038c4494b7a635dea3db9a9fe862f28f93c916..89a6e1f09777f871f24be8959ec2cbfb82527bf5 100755 --- a/bin/dunepackaging.py +++ b/bin/dunepackaging.py @@ -20,16 +20,7 @@ class Data: (dep[0]+str(dep[1])).replace("("," ").replace(")","") for dep in description.depends ] - - self.install_requires = [] - try: - with open('python/setup.py.in', 'r') as setuppyinfile: - content = setuppyinfile.read() - if content.find('install_requires'): - bracket = content.split('install_requires')[1].split('[')[1].split(']')[0] - self.install_requires = [r.strip('\'"') for r in bracket.split(',')] - except FileNotFoundError: - pass + self.install_requires = [r[0] for r in description.python_requires] def main(argv): diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index fed9e6cb08eaf31a9f6ad6779ab015df70b673e2..08d974666ef73f6a0e2b1dd320f948adbe22a32d 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -417,6 +417,13 @@ macro(dune_module_information MODULE_DIR) dune_module_to_uppercase(DUNE_MOD_NAME_UPPERCASE ${DUNE_MOD_NAME}) + # 5. Check for optional meta data + extract_line("Author:" ${DUNE_MOD_NAME_UPPERCASE}_AUTHOR "${MODULE_DIR}/dune.module") + extract_line("Description:" ${DUNE_MOD_NAME_UPPERCASE}_DESCRIPTION "${MODULE_DIR}/dune.module") + extract_line("URL:" ${DUNE_MOD_NAME_UPPERCASE}_URL "${MODULE_DIR}/dune.module") + extract_line("Python-Requires:" ${DUNE_MOD_NAME_UPPERCASE}_PYTHON_REQUIRES "${MODULE_DIR}/dune.module") + set(${DUNE_MOD_NAME_UPPERCASE}_AUTHOREMAIL "${DUNE_MAINTAINER}") + # set module version set(${DUNE_MOD_NAME_UPPERCASE}_VERSION "${DUNE_MOD_VERSION}") set(${DUNE_MOD_NAME_UPPERCASE}_VERSION_MAJOR "${DUNE_VERSION_MAJOR}") diff --git a/dune.module b/dune.module index e5e93cdb608fa74da1141b6ad749d196bcf89c34..68fdbf0b05639b5a9ae4331951e315fdd4585270 100644 --- a/dune.module +++ b/dune.module @@ -4,4 +4,5 @@ Author: The Dune Core developers Maintainer: dune-devel@lists.dune-project.org Description: Basis infrastructure for all Dune modules URL: https://gitlab.dune-project.org/core/dune-common +Python-Requires: portalocker mpi4py numpy Whitespace-Hook: Yes diff --git a/python/dune/common/module.py b/python/dune/common/module.py index 7dfce77beab7e1d5a59f6843bdbebfbe9fcdac59..e9639d2aedef6dca9903df503389bb2de85308e5 100644 --- a/python/dune/common/module.py +++ b/python/dune/common/module.py @@ -189,6 +189,7 @@ class Description: self.depends = parse_deps(data.get('depends')) self.suggests = parse_deps(data.get('suggests')) + self.python_requires = parse_deps(data.get('python-requires')) def __repr__(self): s = 'Module: ' + self.name + '\n' @@ -211,6 +212,8 @@ class Description: s += 'Depends: ' + print_deps(self.depends) + '\n' if self.suggests: s += 'Suggests: ' + print_deps(self.suggests) + '\n' + if self.python_requires: + s += 'Python-Requires: ' + print_deps(self.python_requires) + '\n' return s def __str__(self): diff --git a/python/setup.py.in b/python/setup.py.in index 6d5d6f1e6e6eaec3b458795db9c4f3782c17c2c3..d15c27cf67d812dfe2347a1360be0e0d07c6fb84 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -1,12 +1,13 @@ from setuptools import setup, find_packages -setup(name="dune-common", +setup(name="${DUNE_MOD_NAME}", namespace_packages=['dune'], - description="Python lib for dune", + description="${DUNE_COMMON_DESCRIPTION}", version="${DUNE_COMMON_VERSION}", - author="Andreas Dedner and Martin Nolte", + author="${DUNE_COMMON_AUTHOR}", + author_email="${DUNE_COMMON_AUTHOREMAIL}", packages = find_packages(), zip_safe = 0, package_data = {'': ['*.so']}, - install_requires = ['portalocker','mpi4py','numpy'] + install_requires = "${DUNE_COMMON_PYTHON_REQUIRES}".split(' ') )