@@ -19,11 +19,11 @@ def detect_installed_cuda_version():
19
19
with open (os .path .join (cuda_home , 'version.txt' ), 'r' ) as f :
20
20
version_info = f .read ().strip ()
21
21
major , minor = version_info .split ()[2 ].split ('.' )
22
- return f"cu{ major } "
22
+ return f"+ cu{ major } "
23
23
except :
24
- return "cpu "
24
+ return ""
25
25
else :
26
- return "cpu "
26
+ return ""
27
27
28
28
class CMakeExtension (Extension ):
29
29
"""Extension to integrate CMake build"""
@@ -118,20 +118,25 @@ class CustomBdistWheel(_bdist_wheel):
118
118
"""Custom bdist_wheel to modify the name based on build info"""
119
119
def get_tag (self ):
120
120
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
121
126
build_ext_cmd = self .get_finalized_command ('build_ext' )
122
127
# Read the build_info.txt file
128
+ device = ''
123
129
if hasattr (build_ext_cmd , 'build_info_path' ) and os .path .exists (build_ext_cmd .build_info_path ):
124
130
with open (build_ext_cmd .build_info_path , 'r' ) as f :
125
131
build_info = f .read ().strip ()
126
132
device = build_info .split ('=' )[- 1 ]
127
133
if device != 'cpu' :
128
134
device = f'cu{ device } '
129
- platform_tag += f'- { device } '
135
+
130
136
else :
131
137
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 ()
135
140
136
141
137
142
0 commit comments