mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
Fix nightly (#7365)
- add some logic to setup.py to handle cross platform tagging correctly this adds a dependency on setuptools>=70 - rearrange the nightly CI to use these new builds correctly
This commit is contained in:
parent
5237e7def2
commit
0837e3b8e8
|
@ -183,7 +183,7 @@ stages:
|
||||||
- task: CopyFiles@2
|
- task: CopyFiles@2
|
||||||
inputs:
|
inputs:
|
||||||
sourceFolder: src/api/python/wheelhouse
|
sourceFolder: src/api/python/wheelhouse
|
||||||
contents: '*.zip'
|
contents: '*.whl'
|
||||||
targetFolder: $(Build.ArtifactStagingDirectory)
|
targetFolder: $(Build.ArtifactStagingDirectory)
|
||||||
- task: PublishPipelineArtifact@0
|
- task: PublishPipelineArtifact@0
|
||||||
inputs:
|
inputs:
|
||||||
|
@ -209,11 +209,11 @@ stages:
|
||||||
- script: echo $PATH
|
- script: echo $PATH
|
||||||
- script: "stat `which aarch64-none-linux-gnu-gcc`"
|
- script: "stat `which aarch64-none-linux-gnu-gcc`"
|
||||||
- script: "pip install build git+https://github.com/rhelmot/auditwheel"
|
- script: "pip install build git+https://github.com/rhelmot/auditwheel"
|
||||||
- script: "cd src/api/python && CC=aarch64-none-linux-gnu-gcc CXX=aarch64-none-linux-gnu-g++ AR=aarch64-none-linux-gnu-ar LD=aarch64-none-linux-gnu-ld python -m build && AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && cd ../../.."
|
- script: "cd src/api/python && CC=aarch64-none-linux-gnu-gcc CXX=aarch64-none-linux-gnu-g++ AR=aarch64-none-linux-gnu-ar LD=aarch64-none-linux-gnu-ld Z3_CROSS_COMPILING=aarch64 python -m build && AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && cd ../../.."
|
||||||
- task: CopyFiles@2
|
- task: CopyFiles@2
|
||||||
inputs:
|
inputs:
|
||||||
sourceFolder: src/api/python/wheelhouse
|
sourceFolder: src/api/python/wheelhouse
|
||||||
contents: '*.zip'
|
contents: '*.whl'
|
||||||
targetFolder: $(Build.ArtifactStagingDirectory)
|
targetFolder: $(Build.ArtifactStagingDirectory)
|
||||||
- task: PublishPipelineArtifact@0
|
- task: PublishPipelineArtifact@0
|
||||||
inputs:
|
inputs:
|
||||||
|
@ -504,21 +504,18 @@ stages:
|
||||||
targetPath: $(Agent.TempDirectory)
|
targetPath: $(Agent.TempDirectory)
|
||||||
- script: cd $(Agent.TempDirectory); mkdir osx-x64-bin; cd osx-x64-bin; unzip ../*x64-osx*.zip
|
- script: cd $(Agent.TempDirectory); mkdir osx-x64-bin; cd osx-x64-bin; unzip ../*x64-osx*.zip
|
||||||
- script: cd $(Agent.TempDirectory); mkdir osx-arm64-bin; cd osx-arm64-bin; unzip ../*arm64-osx*.zip
|
- script: cd $(Agent.TempDirectory); mkdir osx-arm64-bin; cd osx-arm64-bin; unzip ../*arm64-osx*.zip
|
||||||
- script: cd $(Agent.TempDirectory); mkdir libc-x64-bin; cd libc-x64-bin; unzip ../*x64-glibc*.zip
|
|
||||||
- script: cd $(Agent.TempDirectory); mkdir libc-arm64-bin; cd libc-arm64-bin; unzip ../*arm64-glibc*.zip
|
|
||||||
# - script: cd $(Agent.TempDirectory); mkdir musl-bin; cd musl-bin; unzip ../*-linux.zip
|
# - script: cd $(Agent.TempDirectory); mkdir musl-bin; cd musl-bin; unzip ../*-linux.zip
|
||||||
- script: cd $(Agent.TempDirectory); mkdir win32-bin; cd win32-bin; unzip ../*x86-win*.zip
|
- script: cd $(Agent.TempDirectory); mkdir win32-bin; cd win32-bin; unzip ../*x86-win*.zip
|
||||||
- script: cd $(Agent.TempDirectory); mkdir win64-bin; cd win64-bin; unzip ../*x64-win*.zip
|
- script: cd $(Agent.TempDirectory); mkdir win64-bin; cd win64-bin; unzip ../*x64-win*.zip
|
||||||
- script: python3 -m pip install --user -U setuptools wheel
|
- script: python3 -m pip install --user -U setuptools
|
||||||
- script: cd src/api/python; python3 setup.py sdist
|
- script: cd src/api/python; python3 setup.py sdist
|
||||||
# take a look at this PREMIUM HACK I came up with to get around the fact that the azure variable syntax overloads the bash syntax for subshells
|
# take a look at this PREMIUM HACK I came up with to get around the fact that the azure variable syntax overloads the bash syntax for subshells
|
||||||
- script: cd src/api/python; echo $(Agent.TempDirectory)/libc-x64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
|
||||||
- script: cd src/api/python; echo $(Agent.TempDirectory)/libc-arm64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
|
||||||
# - script: cd src/api/python; echo $(Agent.TempDirectory)/musl-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
# - script: cd src/api/python; echo $(Agent.TempDirectory)/musl-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
||||||
- script: cd src/api/python; echo $(Agent.TempDirectory)/win32-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
- script: cd src/api/python; echo $(Agent.TempDirectory)/win32-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
||||||
- script: cd src/api/python; echo $(Agent.TempDirectory)/win64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
- script: cd src/api/python; echo $(Agent.TempDirectory)/win64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
||||||
- script: cd src/api/python; echo $(Agent.TempDirectory)/osx-x64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
- script: cd src/api/python; echo $(Agent.TempDirectory)/osx-x64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
||||||
- script: cd src/api/python; echo $(Agent.TempDirectory)/osx-arm64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
- script: cd src/api/python; echo $(Agent.TempDirectory)/osx-arm64-bin/* | xargs printf 'PACKAGE_FROM_RELEASE=%s\n' | xargs -I '{}' env '{}' python3 setup.py bdist_wheel
|
||||||
|
- script: cp $(Agent.TempDirectory)/*.whl src/api/python/dist
|
||||||
- task: PublishPipelineArtifact@0
|
- task: PublishPipelineArtifact@0
|
||||||
inputs:
|
inputs:
|
||||||
artifactName: 'Python packages'
|
artifactName: 'Python packages'
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools>=59", "wheel", "cmake"]
|
requires = ["setuptools>=70", "cmake"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
|
@ -9,6 +9,7 @@ import glob
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from setuptools.command.build import build as _build
|
from setuptools.command.build import build as _build
|
||||||
from setuptools.command.sdist import sdist as _sdist
|
from setuptools.command.sdist import sdist as _sdist
|
||||||
|
from setuptools.command.bdist_wheel import bdist_wheel as _bdist_wheel
|
||||||
from setuptools.command.develop import develop as _develop
|
from setuptools.command.develop import develop as _develop
|
||||||
|
|
||||||
class LibError(Exception):
|
class LibError(Exception):
|
||||||
|
@ -31,6 +32,8 @@ if RELEASE_DIR is None:
|
||||||
HEADER_DIRS = [os.path.join(SRC_DIR, 'src', 'api'), os.path.join(SRC_DIR, 'src', 'api', 'c++')]
|
HEADER_DIRS = [os.path.join(SRC_DIR, 'src', 'api'), os.path.join(SRC_DIR, 'src', 'api', 'c++')]
|
||||||
RELEASE_METADATA = None
|
RELEASE_METADATA = None
|
||||||
BUILD_PLATFORM = sys.platform
|
BUILD_PLATFORM = sys.platform
|
||||||
|
BUILD_ARCH = os.environ.get("Z3_CROSS_COMPILING", platform.machine())
|
||||||
|
BUILD_OS_VERSION = platform.mac_ver()[0].split(".")
|
||||||
else:
|
else:
|
||||||
if not os.path.isdir(RELEASE_DIR):
|
if not os.path.isdir(RELEASE_DIR):
|
||||||
raise Exception("RELEASE_DIR (%s) is not a directory!" % RELEASE_DIR)
|
raise Exception("RELEASE_DIR (%s) is not a directory!" % RELEASE_DIR)
|
||||||
|
@ -41,6 +44,11 @@ else:
|
||||||
raise Exception("RELEASE_DIR (%s) must be in the format z3-version-arch-os[-osversion] so we can extract metadata from it. Sorry!" % RELEASE_DIR)
|
raise Exception("RELEASE_DIR (%s) must be in the format z3-version-arch-os[-osversion] so we can extract metadata from it. Sorry!" % RELEASE_DIR)
|
||||||
RELEASE_METADATA.pop(0)
|
RELEASE_METADATA.pop(0)
|
||||||
BUILD_PLATFORM = RELEASE_METADATA[2]
|
BUILD_PLATFORM = RELEASE_METADATA[2]
|
||||||
|
BUILD_ARCH = RELEASE_METADATA[1]
|
||||||
|
if len(RELEASE_METADATA) == 4:
|
||||||
|
BUILD_OS_VERSION = RELEASE_METADATA[3].split(".")
|
||||||
|
else:
|
||||||
|
BUILD_OS_VERSION = None
|
||||||
|
|
||||||
# determine where destinations are
|
# determine where destinations are
|
||||||
LIBS_DIR = os.path.join(ROOT_DIR, 'z3', 'lib')
|
LIBS_DIR = os.path.join(ROOT_DIR, 'z3', 'lib')
|
||||||
|
@ -242,21 +250,29 @@ class sdist(_sdist):
|
||||||
self.execute(_copy_sources, (), msg="Copying source files")
|
self.execute(_copy_sources, (), msg="Copying source files")
|
||||||
_sdist.run(self)
|
_sdist.run(self)
|
||||||
|
|
||||||
# platform.freedesktop_os_release was added in 3.10
|
class bdist_wheel(_bdist_wheel):
|
||||||
os_id = ''
|
def finalize_options(self):
|
||||||
if hasattr(platform, 'freedesktop_os_release'):
|
if BUILD_ARCH is not None and BUILD_PLATFORM is not None:
|
||||||
try:
|
os_version_tag = '_'.join(BUILD_OS_VERSION[:2]) if BUILD_OS_VERSION is not None else 'xxxxxx'
|
||||||
osr = platform.freedesktop_os_release()
|
TAGS = {
|
||||||
print(osr)
|
# linux tags cannot be deployed - they must be auditwheel'd to pick the right compatibility tag based on imported libc symbol versions
|
||||||
os_id = osr['ID']
|
("linux", "x86_64"): "linux_x86_64",
|
||||||
except OSError:
|
("linux", "aarch64"): "linux_aarch64",
|
||||||
pass
|
# windows arm64 is not supported by pypi yet
|
||||||
|
("win", "x64"): "win_amd64",
|
||||||
|
("win", "x86"): "win32",
|
||||||
|
("osx", "x64"): f"macosx_{os_version_tag}_x86_64",
|
||||||
|
("osx", "arm64"): f"macosx_{os_version_tag}_arm64",
|
||||||
|
} # type: dict[tuple[str, str], str]
|
||||||
|
self.plat_name = TAGS[(BUILD_PLATFORM, BUILD_ARCH)]
|
||||||
|
return super().finalize_options()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='z3-solver',
|
name='z3-solver',
|
||||||
version=_z3_version(),
|
version=_z3_version(),
|
||||||
description='an efficient SMT solver library',
|
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, compilation, or installation, please submit issues to https://github.com/z3prover/z3.git',
|
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',
|
||||||
author="The Z3 Theorem Prover Project",
|
author="The Z3 Theorem Prover Project",
|
||||||
maintainer="Audrey Dutcher and Nikolaj Bjorner",
|
maintainer="Audrey Dutcher and Nikolaj Bjorner",
|
||||||
maintainer_email="audrey@rhelmot.io",
|
maintainer_email="audrey@rhelmot.io",
|
||||||
|
@ -270,5 +286,5 @@ setup(
|
||||||
'z3': [os.path.join('lib', '*'), os.path.join('include', '*.h'), os.path.join('include', 'c++', '*.h')]
|
'z3': [os.path.join('lib', '*'), os.path.join('include', '*.h'), os.path.join('include', 'c++', '*.h')]
|
||||||
},
|
},
|
||||||
data_files=[('bin',[os.path.join('bin',EXECUTABLE_FILE)])],
|
data_files=[('bin',[os.path.join('bin',EXECUTABLE_FILE)])],
|
||||||
cmdclass={'build': build, 'develop': develop, 'sdist': sdist},
|
cmdclass={'build': build, 'develop': develop, 'sdist': sdist, 'bdist_wheel': bdist_wheel},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue