mirror of
https://github.com/Z3Prover/z3
synced 2025-08-11 21:50:52 +00:00
Fix ModuleNotFoundError by removing dynamic version loading from pyproject.toml
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
f7e89fcbeb
commit
d789a17898
3 changed files with 19 additions and 64 deletions
|
@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "z3-solver"
|
name = "z3-solver"
|
||||||
|
version = "4.15.3.0"
|
||||||
description = "an efficient SMT solver library"
|
description = "an efficient SMT solver library"
|
||||||
readme = "README.txt"
|
readme = "README.txt"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
@ -33,7 +34,6 @@ classifiers = [
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"importlib-resources; python_version < '3.9'"
|
"importlib-resources; python_version < '3.9'"
|
||||||
]
|
]
|
||||||
dynamic = ["version"]
|
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://github.com/Z3Prover/z3"
|
Homepage = "https://github.com/Z3Prover/z3"
|
||||||
|
@ -51,5 +51,4 @@ z3 = ["lib/*", "include/*.h", "include/c++/*.h"]
|
||||||
[tool.setuptools.data-files]
|
[tool.setuptools.data-files]
|
||||||
bin = ["bin/*"]
|
bin = ["bin/*"]
|
||||||
|
|
||||||
[tool.setuptools.dynamic]
|
|
||||||
version = {attr = "z3_version.__version__"}
|
|
||||||
|
|
|
@ -116,27 +116,22 @@ def _clean_native_build():
|
||||||
rmtree(BUILD_DIR)
|
rmtree(BUILD_DIR)
|
||||||
|
|
||||||
def _z3_version():
|
def _z3_version():
|
||||||
# Import version from z3_version module for consistency
|
# Get version from project metadata
|
||||||
try:
|
post = os.getenv('Z3_VERSION_SUFFIX', '')
|
||||||
from z3_version import get_version
|
if RELEASE_DIR is None:
|
||||||
return get_version()
|
fn = os.path.join(SRC_DIR, 'scripts', 'mk_project.py')
|
||||||
except ImportError:
|
if os.path.exists(fn):
|
||||||
# Fallback to original implementation
|
with open(fn) as f:
|
||||||
post = os.getenv('Z3_VERSION_SUFFIX', '')
|
for line in f:
|
||||||
if RELEASE_DIR is None:
|
n = re.match(r".*set_version\((.*), (.*), (.*), (.*)\).*", line)
|
||||||
fn = os.path.join(SRC_DIR, 'scripts', 'mk_project.py')
|
if not n is None:
|
||||||
if os.path.exists(fn):
|
return n.group(1) + '.' + n.group(2) + '.' + n.group(3) + '.' + n.group(4) + post
|
||||||
with open(fn) as f:
|
return "?.?.?.?"
|
||||||
for line in f:
|
else:
|
||||||
n = re.match(r".*set_version\((.*), (.*), (.*), (.*)\).*", line)
|
version = RELEASE_METADATA[0]
|
||||||
if not n is None:
|
if version.count('.') == 2:
|
||||||
return n.group(1) + '.' + n.group(2) + '.' + n.group(3) + '.' + n.group(4) + post
|
version += '.0'
|
||||||
return "?.?.?.?"
|
return version + post
|
||||||
else:
|
|
||||||
version = RELEASE_METADATA[0]
|
|
||||||
if version.count('.') == 2:
|
|
||||||
version += '.0'
|
|
||||||
return version + post
|
|
||||||
|
|
||||||
def _configure_z3():
|
def _configure_z3():
|
||||||
global IS_SINGLE_THREADED
|
global IS_SINGLE_THREADED
|
||||||
|
@ -335,6 +330,7 @@ class bdist_wheel(_bdist_wheel):
|
||||||
setup(
|
setup(
|
||||||
# Most configuration is now in pyproject.toml
|
# Most configuration is now in pyproject.toml
|
||||||
# Keep only setup.py-specific configuration
|
# Keep only setup.py-specific configuration
|
||||||
|
version=_z3_version(),
|
||||||
setup_requires = SETUP_REQUIRES,
|
setup_requires = SETUP_REQUIRES,
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
package_data={
|
package_data={
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
"""
|
|
||||||
Version detection for z3-solver package.
|
|
||||||
"""
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
def get_version():
|
|
||||||
"""Get the z3 version from the source tree."""
|
|
||||||
post = os.getenv('Z3_VERSION_SUFFIX', '')
|
|
||||||
|
|
||||||
# Determine where the source directory is located
|
|
||||||
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
SRC_DIR_LOCAL = os.path.join(ROOT_DIR, 'core')
|
|
||||||
SRC_DIR_REPO = os.path.join(ROOT_DIR, '..', '..', '..')
|
|
||||||
SRC_DIR = SRC_DIR_LOCAL if os.path.exists(SRC_DIR_LOCAL) else SRC_DIR_REPO
|
|
||||||
|
|
||||||
# Check if we're using a release directory
|
|
||||||
RELEASE_DIR = os.environ.get('PACKAGE_FROM_RELEASE', None)
|
|
||||||
|
|
||||||
if RELEASE_DIR is None:
|
|
||||||
fn = os.path.join(SRC_DIR, 'scripts', 'mk_project.py')
|
|
||||||
if os.path.exists(fn):
|
|
||||||
with open(fn) as f:
|
|
||||||
for line in f:
|
|
||||||
n = re.match(r".*set_version\((.*), (.*), (.*), (.*)\).*", line)
|
|
||||||
if not n is None:
|
|
||||||
return n.group(1) + '.' + n.group(2) + '.' + n.group(3) + '.' + n.group(4) + post
|
|
||||||
return "4.15.3.0" + post # fallback version
|
|
||||||
else:
|
|
||||||
RELEASE_METADATA = os.path.basename(RELEASE_DIR).split('-')
|
|
||||||
if RELEASE_METADATA[0] == 'z3' and len(RELEASE_METADATA) >= 4:
|
|
||||||
RELEASE_METADATA.pop(0)
|
|
||||||
version = RELEASE_METADATA[0]
|
|
||||||
if version.count('.') == 2:
|
|
||||||
version += '.0'
|
|
||||||
return version + post
|
|
||||||
return "4.15.3.0" + post # fallback version
|
|
||||||
|
|
||||||
# Make version available at module level
|
|
||||||
__version__ = get_version()
|
|
Loading…
Add table
Add a link
Reference in a new issue