File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 66import os
77import glob
88from datetime import datetime
9+ import subprocess
910
1011from setuptools import find_packages , setup
1112
1213current_date = datetime .now ().strftime ("%Y.%m.%d" )
1314
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+
1422def read_requirements (file_path ):
1523 with open (file_path , "r" ) as file :
1624 return file .read ().splitlines ()
@@ -21,7 +29,12 @@ def read_version(file_path="version.txt"):
2129
2230# Determine the package name based on the presence of an environment variable
2331package_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+
2538use_cpp = os .getenv ('USE_CPP' )
2639
2740
You can’t perform that action at this time.
0 commit comments