@@ -54,32 +54,32 @@ class CMakeBuild(build_ext):
5454 def build_extension (self , ext : CMakeExtension ) -> None :
5555 pass
5656
57+ version_s = os .getenv ("MLIR_PYTHON_EXTRAS_SET_VERSION" , "" )
58+ if not version_s :
59+ now = datetime .now ()
60+ version_s = f"0.0.8.{ now .year } { now .month :02} { now .day :02} { now .hour :02} "
61+ if bool (int (os .getenv ("USE_LOCAL_VERSION" , True ) or 1 )):
62+ version_s += "+"
63+ local_version = []
64+ GPU = os .getenv ("GPU" , None )
65+ if GPU not in {None , "none" }:
66+ local_version += [GPU ]
5767
58- now = datetime .now ()
59- version_s = f"0.0.8.{ now .year } { now .month :02} { now .day :02} { now .hour :02} "
60-
61- if bool (int (os .getenv ("USE_LOCAL_VERSION" , True ) or 1 )):
62- version_s += "+"
63- local_version = []
64- GPU = os .getenv ("GPU" , None )
65- if GPU not in {None , "none" }:
66- local_version += [GPU ]
67-
68- try :
69- short_hash = run_git (
70- ["rev-parse" , "--short" , "HEAD" ],
71- Path (__file__ ).parent ,
72- ).parse_success (
73- parse = str ,
74- error_msg = "branch err (abbrev-err)" ,
75- )
76- except Exception as e :
77- short_hash = "no-hash"
68+ try :
69+ short_hash = run_git (
70+ ["rev-parse" , "--short" , "HEAD" ],
71+ Path (__file__ ).parent ,
72+ ).parse_success (
73+ parse = str ,
74+ error_msg = "branch err (abbrev-err)" ,
75+ )
76+ except Exception as e :
77+ short_hash = "no-hash"
7878
79- if local_version :
80- version_s += "." .join (local_version + [short_hash ])
81- else :
82- version_s += short_hash
79+ if local_version :
80+ version_s += "." .join (local_version + [short_hash ])
81+ else :
82+ version_s += short_hash
8383
8484packages = (
8585 [HOST_MLIR_PYTHON_PACKAGE_PREFIX ]
0 commit comments