Commit 6dc52d79 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

update duneeasyconfig.sh with parsing of dune-module files

parent a8806696
......@@ -26,14 +26,7 @@ cd ${GIT_DIR}
# parse dune-module file
VERSION=`date +%Y.%m.%d`
DEP_NAMES=("dune-common")
DEP_VERS=("2.6.0")
DEPENDENCIES=""
for index in ${!DEP_NAMES[*]}
do
DEPENDENCIES+=" ('${DEP_NAMES[$index]}', '${DEP_VERS[$index]}'),"
done
DEPENDENCIES=$(python ${DIR}/tools/parse_dune.module.py ${GIT_DIR}/dune.module)
git archive --format=tar.gz --prefix=${MODULE}-v${VERSION}/ HEAD > ${DIR}/d/${MODULE}/${MODULE}-v${VERSION}.tar.gz
......@@ -59,7 +52,7 @@ configopts = ' -DCMAKE_BUILD_TYPE=Release \${CMAKE_FLAGS}'
srcdir = './%(namelower)s-v%(version)s/'
sanity_check_paths = {
'files': ['lib/dunecontrol/${MODULE}/dune.module'],
'files': ['lib/dunecontrol/%(namelower)s/dune.module'],
'dirs': ['include/dune/']
}
......@@ -71,6 +64,6 @@ module unload git
module load EasyBuild
cd ${DIR}
eb ${EASYCONFIG} --moduleclasses=dune --robot=external/:modules/ --inject-checksums
eb ${EASYCONFIG} --moduleclasses=dune --inject-checksums
rm ${EASYCONFIG}.bak_*
import re
import sys
version_pattern = re.compile('([0-9]+)\.([0-9]+)(?:\.([0-9]+))?')
depends_pattern = re.compile('([a-zA-Z_-]+)(?:[ ]*\(([<>=]+)[ ]*([0-9.]+)\))?')
def make_version(version, mod_version, fixed_version):
if fixed_version:
return fixed_version
elif version:
m = version_pattern.match(version)
return m.group(1) + '.' + m.group(2) + '.' + (m.group(3) if m.group(3) is not None else '0')
else:
return mod_version
if len(sys.argv) < 2:
print('usage: ' + sys.argv[0] + ' dune.module [fixed_version]')
exit(1)
Module = None
Version = None
Depends = None
Suggests = None
with open(sys.argv[1]) as modulefile:
for line in modulefile:
dep = 'Depends'
sug = 'Suggests'
ver = 'Version'
mod = 'Module'
if line[0:len(dep)] == dep:
Depends = line[len(dep)+1:-1].strip()
elif line[0:len(sug)] == sug:
Suggests = line[len(sug)+1:-1].strip()
elif line[0:len(ver)] == ver:
Version = line[len(ver)+1:-1].strip()
elif line[0:len(mod)] == mod:
Module = line[len(mod)+1:-1].strip()
fixed_version = None
if len(sys.argv) > 2:
fixed_version = sys.argv[2]
Dependencies = []
if Depends:
m = depends_pattern.findall(Depends)
if m:
for g in m:
Dependencies.append((g[0],make_version(g[2],Version,fixed_version)))
if Suggests:
m = depends_pattern.findall(Suggests)
if m:
for g in m:
Dependencies.append((g[0],make_version(g[2],Version,fixed_version)))
for d in Dependencies:
print(" ('" + d[0] + "', '" + d[1] + "'),")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment