From 3fcedbae78be0d5651bbd3b4a3594a1aadc1a659 Mon Sep 17 00:00:00 2001 From: senlyu163 Date: Wed, 22 Jan 2025 16:38:26 +0000 Subject: [PATCH 1/3] [BUGFIX] fix VERSION file not found error, which installed by pip --- VERSION | 1 - bitblas/version.py | 16 +--------------- setup.py | 11 +++++++---- 3 files changed, 8 insertions(+), 20 deletions(-) delete mode 100644 VERSION diff --git a/VERSION b/VERSION deleted file mode 100644 index 6c6aa7cb0..000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.0 \ No newline at end of file diff --git a/bitblas/version.py b/bitblas/version.py index 145025aa9..c06237363 100644 --- a/bitblas/version.py +++ b/bitblas/version.py @@ -1,21 +1,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -import os - -# Get the absolute path of the current Python script's directory -current_dir = os.path.dirname(os.path.abspath(__file__)) - -# Get the absolute path of the project root directory (one level above the current directory) -project_root_dir = os.path.abspath(os.path.join(current_dir, "..")) - -# Define the path to the VERSION file located in the project root directory -version_file_path = os.path.join(project_root_dir, "VERSION") - -# Read and store the version information from the VERSION file -# Use 'strip()' to remove any leading/trailing whitespace or newline characters -with open(version_file_path, "r") as version_file: - __version__ = version_file.read().strip() +__version__ = "0.1.0" # Define the public API for the module __all__ = ["__version__"] diff --git a/setup.py b/setup.py index 2f8bb4ce4..8eccb351b 100644 --- a/setup.py +++ b/setup.py @@ -45,13 +45,16 @@ def find_version(version_file_path: str) -> str: Adapted from https://github.com/ray-project/ray/blob/0b190ee1160eeca9796bc091e07eaebf4c85b511/python/setup.py """ - # Read and store the version information from the VERSION file + # Read and store the version information from the version.py file # Use 'strip()' to remove any leading/trailing whitespace or newline characters if not os.path.exists(version_file_path): raise FileNotFoundError(f"Version file not found at {version_file_path}") with open(version_file_path, "r") as version_file: version = version_file.read().strip() - return version + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") def get_nvcc_cuda_version(): @@ -67,7 +70,7 @@ def get_nvcc_cuda_version(): def get_bitblas_version(with_cuda=True, with_system_info=True) -> str: - version = find_version(get_path(".", "VERSION")) + version = find_version(get_path(".", "bitblas", "version.py")) local_version_parts = [] if with_system_info: local_version_parts.append(get_system_info().replace("-", ".")) @@ -271,7 +274,7 @@ def run(self): shutil.copy2(source_dir, target_dir) # copy compoable kernel to the package directory - CONFIG_ITEMS = ["VERSION", "README.md", "LICENSE"] + CONFIG_ITEMS = ["README.md", "LICENSE"] for item in CONFIG_ITEMS: source_dir = os.path.join(ROOT_DIR, item) target_dir = os.path.join(self.build_lib, PACKAGE_NAME, item) From 63f29d9b2e7b5fcb2baeb9dc8465f4534efdec07 Mon Sep 17 00:00:00 2001 From: senlyu163 Date: Fri, 24 Jan 2025 04:53:47 +0000 Subject: [PATCH 2/3] Revert "[BUGFIX] fix VERSION file not found error, which installed by pip" This reverts commit 3fcedbae78be0d5651bbd3b4a3594a1aadc1a659. --- VERSION | 1 + bitblas/version.py | 16 +++++++++++++++- setup.py | 11 ++++------- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..6c6aa7cb0 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 \ No newline at end of file diff --git a/bitblas/version.py b/bitblas/version.py index c06237363..145025aa9 100644 --- a/bitblas/version.py +++ b/bitblas/version.py @@ -1,7 +1,21 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -__version__ = "0.1.0" +import os + +# Get the absolute path of the current Python script's directory +current_dir = os.path.dirname(os.path.abspath(__file__)) + +# Get the absolute path of the project root directory (one level above the current directory) +project_root_dir = os.path.abspath(os.path.join(current_dir, "..")) + +# Define the path to the VERSION file located in the project root directory +version_file_path = os.path.join(project_root_dir, "VERSION") + +# Read and store the version information from the VERSION file +# Use 'strip()' to remove any leading/trailing whitespace or newline characters +with open(version_file_path, "r") as version_file: + __version__ = version_file.read().strip() # Define the public API for the module __all__ = ["__version__"] diff --git a/setup.py b/setup.py index 8eccb351b..2f8bb4ce4 100644 --- a/setup.py +++ b/setup.py @@ -45,16 +45,13 @@ def find_version(version_file_path: str) -> str: Adapted from https://github.com/ray-project/ray/blob/0b190ee1160eeca9796bc091e07eaebf4c85b511/python/setup.py """ - # Read and store the version information from the version.py file + # Read and store the version information from the VERSION file # Use 'strip()' to remove any leading/trailing whitespace or newline characters if not os.path.exists(version_file_path): raise FileNotFoundError(f"Version file not found at {version_file_path}") with open(version_file_path, "r") as version_file: version = version_file.read().strip() - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") + return version def get_nvcc_cuda_version(): @@ -70,7 +67,7 @@ def get_nvcc_cuda_version(): def get_bitblas_version(with_cuda=True, with_system_info=True) -> str: - version = find_version(get_path(".", "bitblas", "version.py")) + version = find_version(get_path(".", "VERSION")) local_version_parts = [] if with_system_info: local_version_parts.append(get_system_info().replace("-", ".")) @@ -274,7 +271,7 @@ def run(self): shutil.copy2(source_dir, target_dir) # copy compoable kernel to the package directory - CONFIG_ITEMS = ["README.md", "LICENSE"] + CONFIG_ITEMS = ["VERSION", "README.md", "LICENSE"] for item in CONFIG_ITEMS: source_dir = os.path.join(ROOT_DIR, item) target_dir = os.path.join(self.build_lib, PACKAGE_NAME, item) From d5a6db138154cf5014b68c073494330b418f10ae Mon Sep 17 00:00:00 2001 From: senlyu163 Date: Fri, 24 Jan 2025 04:56:11 +0000 Subject: [PATCH 3/3] re-commit for fixing version bugs --- bitblas/version.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bitblas/version.py b/bitblas/version.py index 145025aa9..033655429 100644 --- a/bitblas/version.py +++ b/bitblas/version.py @@ -6,11 +6,12 @@ # Get the absolute path of the current Python script's directory current_dir = os.path.dirname(os.path.abspath(__file__)) -# Get the absolute path of the project root directory (one level above the current directory) -project_root_dir = os.path.abspath(os.path.join(current_dir, "..")) +# Define the path to the VERSION file located in the package directory +version_file_path = os.path.join(current_dir, "VERSION") -# Define the path to the VERSION file located in the project root directory -version_file_path = os.path.join(project_root_dir, "VERSION") +# If the VERSION file is not found, locate it in the project root directory instead +if not os.path.exists(version_file_path): + version_file_path = os.path.join(current_dir, "..", "VERSION") # Read and store the version information from the VERSION file # Use 'strip()' to remove any leading/trailing whitespace or newline characters