From fa52b1b7eb90679e10c9a873553c8703e1030616 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Tue, 2 May 2017 18:31:56 +0200 Subject: [PATCH] alias stormpy types for rationals and rational functions --- lib/stormpy/__init__.py | 2 +- setup.py | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/lib/stormpy/__init__.py b/lib/stormpy/__init__.py index c18038a..f70697c 100644 --- a/lib/stormpy/__init__.py +++ b/lib/stormpy/__init__.py @@ -3,7 +3,7 @@ from .core import * from . import storage from .storage import * from .version import __version__ -import stormpy.logic +from ._config import * from pycarl import Variable # needed for building parametric models diff --git a/setup.py b/setup.py index 1a6c681..9a2dd58 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,6 @@ import os import sys import subprocess -import re import datetime from setuptools import setup, Extension @@ -70,7 +69,32 @@ class CMakeBuild(build_ext): for ext in self.extensions: - if ext.name == "info": + if ext.name == "core": + 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("import pycarl\n") + if self.conf.STORM_CLN_EA or self.conf.STORM_CLN_RF: + f.write("import pycarl.cln\n") + if not self.conf.STORM_CLN_EA or not self.conf.STORM_CLN_RF: + f.write("import pycarl.gmp\n") + + if self.conf.STORM_CLN_EA: + f.write("Rational = pycarl.cln.Rational\n") + else: + f.write("Rational = pycarl.gmp.Rational\n") + + if self.conf.STORM_CLN_RF: + rfpackage = "cln" + else: + rfpackage = "gmp" + f.write("RationalRF = pycarl.{}.Rational\n".format(rfpackage)) + f.write("Polynomial = pycarl.{}.Polynomial\n".format(rfpackage)) + f.write("FactorizedPolynomial = pycarl.{}.FactorizedPolynomial\n".format(rfpackage)) + f.write("RationalFunction = pycarl.{}.RationalFunction\n".format(rfpackage)) + f.write("FactorizedRationalFunction = pycarl.{}.FactorizedRationalFunction\n".format(rfpackage)) + + elif ext.name == "info": 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("storm_version = {}\n".format(self.conf.STORM_VERSION)) @@ -132,7 +156,7 @@ class PyTest(test): setup( name="stormpy", - version="0.9", + version="0.9.1", author="M. Volk", author_email="matthias.volk@cs.rwth-aachen.de", maintainer="S. Junges", @@ -152,6 +176,6 @@ setup( ], cmdclass={'build_ext': CMakeBuild, 'test': PyTest}, zip_safe=False, - install_requires=['pycarl>=1.2.0'], + install_requires=['pycarl>=2.0.0'], tests_require=['pytest'], )