@@ -338,6 +338,7 @@ def build_pip_package(
338
338
src_directory ,
339
339
dist_directory ,
340
340
is_nightly = False ,
341
+ rc = None ,
341
342
):
342
343
# Build Keras with Bazel to get the protobuf .py files
343
344
os .chdir (keras_root_directory )
@@ -383,6 +384,8 @@ def build_pip_package(
383
384
if is_nightly :
384
385
date = datetime .datetime .now ()
385
386
version += f".dev{ date .strftime ('%Y%m%d%H' )} "
387
+ elif rc :
388
+ version += rc
386
389
with open (os .path .join (package_directory , "__init__.py" )) as f :
387
390
init_contents = f .read ()
388
391
with open (os .path .join (package_directory , "__init__.py" ), "w" ) as f :
@@ -455,8 +458,14 @@ def test_wheel(wheel_path, expected_version, requirements_path):
455
458
action = "store_true" ,
456
459
help = "Whether this is for the `keras-nightly` package." ,
457
460
)
461
+ parser .add_argument (
462
+ "--RC" ,
463
+ type = str ,
464
+ help = "Whether this is for the release candidate." ,
465
+ )
458
466
args = parser .parse_args ()
459
467
is_nightly = args .nightly
468
+ rc = args .RC
460
469
461
470
build_directory = os .path .join (tempfile .gettempdir (), TMP_BUILD_DIRNAME )
462
471
keras_root_directory = pathlib .Path (__file__ ).parent .resolve ()
@@ -472,6 +481,7 @@ def test_wheel(wheel_path, expected_version, requirements_path):
472
481
f"package_directory={ package_directory } \n "
473
482
f"src_directory={ src_directory } \n "
474
483
f"is_nightly={ is_nightly } "
484
+ f"rc={ rc } "
475
485
)
476
486
if os .path .exists (build_directory ):
477
487
raise ValueError (f"Directory already exists: { build_directory } " )
@@ -487,6 +497,7 @@ def test_wheel(wheel_path, expected_version, requirements_path):
487
497
src_directory ,
488
498
dist_directory ,
489
499
is_nightly ,
500
+ rc ,
490
501
)
491
502
wheel_filename = [f for f in saved_filenames if f .endswith (".whl" )][0 ]
492
503
if VERBOSE :
@@ -504,4 +515,4 @@ def test_wheel(wheel_path, expected_version, requirements_path):
504
515
# Clean up: remove the build directory (no longer needed)
505
516
if VERBOSE :
506
517
print (f"Deleting temp build directory at { build_directory } ..." )
507
- shutil .rmtree (build_directory )
518
+ shutil .rmtree (build_directory )
0 commit comments