From a91531c04c7a0dd184f8b7b3111314f63b629959 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Sat, 28 Jul 2018 17:54:32 -0700 Subject: [PATCH 1/6] Stub z3test.py for pydistrib --- src/api/python/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index 24ba59ac2..a2b312e6d 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -118,6 +118,7 @@ def _copy_sources(): os.mkdir(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python')) os.mkdir(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python', 'z3')) open(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python', 'z3', '.placeholder'), 'w').close() + open(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python', 'z3test.py'), 'w').close() class build(_build): def run(self): From 64eaf6cb01cce2dc8302abc11f714df1a7aa9a43 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Sat, 28 Jul 2018 17:55:02 -0700 Subject: [PATCH 2/6] Add bdist_wheel tag renaming blurb --- src/api/python/setup.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index a2b312e6d..bc383c632 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -6,6 +6,7 @@ import subprocess import multiprocessing import re from setuptools import setup +from distutils.util import get_platform from distutils.errors import LibError from distutils.command.build import build as _build from distutils.command.sdist import sdist as _sdist @@ -149,6 +150,26 @@ class sdist(_sdist): #try: os.makedirs(os.path.join(ROOT_DIR, 'build')) #except OSError: pass +if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv: + idx = sys.argv.index('bdist_wheel') + 1 + sys.argv.insert(idx, '--plat-name') + name = get_platform() + if 'linux' in name: + # linux_* platform tags are disallowed because the python ecosystem is fubar + # linux builds should be built in the centos 5 vm for maximum compatibility + # see https://github.com/pypa/manylinux + # see also https://github.com/angr/angr-dev/blob/master/bdist.sh + sys.argv.insert(idx + 1, 'manylinux1_' + platform.machine()) + elif 'mingw' in name: + if platform.architecture()[0] == '64bit': + sys.argv.insert(idx + 1, 'win_amd64') + else: + sys.argv.insert(idx + 1, 'win32') + else: + # https://www.python.org/dev/peps/pep-0425/ + sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_')) + + setup( name='z3-solver', version=_z3_version(), From 42af36563e98c52f37a2a741c483efbf41a594b3 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Sat, 28 Jul 2018 17:55:16 -0700 Subject: [PATCH 3/6] Autogenerate list of header files --- src/api/python/setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index bc383c632..c9e7ea9f4 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -98,7 +98,10 @@ def _copy_bins(): os.mkdir(os.path.join(HEADERS_DIR, 'c++')) shutil.copy(os.path.join(BUILD_DIR, LIBRARY_FILE), LIBS_DIR) shutil.copy(os.path.join(BUILD_DIR, EXECUTABLE_FILE), BINS_DIR) - for fname in ('z3.h', 'z3_v1.h', 'z3_macros.h', 'z3_api.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h', 'z3_interp.h', 'z3_fpa.h', os.path.join('c++', 'z3++.h')): + + header_files = [x for x in os.listdir(os.path.join(SRC_DIR, 'src', 'api')) if x.endswith('.h')] + header_files += [os.path.join('c++', x) for x in os.listdir(os.path.join(SRC_DIR, 'src', 'api', 'c++')) if x.endswith('.h')] + for fname in header_files: shutil.copy(os.path.join(SRC_DIR, 'src', 'api', fname), os.path.join(HEADERS_DIR, fname)) def _copy_sources(): From a7f7872f45584dbd7848fa0c4043eac9b7c4a11d Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Sat, 28 Jul 2018 18:05:58 -0700 Subject: [PATCH 4/6] Update maintainer info --- src/api/python/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index c9e7ea9f4..07fc6e866 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -179,8 +179,8 @@ setup( description='an efficient SMT solver library', long_description='Z3 is a theorem prover from Microsoft Research with support for bitvectors, booleans, arrays, floating point numbers, strings, and other data types.\n\nFor documentation, please read http://z3prover.github.io/api/html/z3.html\n\nIn the event of technical difficulties related to configuration, compiliation, or installation, please submit issues to https://github.com/angr/angr-z3', author="The Z3 Theorem Prover Project", - maintainer="Andrew Dutcher", - maintainer_email="andrew@andrewdutcher.com", + maintainer="Audrey Dutcher", + maintainer_email="audrey@rhelmot.io", url='https://github.com/Z3Prover/z3', license='MIT License', keywords=['z3', 'smt', 'sat', 'prover', 'theorem'], From d74edbcb2b7342743a32b0829b2a6e3cf35cf5a6 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Sat, 28 Jul 2018 18:11:11 -0700 Subject: [PATCH 5/6] Add environment variable for controlling version suffixes --- src/api/python/setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index 07fc6e866..0aed1e5ab 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -46,13 +46,14 @@ def _clean_bins(): shutil.rmtree(HEADERS_DIR, ignore_errors=True) def _z3_version(): + post = os.getenv('Z3_VERSION_SUFFIX', '') fn = os.path.join(SRC_DIR, 'scripts', 'mk_project.py') - if os.path.exists(fn): + if os.path.exists(fn): with open(fn) as f: for line in f: n = re.match(".*set_version\((.*), (.*), (.*), (.*)\).*", line) if not n is None: - return n.group(1) + '.' + n.group(2) + '.' + n.group(3) + '.' + n.group(4) + return n.group(1) + '.' + n.group(2) + '.' + n.group(3) + '.' + n.group(4) + post return "?.?.?.?" def _configure_z3(): From 310de49d2b646105114f8e8761cbf0f9e7972b03 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Sat, 28 Jul 2018 18:56:40 -0700 Subject: [PATCH 6/6] Update link to reference high-compatibility build script --- src/api/python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index 0aed1e5ab..bce681584 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -162,7 +162,7 @@ if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv: # linux_* platform tags are disallowed because the python ecosystem is fubar # linux builds should be built in the centos 5 vm for maximum compatibility # see https://github.com/pypa/manylinux - # see also https://github.com/angr/angr-dev/blob/master/bdist.sh + # see also https://github.com/angr/angr-dev/blob/master/admin/bdist.py sys.argv.insert(idx + 1, 'manylinux1_' + platform.machine()) elif 'mingw' in name: if platform.architecture()[0] == '64bit':