Fix the python interface (bz 1910923).

This commit is contained in:
Jerry James 2020-12-26 07:44:31 -07:00
parent 259befebd7
commit a7058774ee
2 changed files with 30 additions and 2 deletions

21
z3-python.patch Normal file
View File

@ -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 = []

11
z3.spec
View File

@ -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 <loganjerry@gmail.com> - 4.8.9-4
- Fix the python interface (bz 1910923)
* Mon Nov 16 2020 Jerry James <loganjerry@gmail.com> - 4.8.9-3
- Rebuild for ocaml-zarith 1.11