Skip to content

Commit

Permalink
Strip .egg-info folders from iree-base-compiler whl files.
Browse files Browse the repository at this point in the history
The `.egg-info/PKG-INFO` file is not handled by `promote_whl_from_rc_to_final.py` (since the underlying `change_wheel_version` package doesn't handle it), resulting in partial version promotions.
  • Loading branch information
ScottTodd committed Nov 15, 2024
1 parent d497571 commit 0fb983e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build_tools/python_deploy/build_linux_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function run_in_docker() {
;;
iree-base-compiler)
clean_wheels "iree_base_compiler${package_suffix}" "${python_version}"
install_deps "iree_base_runtime${package_suffix}" "${python_version}"
install_deps "iree_base_compiler${package_suffix}" "${python_version}"
build_iree_compiler
run_audit_wheel "iree_base_compiler${package_suffix}" "${python_version}"
;;
Expand Down
22 changes: 22 additions & 0 deletions compiler/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from gettext import install
import json
from multiprocessing.spawn import prepare
from pathlib import Path
import os
import platform
import re
Expand All @@ -37,6 +38,7 @@
from setuptools import find_namespace_packages, setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
from setuptools.command.build_py import build_py as _build_py
from setuptools.command.egg_info import egg_info


def check_pip_version():
Expand Down Expand Up @@ -361,6 +363,25 @@ def build_extension(self, ext):
pass


# I don't know. Something about the CMake 'install' is producing a .egg-info/
# folder, which then get picked up by the .whl. For release wheels all we need
# is a .dist-info/ folder, so delete the .egg-info/ folder.
#
# * Notes: https://github.com/iree-org/iree/issues/19155
# * Implementation inspirted by https://stackoverflow.com/a/70146326
class CleanEggInfo(egg_info):
def run(self):
install_dir = os.path.join(
CMAKE_INSTALL_DIR_ABS, "python_packages", "iree_compiler"
)
print(f"CleanEggInfo checking install_dir '{install_dir}'")
for d in Path(install_dir).glob("*.egg-info"):
print(f"found egg-info path '{d}', deleting")
shutil.rmtree(d, ignore_errors=True)

egg_info.run(self)


def generate_version_py():
return f"""# Auto-generated version info.
PACKAGE_SUFFIX = "{PACKAGE_SUFFIX}"
Expand Down Expand Up @@ -469,6 +490,7 @@ def find_git_submodule_revision(submodule_path):
"build": CustomBuild,
"built_ext": NoopBuildExtension,
"build_py": CMakeBuildPy,
"egg_info": CleanEggInfo,
},
zip_safe=False,
package_dir={
Expand Down

0 comments on commit 0fb983e

Please sign in to comment.