diff --git a/python_bindings/CMakeLists.txt b/python_bindings/CMakeLists.txt index 4fce89d..3310ebb 100644 --- a/python_bindings/CMakeLists.txt +++ b/python_bindings/CMakeLists.txt @@ -66,22 +66,17 @@ add_definitions(${LLVM_DEFINITIONS}) mlir_configure_python_dev_packages() -add_mlir_python_common_capi_library( - MLIRPythonCAPI - INSTALL_COMPONENT - MLIRPythonModules - INSTALL_DESTINATION - mlir/_mlir_libs - OUTPUT_DIRECTORY - "${MLIR_BINARY_DIR}/mlir/_mlir_libs" - RELATIVE_INSTALL_ROOT - "../../../.." +add_mlir_python_common_capi_library(MLIRPythonCAPI + INSTALL_COMPONENT MLIRPythonModules + INSTALL_DESTINATION mlir/_mlir_libs + OUTPUT_DIRECTORY "${MLIR_BINARY_DIR}/mlir/_mlir_libs" + RELATIVE_INSTALL_ROOT "../../../.." DECLARED_HEADERS - MLIRPythonCAPI.HeaderSources + MLIRPythonCAPI.HeaderSources DECLARED_SOURCES - MLIRPythonSources - MLIRPythonExtension.RegisterEverything - ${_ADDL_TEST_SOURCES}) + MLIRPythonSources + MLIRPythonExtension.RegisterEverything +) # ############################################################################## # Custom targets. @@ -98,15 +93,12 @@ endif() # The fully assembled package of modules. This must come last. # ############################################################################## -add_mlir_python_modules( - MLIRPythonModules - ROOT_PREFIX - "${MLIR_BINARY_DIR}/mlir" - INSTALL_PREFIX - "mlir" +add_mlir_python_modules(MLIRPythonModules + ROOT_PREFIX "${MLIR_BINARY_DIR}/mlir" + INSTALL_PREFIX "mlir" DECLARED_SOURCES - MLIRPythonSources - MLIRPythonExtension.RegisterEverything - ${_ADDL_TEST_SOURCES} + MLIRPythonSources + MLIRPythonExtension.RegisterEverything COMMON_CAPI_LINK_LIBS - MLIRPythonCAPI) + MLIRPythonCAPI +) diff --git a/python_bindings/setup.py b/python_bindings/setup.py index 6e4b2c3..163744c 100644 --- a/python_bindings/setup.py +++ b/python_bindings/setup.py @@ -83,6 +83,10 @@ def build_extension(self, ext: CMakeExtension) -> None: f"-DCMAKE_INSTALL_PREFIX={install_dir}", f"-DPython3_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm + # prevent symbol collision that leads to multiple pass registration and such + "-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON", + "-DCMAKE_C_VISIBILITY_PRESET=hidden", + "-DCMAKE_CXX_VISIBILITY_PRESET=hidden", ] if platform.system() == "Windows": cmake_args += [ diff --git a/scripts/gh_releases.py b/scripts/gh_releases.py index 6cbc7d3..6f7eb57 100644 --- a/scripts/gh_releases.py +++ b/scripts/gh_releases.py @@ -1,29 +1,50 @@ +import os +import time + from github import Github +import datetime # Authentication is defined via github.Auth from github import Auth # using an access token -auth = Auth.Token("Personal access tokens (classic)") +auth = Auth.Token(os.environ["GITHUB_API_TOKEN"]) + +twomonthsago = datetime.date.today() - datetime.timedelta(days=30) # First create a Github instance: # Public Web Github g = Github(auth=auth) -repo = g.get_repo("makslevental/wheels") -release = repo.get_release(113028511) -assets = release.get_assets() -for ass in assets: - if "18.0.0.20230907" in ass.name: - print(ass.name) - assert ass.delete_asset() - - -repo = g.get_repo("makslevental/mlir-wheels") -release = repo.get_release(111725799) -assets = release.get_assets() -for ass in assets: - if "18.0.0.20230907" in ass.name: - print(ass.name) - assert ass.delete_asset() +n_deleted = 0 +for _ in range(100): + n_deleted = 0 + repo = g.get_repo("makslevental/wheels") + release = repo.get_release(113028511) + assets = release.get_assets() + for ass in assets: + if "35ca6498" in ass.name: + continue + if ass.created_at.date() < twomonthsago: + print(ass.name) + assert ass.delete_asset() + n_deleted += 1 + + repo = g.get_repo("makslevental/mlir-wheels") + release = repo.get_release(111725799) + assets = release.get_assets() + for ass in assets: + if "35ca6498" in ass.name: + continue + if ass.created_at.date() < twomonthsago: + print(ass.name) + assert ass.delete_asset() + n_deleted += 1 + + if n_deleted == 0: + break + time.sleep(5) + +if n_deleted > 0: + raise Exception("missed some") diff --git a/setup.py b/setup.py index f71d073..35f39d0 100644 --- a/setup.py +++ b/setup.py @@ -118,6 +118,10 @@ def build_extension(self, ext: CMakeExtension) -> None: f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}", f"-DPython3_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm + # prevent symbol collision that leads to multiple pass registration and such + "-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON", + "-DCMAKE_C_VISIBILITY_PRESET=hidden", + "-DCMAKE_CXX_VISIBILITY_PRESET=hidden", ] if platform.system() == "Windows": cmake_args += [