Skip to content

Commit 716d5e9

Browse files
committed
fixing setup.py
1 parent ce96c85 commit 716d5e9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

setup.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def detect_installed_cuda_version():
1919
with open(os.path.join(cuda_home, 'version.txt'), 'r') as f:
2020
version_info = f.read().strip()
2121
major, minor = version_info.split()[2].split('.')
22-
return f"cu{major}"
22+
return f"+cu{major}"
2323
except:
24-
return "cpu"
24+
return ""
2525
else:
26-
return "cpu"
26+
return ""
2727

2828
class CMakeExtension(Extension):
2929
"""Extension to integrate CMake build"""
@@ -118,20 +118,25 @@ class CustomBdistWheel(_bdist_wheel):
118118
"""Custom bdist_wheel to modify the name based on build info"""
119119
def get_tag(self):
120120
python_tag, abi_tag, platform_tag = super().get_tag()
121+
122+
123+
return python_tag, abi_tag, platform_tag
124+
def run(self):
125+
# Dynamically modify version before running bdist_wheel
121126
build_ext_cmd = self.get_finalized_command('build_ext')
122127
# Read the build_info.txt file
128+
device = ''
123129
if hasattr(build_ext_cmd, 'build_info_path') and os.path.exists(build_ext_cmd.build_info_path):
124130
with open(build_ext_cmd.build_info_path, 'r') as f:
125131
build_info = f.read().strip()
126132
device = build_info.split('=')[-1]
127133
if device != 'cpu':
128134
device = f'cu{device}'
129-
platform_tag += f'-{device}'
135+
130136
else:
131137
device = detect_installed_cuda_version()
132-
platform_tag += f'-{device}'
133-
134-
return python_tag, abi_tag, platform_tag
138+
self.distribution.metadata.version = f"{self.distribution.metadata.version}+{device}"
139+
super().run()
135140

136141

137142

0 commit comments

Comments
 (0)