Browse Source

Check for storm version.

refactoring
Sebastian Junges 8 years ago
parent
commit
601be9876c
  1. 2
      cmake/CMakeLists.txt
  2. 1
      cmake/config.py.in
  3. 15
      setup.py

2
cmake/CMakeLists.txt

@ -13,6 +13,7 @@ endif()
# Set configuration # Set configuration
set(STORM_DIR ${storm_DIR}) set(STORM_DIR ${storm_DIR})
set(STORM_VERSION ${storm_VERSION})
if(HAVE_STORM_DFT) if(HAVE_STORM_DFT)
set(HAVE_STORM_DFT_BOOL "True") set(HAVE_STORM_DFT_BOOL "True")
@ -34,4 +35,5 @@ endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.in ${CMAKE_CURRENT_BINARY_DIR}/generated/config.py @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.in ${CMAKE_CURRENT_BINARY_DIR}/generated/config.py @ONLY)

1
cmake/config.py.in

@ -1,6 +1,7 @@
# Auto-generated by Cmake. # Auto-generated by Cmake.
STORM_DIR = "@STORM_DIR@" STORM_DIR = "@STORM_DIR@"
STORM_VERSION = "@STORM_VERSION@"
STORM_CLN_EA = @STORM_CLN_EA_BOOL@ STORM_CLN_EA = @STORM_CLN_EA_BOOL@
STORM_CLN_RF = @STORM_CLN_RF_BOOL@ STORM_CLN_RF = @STORM_CLN_RF_BOOL@
HAVE_STORM_DFT = @HAVE_STORM_DFT_BOOL@ HAVE_STORM_DFT = @HAVE_STORM_DFT_BOOL@

15
setup.py

@ -9,12 +9,21 @@ from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
from setuptools.command.test import test from setuptools.command.test import test
import importlib.util
if sys.version_info[0] == 2: if sys.version_info[0] == 2:
sys.exit('Sorry, Python 2.x is not supported') sys.exit('Sorry, Python 2.x is not supported')
import importlib.util
def check_storm_compatible(storm_v_major, storm_v_minor, storm_v_patch):
if storm_v_major < 1 or (storm_v_major == 1 and storm_v_minor == 0 and storm_v_patch < 1):
sys.exit('Sorry, Storm version {}.{}.{} is not supported anymore!'.format(storm_v_major, storm_v_minor, storm_v_patch))
def parse_storm_version(version_string):
elems = version_string.split(".")
if len(elems) != 3:
sys.exit('Storm version string is ill-formed: "{}"'.format(version_string))
return int(elems[0]), int(elems[1]), int(elems[2])
class CMakeExtension(Extension): class CMakeExtension(Extension):
def __init__(self, name, sourcedir='', subdir=''): def __init__(self, name, sourcedir='', subdir=''):
@ -55,7 +64,8 @@ class CMakeBuild(build_ext):
spec.loader.exec_module(self.conf) spec.loader.exec_module(self.conf)
print(self.conf.HAVE_STORM_DFT) print(self.conf.HAVE_STORM_DFT)
storm_v_major, storm_v_minor, storm_v_patch = parse_storm_version(self.conf.STORM_VERSION)
check_storm_compatible(storm_v_major, storm_v_minor, storm_v_patch)
@ -63,6 +73,7 @@ class CMakeBuild(build_ext):
if ext.name == "info": if ext.name == "info":
with open(os.path.join(self.extdir(ext.name), ext.subdir, "_config.py"), "w") as f: with open(os.path.join(self.extdir(ext.name), ext.subdir, "_config.py"), "w") as f:
f.write("# Generated from setup.py at {}\n".format(datetime.datetime.now())) f.write("# Generated from setup.py at {}\n".format(datetime.datetime.now()))
f.write("storm_version = {}\n".format(self.conf.STORM_VERSION))
f.write("storm_cln_ea = {}\n".format(self.conf.STORM_CLN_EA)) f.write("storm_cln_ea = {}\n".format(self.conf.STORM_CLN_EA))
f.write("storm_cln_rf = {}".format(self.conf.STORM_CLN_RF)) f.write("storm_cln_rf = {}".format(self.conf.STORM_CLN_RF))
elif ext.name == "dft": elif ext.name == "dft":

Loading…
Cancel
Save