@@ -81,7 +81,7 @@ def copy_source_to_build_directory(root_path, package):
81
81
shutil .copy (root_path / fname , root_path / build_directory / fname )
82
82
83
83
84
- def build_wheel (build_path , dist_path , __version__ ):
84
+ def build_wheel (build_path , dist_path , version ):
85
85
# Build the package
86
86
os .chdir (build_path )
87
87
os .system ("python3 -m build" )
@@ -94,7 +94,7 @@ def build_wheel(build_path, dist_path, __version__):
94
94
95
95
# Find the .whl file path
96
96
for fname in os .listdir (dist_path ):
97
- if __version__ in fname and fname .endswith (".whl" ):
97
+ if version in fname and fname .endswith (".whl" ):
98
98
whl_path = dist_path / fname
99
99
print (f"Build successful. Wheel file available at { whl_path } " )
100
100
return whl_path
@@ -110,7 +110,13 @@ def build(root_path, is_nightly=False, keras_nlp=True):
110
110
111
111
if is_nightly :
112
112
date = datetime .datetime .now ()
113
- __version__ += f".dev{ date :%Y%m%d%H%M} "
113
+ version = re .sub (
114
+ r"([0-9]+\.[0-9]+\.[0-9]+).*" , # Match version without suffix.
115
+ r"\1.dev" + date .strftime ("%Y%m%d%H%M" ), # Add dev{date} suffix.
116
+ __version__ ,
117
+ )
118
+ else :
119
+ version = __version__
114
120
115
121
try :
116
122
whls = []
@@ -119,17 +125,17 @@ def build(root_path, is_nightly=False, keras_nlp=True):
119
125
os .mkdir (build_path )
120
126
121
127
copy_source_to_build_directory (root_path , hub_package )
122
- update_build_files (build_path , hub_package , __version__ , is_nightly )
123
- whl = build_wheel (build_path , dist_path , __version__ )
128
+ update_build_files (build_path , hub_package , version , is_nightly )
129
+ whl = build_wheel (build_path , dist_path , version )
124
130
whls .append (whl )
125
131
126
132
if keras_nlp :
127
133
build_path = root_path / build_directory / nlp_package
128
134
dist_path = root_path / nlp_package / dist_directory
129
135
130
136
copy_source_to_build_directory (root_path , nlp_package )
131
- update_build_files (build_path , nlp_package , __version__ , is_nightly )
132
- whl = build_wheel (build_path , dist_path , __version__ )
137
+ update_build_files (build_path , nlp_package , version , is_nightly )
138
+ whl = build_wheel (build_path , dist_path , version )
133
139
whls .append (whl )
134
140
135
141
return whls
0 commit comments