From dc29bbe7e3063217beaf90dba7f607da152d7667 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Sat, 26 Dec 2020 07:44:31 -0700 Subject: [PATCH] Fix the python interface (bz 1910923). --- z3-python.patch | 21 +++++++++++++++++++++ z3.spec | 11 +++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 z3-python.patch diff --git a/z3-python.patch b/z3-python.patch new file mode 100644 index 0000000..c26dd68 --- /dev/null +++ b/z3-python.patch @@ -0,0 +1,21 @@ +--- a/scripts/update_api.py 2020-09-10 12:51:28.000000000 -0600 ++++ b/scripts/update_api.py 2020-12-25 17:03:00.196777823 -0700 +@@ -1755,15 +1755,15 @@ def write_core_py_preamble(core_py): + # Automatically generated file + import sys, os + import ctypes +-import pkg_resources ++import sysconfig + from .z3types import * + from .z3consts import * + +-_ext = 'dll' if sys.platform in ('win32', 'cygwin') else 'dylib' if sys.platform == 'darwin' else 'so' ++_ext = 'dll' if sys.platform in ('win32', 'cygwin') else 'dylib' if sys.platform == 'darwin' else 'so.@MAJVER@' + _lib = None + _default_dirs = ['.', + os.path.dirname(os.path.abspath(__file__)), +- pkg_resources.resource_filename('z3', 'lib'), ++ sysconfig.get_config_var('LIBDIR'), + os.path.join(sys.prefix, 'lib'), + None] + _all_dirs = [] diff --git a/z3.spec b/z3.spec index 3e0dc73..336c95c 100644 --- a/z3.spec +++ b/z3.spec @@ -1,11 +1,13 @@ Name: z3 Version: 4.8.9 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Satisfiability Modulo Theories (SMT) solver License: MIT URL: https://github.com/Z3Prover/z3 Source0: https://github.com/Z3Prover/z3/archive/%{name}-%{version}.tar.gz +# Change the way python finds the shared object; see bz 1910923 +Patch0: %{name}-python.patch BuildRequires: cmake BuildRequires: doxygen @@ -100,8 +102,10 @@ sed \ -e "s/OCAML_FLAGS = ''/OCAML_FLAGS = '-g'/" \ -i scripts/mk_util.py -# Comply with the Java packaging guidelines +# Comply with the Java packaging guidelines and fill in the version for python +majver=$(cut -d. -f-2 <<< %{version}) sed -e '/libz3java/s,\(System\.load\)Library("\(.*\)"),\1("%{_libdir}/z3/\2.so"),' \ + -e "s/@MAJVER@/$majver/" \ -i scripts/update_api.py # Update an OCaml interface @@ -227,6 +231,9 @@ help2man -N -o %{buildroot}%{_mandir}/man1/%{name}.1 %{_vpath_builddir}/%{name} %{python3_sitelib}/%{name}/ %changelog +* Fri Dec 25 2020 Jerry James - 4.8.9-4 +- Fix the python interface (bz 1910923) + * Mon Nov 16 2020 Jerry James - 4.8.9-3 - Rebuild for ocaml-zarith 1.11