Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Installers: Simpler version check via subprocess
- Loading branch information
1 parent
526ba50
commit e80fbba
Showing
9 changed files
with
162 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Copyright 2014 Andrea Micheli and Marco Gario | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import sys | ||
import re | ||
|
||
|
||
def check_version(module): | ||
try: | ||
if module == "z3": | ||
import z3 | ||
(major, minor, ver, _) = z3.get_version() | ||
version = "%d.%d.%d" % (major, minor, ver) | ||
|
||
elif module == "msat": | ||
import mathsat | ||
version_str = mathsat.msat_get_version() | ||
m = re.match(r"^MathSAT5 version (\d+\.\d+\.\d+) .*$", version_str) | ||
if m is not None: | ||
version = m.group(1) | ||
|
||
elif module == "cudd": | ||
import repycudd | ||
doc = repycudd.DOCSTRING | ||
m = re.match(r"^PyCUDD (\d+\.\d+\.\d+).*", doc) | ||
if m is not None: | ||
version = m.group(1) | ||
|
||
elif module == "btor": | ||
import boolector | ||
version = "OK" # Just checking if import succeeds | ||
|
||
elif module == "cvc4": | ||
import CVC4 | ||
version = CVC4.Configuration_getVersionString() | ||
|
||
elif module == "picosat": | ||
import picosat | ||
version = picosat.picosat_version() | ||
|
||
elif module == "yices": | ||
import yicespy | ||
v = yicespy.__dict__['__YICES_VERSION'] | ||
m = yicespy.__dict__['__YICES_VERSION_MAJOR'] | ||
p = yicespy.__dict__['__YICES_VERSION_PATCHLEVEL'] | ||
version = "%d.%d.%d" % (v, m, p) | ||
|
||
except ImportError: | ||
version = None | ||
|
||
return version | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 2: | ||
print("Usage: python %s <solver_name>" % sys.argv[0]) | ||
exit(-1) | ||
|
||
module = sys.argv[1] | ||
version = check_version(module) | ||
|
||
if version is None: | ||
print("NOT INSTALLED") | ||
else: | ||
print(version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.