| 
					
					
						
							
						
					
					
				 | 
				@ -4,6 +4,7 @@ import multiprocessing | 
			
		
		
	
		
			
				 | 
				 | 
				import sys | 
				 | 
				 | 
				import sys | 
			
		
		
	
		
			
				 | 
				 | 
				import subprocess | 
				 | 
				 | 
				import subprocess | 
			
		
		
	
		
			
				 | 
				 | 
				import datetime | 
				 | 
				 | 
				import datetime | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				import re | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				from setuptools import setup, Extension | 
				 | 
				 | 
				from setuptools import setup, Extension | 
			
		
		
	
		
			
				 | 
				 | 
				from setuptools.command.build_ext import build_ext | 
				 | 
				 | 
				from setuptools.command.build_ext import build_ext | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -17,14 +18,42 @@ if sys.version_info[0] == 2: | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				def check_storm_compatible(storm_v_major, storm_v_minor, storm_v_patch): | 
				 | 
				 | 
				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): | 
				 | 
				 | 
				    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)) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        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): | 
				 | 
				 | 
				def parse_storm_version(version_string): | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    """ | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    Parses the version of storm. | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    :param version_string: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    :return: Version as three-tuple. | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    """ | 
			
		
		
	
		
			
				 | 
				 | 
				    elems = version_string.split(".") | 
				 | 
				 | 
				    elems = version_string.split(".") | 
			
		
		
	
		
			
				 | 
				 | 
				    if len(elems) != 3: | 
				 | 
				 | 
				    if len(elems) != 3: | 
			
		
		
	
		
			
				 | 
				 | 
				        sys.exit('Storm version string is ill-formed: "{}"'.format(version_string)) | 
				 | 
				 | 
				        sys.exit('Storm version string is ill-formed: "{}"'.format(version_string)) | 
			
		
		
	
		
			
				 | 
				 | 
				    return int(elems[0]), int(elems[1]), int(elems[2]) | 
				 | 
				 | 
				    return int(elems[0]), int(elems[1]), int(elems[2]) | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				def obtain_version(): | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    """ | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    Obtains the version as specified in stormpy. | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    :return: Version of stormpy. | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    """ | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    verstr = "unknown" | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    try: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        verstrline = open('lib/stormpy/_version.py', "rt").read() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    except EnvironmentError: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        pass  # Okay, there is no version file. | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    else: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        mo = re.search(VSRE, verstrline, re.M) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        if mo: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            verstr = mo.group(1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        else: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            raise RuntimeError("unable to find version in stormpy/_version.py") | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    return verstr | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				class CMakeExtension(Extension): | 
				 | 
				 | 
				class CMakeExtension(Extension): | 
			
		
		
	
		
			
				 | 
				 | 
				    def __init__(self, name, sourcedir='', subdir=''): | 
				 | 
				 | 
				    def __init__(self, name, sourcedir='', subdir=''): | 
			
		
		
	
		
			
				 | 
				 | 
				        Extension.__init__(self, name, sources=[]) | 
				 | 
				 | 
				        Extension.__init__(self, name, sources=[]) | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -32,7 +61,6 @@ class CMakeExtension(Extension): | 
			
		
		
	
		
			
				 | 
				 | 
				        self.subdir = subdir | 
				 | 
				 | 
				        self.subdir = subdir | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				class CMakeBuild(build_ext): | 
				 | 
				 | 
				class CMakeBuild(build_ext): | 
			
		
		
	
		
			
				 | 
				 | 
				    user_options = build_ext.user_options + [ | 
				 | 
				 | 
				    user_options = build_ext.user_options + [ | 
			
		
		
	
		
			
				 | 
				 | 
				        ('storm-dir=', None, 'Path to storm root (binary) location'), | 
				 | 
				 | 
				        ('storm-dir=', None, 'Path to storm root (binary) location'), | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -40,7 +68,6 @@ class CMakeBuild(build_ext): | 
			
		
		
	
		
			
				 | 
				 | 
				        ('debug', None, 'Build in Debug mode'), | 
				 | 
				 | 
				        ('debug', None, 'Build in Debug mode'), | 
			
		
		
	
		
			
				 | 
				 | 
				    ] | 
				 | 
				 | 
				    ] | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    def extdir(self, extname): | 
				 | 
				 | 
				    def extdir(self, extname): | 
			
		
		
	
		
			
				 | 
				 | 
				        return os.path.abspath(os.path.dirname(self.get_ext_fullpath(extname))) | 
				 | 
				 | 
				        return os.path.abspath(os.path.dirname(self.get_ext_fullpath(extname))) | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -61,7 +88,8 @@ class CMakeBuild(build_ext): | 
			
		
		
	
		
			
				 | 
				 | 
				        if self.storm_dir is not None: | 
				 | 
				 | 
				        if self.storm_dir is not None: | 
			
		
		
	
		
			
				 | 
				 | 
				            cmake_args = ['-Dstorm_DIR=' + self.storm_dir] | 
				 | 
				 | 
				            cmake_args = ['-Dstorm_DIR=' + self.storm_dir] | 
			
		
		
	
		
			
				 | 
				 | 
				        output = subprocess.check_output(['cmake', os.path.abspath("cmake")] + cmake_args, cwd=build_temp_version) | 
				 | 
				 | 
				        output = subprocess.check_output(['cmake', os.path.abspath("cmake")] + cmake_args, cwd=build_temp_version) | 
			
		
		
	
		
			
				 | 
				 | 
				        spec = importlib.util.spec_from_file_location("genconfig", os.path.join(build_temp_version, 'generated/config.py')) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        spec = importlib.util.spec_from_file_location("genconfig", | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                                      os.path.join(build_temp_version, 'generated/config.py')) | 
			
		
		
	
		
			
				 | 
				 | 
				        self.conf = importlib.util.module_from_spec(spec) | 
				 | 
				 | 
				        self.conf = importlib.util.module_from_spec(spec) | 
			
		
		
	
		
			
				 | 
				 | 
				        spec.loader.exec_module(self.conf) | 
				 | 
				 | 
				        spec.loader.exec_module(self.conf) | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -103,7 +131,7 @@ class CMakeBuild(build_ext): | 
			
		
		
	
		
			
				 | 
				 | 
				            elif ext.name == "info": | 
				 | 
				 | 
				            elif 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_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 == "pars": | 
				 | 
				 | 
				            elif ext.name == "pars": | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -122,7 +150,6 @@ class CMakeBuild(build_ext): | 
			
		
		
	
		
			
				 | 
				 | 
				                    continue | 
				 | 
				 | 
				                    continue | 
			
		
		
	
		
			
				 | 
				 | 
				            self.build_extension(ext) | 
				 | 
				 | 
				            self.build_extension(ext) | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    def initialize_options(self): | 
				 | 
				 | 
				    def initialize_options(self): | 
			
		
		
	
		
			
				 | 
				 | 
				        build_ext.initialize_options(self) | 
				 | 
				 | 
				        build_ext.initialize_options(self) | 
			
		
		
	
		
			
				 | 
				 | 
				        self.storm_dir = None | 
				 | 
				 | 
				        self.storm_dir = None | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -174,7 +201,7 @@ class PyTest(test): | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				setup( | 
				 | 
				 | 
				setup( | 
			
		
		
	
		
			
				 | 
				 | 
				    name="stormpy", | 
				 | 
				 | 
				    name="stormpy", | 
			
		
		
	
		
			
				 | 
				 | 
				    version="0.9.1", | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    version=obtain_version(), | 
			
		
		
	
		
			
				 | 
				 | 
				    author="M. Volk", | 
				 | 
				 | 
				    author="M. Volk", | 
			
		
		
	
		
			
				 | 
				 | 
				    author_email="matthias.volk@cs.rwth-aachen.de", | 
				 | 
				 | 
				    author_email="matthias.volk@cs.rwth-aachen.de", | 
			
		
		
	
		
			
				 | 
				 | 
				    maintainer="S. Junges", | 
				 | 
				 | 
				    maintainer="S. Junges", | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
					
				 | 
				
  |