"tests/vscode:/vscode.git/clone" did not exist on "52f1378e64367c655461d4b6d5b2e19585b92791"
Unverified Commit c861d8a2 authored by Lei Wang's avatar Lei Wang Committed by GitHub
Browse files

[Dist] Provide an option to include commit ID in version (#884)

* Update MANIFEST.in and setup.py to include commit ID in versioning and adjust included files

- Modified MANIFEST.in to include shared library files `libtvm.so` and `libtvm_runtime.so`.
- Updated setup.py to conditionally include the commit ID in the package version based on the `WITH_COMMITID` environment variable.
- Enhanced versioning logic in version.py to use a truncated commit ID for better compatibility.

* Update setup.py and related scripts to enable commit ID inclusion in package metadata

- Changed the default value of the `WITH_COMMITID` environment variable in setup.py to "True".
- Updated tox.ini to set `WITH_COMMITID` to "TRUE" for the testing environment and "FALSE" for the build environment.
- Modified pypi_distribution.sh to pass `WITH_COMMITID=FALSE` during the wheel build process.

* Update MANIFEST.in to include additional files and directories for packaging

- Added VERSION, CMakeLists.txt, and various requirements files to the package.
- Included recursive inclusion of source files and third-party libraries, while excluding specific clang and llvm directories.
parent a58bf9b6
...@@ -7,4 +7,4 @@ if [ -d build ]; then ...@@ -7,4 +7,4 @@ if [ -d build ]; then
rm -r build rm -r build
fi fi
PYPI_BUILD=TRUE python setup.py bdist_wheel --plat-name=manylinux1_x86_64 PYPI_BUILD=TRUE WITH_COMMITID=FALSE python setup.py bdist_wheel --plat-name=manylinux1_x86_64
...@@ -43,6 +43,8 @@ USE_LLVM = os.environ.get("USE_LLVM", "False").lower() == "true" ...@@ -43,6 +43,8 @@ USE_LLVM = os.environ.get("USE_LLVM", "False").lower() == "true"
USE_ROCM = os.environ.get("USE_ROCM", "False").lower() == "true" USE_ROCM = os.environ.get("USE_ROCM", "False").lower() == "true"
# Build with Debug mode # Build with Debug mode
DEBUG_MODE = os.environ.get("DEBUG_MODE", "False").lower() == "true" DEBUG_MODE = os.environ.get("DEBUG_MODE", "False").lower() == "true"
# Include commit ID in wheel filename and package metadata
WITH_COMMITID = os.environ.get("WITH_COMMITID", "True").lower() == "true"
def load_module_from_path(module_name, path): def load_module_from_path(module_name, path):
...@@ -172,7 +174,12 @@ def get_tilelang_version(with_cuda=True, with_system_info=True, with_commit_id=F ...@@ -172,7 +174,12 @@ def get_tilelang_version(with_cuda=True, with_system_info=True, with_commit_id=F
except subprocess.SubprocessError as error: except subprocess.SubprocessError as error:
logger.warning(f"Ignore commit id because failed to get git commit id: {str(error)}") logger.warning(f"Ignore commit id because failed to get git commit id: {str(error)}")
if commit_id: if commit_id:
version += f"+{commit_id}" # Truncate commit ID to 8 characters to keep version string reasonable
short_commit_id = commit_id[:8]
if local_version_parts:
version += f".{short_commit_id}"
else:
version += f"+{short_commit_id}"
return version return version
...@@ -543,7 +550,7 @@ class TileLangBuilPydCommand(build_py): ...@@ -543,7 +550,7 @@ class TileLangBuilPydCommand(build_py):
# if is VERSION file, replace the content with the new version with commit id # if is VERSION file, replace the content with the new version with commit id
if not PYPI_BUILD and item == "VERSION": if not PYPI_BUILD and item == "VERSION":
version = get_tilelang_version( version = get_tilelang_version(
with_cuda=False, with_system_info=False, with_commit_id=True) with_cuda=False, with_system_info=False, with_commit_id=WITH_COMMITID)
target_dir = os.path.dirname(target_dir) target_dir = os.path.dirname(target_dir)
if not os.path.exists(target_dir): if not os.path.exists(target_dir):
os.makedirs(target_dir) os.makedirs(target_dir)
...@@ -568,7 +575,7 @@ class TileLangSdistCommand(sdist): ...@@ -568,7 +575,7 @@ class TileLangSdistCommand(sdist):
def make_distribution(self): def make_distribution(self):
self.distribution.metadata.name = PACKAGE_NAME self.distribution.metadata.name = PACKAGE_NAME
self.distribution.metadata.version = get_tilelang_version( self.distribution.metadata.version = get_tilelang_version(
with_cuda=False, with_system_info=False, with_commit_id=False) with_cuda=False, with_system_info=False, with_commit_id=WITH_COMMITID)
super().make_distribution() super().make_distribution()
...@@ -841,8 +848,8 @@ class TilelangExtensionBuild(build_ext): ...@@ -841,8 +848,8 @@ class TilelangExtensionBuild(build_ext):
setup( setup(
name=PACKAGE_NAME, name=PACKAGE_NAME,
version=(get_tilelang_version(with_cuda=False, with_system_info=False) version=(get_tilelang_version(with_cuda=False, with_system_info=False, with_commit_id=False)
if PYPI_BUILD else get_tilelang_version()), if PYPI_BUILD else get_tilelang_version(with_commit_id=WITH_COMMITID)),
packages=find_packages(where="."), packages=find_packages(where="."),
package_dir={"": "."}, package_dir={"": "."},
author="Tile-AI", author="Tile-AI",
......
...@@ -41,8 +41,12 @@ def get_git_commit_id() -> Union[str, None]: ...@@ -41,8 +41,12 @@ def get_git_commit_id() -> Union[str, None]:
# NOTE(lei): Although the local commit id cannot capture locally staged changes, # NOTE(lei): Although the local commit id cannot capture locally staged changes,
# the local commit id can help mitigate issues caused by incorrect cache to some extent, # the local commit id can help mitigate issues caused by incorrect cache to some extent,
# so it should still be kept. # so it should still be kept.
if "+" not in __version__ and (commit_id := get_git_commit_id()): # Check WITH_COMMITID environment variable to control whether to include commit ID
__version__ = f"{__version__}+{commit_id}" WITH_COMMITID = os.environ.get("WITH_COMMITID", "True").lower() == "true"
if WITH_COMMITID and "+" not in __version__ and (commit_id := get_git_commit_id()):
# Use short commit ID (8 characters) for better compatibility
short_commit_id = commit_id[:8]
__version__ = f"{__version__}+{short_commit_id}"
# Define the public API for the module # Define the public API for the module
__all__ = ["__version__"] __all__ = ["__version__"]
...@@ -8,6 +8,7 @@ deps = ...@@ -8,6 +8,7 @@ deps =
wheel wheel
build build
setenv = setenv =
WITH_COMMITID = TRUE
PYTHON_EXECUTABLE = {envpython} PYTHON_EXECUTABLE = {envpython}
Python3_EXECUTABLE = {envpython} Python3_EXECUTABLE = {envpython}
commands = commands =
...@@ -17,6 +18,7 @@ commands = ...@@ -17,6 +18,7 @@ commands =
skip_install = false skip_install = false
setenv = setenv =
PYPI_BUILD = TRUE PYPI_BUILD = TRUE
WITH_COMMITID = FALSE
PYTHON_EXECUTABLE = {envpython} PYTHON_EXECUTABLE = {envpython}
Python3_EXECUTABLE = {envpython} Python3_EXECUTABLE = {envpython}
commands = commands =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment