File tree 1 file changed +14
-1
lines changed 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 6
6
import os
7
7
import glob
8
8
from datetime import datetime
9
+ import subprocess
9
10
10
11
from setuptools import find_packages , setup
11
12
12
13
current_date = datetime .now ().strftime ("%Y.%m.%d" )
13
14
15
+
16
+ def get_git_commit_id ():
17
+ try :
18
+ return subprocess .check_output (['git' , 'rev-parse' , '--short' , 'HEAD' ]).decode ('ascii' ).strip ()
19
+ except Exception :
20
+ return ""
21
+
14
22
def read_requirements (file_path ):
15
23
with open (file_path , "r" ) as file :
16
24
return file .read ().splitlines ()
@@ -21,7 +29,12 @@ def read_version(file_path="version.txt"):
21
29
22
30
# Determine the package name based on the presence of an environment variable
23
31
package_name = "torchao-nightly" if os .environ .get ("TORCHAO_NIGHTLY" ) else "torchao"
24
- version_suffix = os .getenv ("VERSION_SUFFIX" , "" )
32
+
33
+ # Use Git commit ID if VERSION_SUFFIX is not set
34
+ version_suffix = os .getenv ("VERSION_SUFFIX" )
35
+ if version_suffix is None :
36
+ version_suffix = f"+git{ get_git_commit_id ()} "
37
+
25
38
use_cpp = os .getenv ('USE_CPP' )
26
39
27
40
You can’t perform that action at this time.
0 commit comments