Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherrypick the release script fix for RC. #18082

Merged
merged 1 commit into from
May 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pip_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ def build_pip_package(
src_directory,
dist_directory,
is_nightly=False,
rc=None,
):
# Build Keras with Bazel to get the protobuf .py files
os.chdir(keras_root_directory)
Expand Down Expand Up @@ -383,6 +384,8 @@ def build_pip_package(
if is_nightly:
date = datetime.datetime.now()
version += f".dev{date.strftime('%Y%m%d%H')}"
elif rc:
version += rc
with open(os.path.join(package_directory, "__init__.py")) as f:
init_contents = f.read()
with open(os.path.join(package_directory, "__init__.py"), "w") as f:
Expand Down Expand Up @@ -455,8 +458,14 @@ def test_wheel(wheel_path, expected_version, requirements_path):
action="store_true",
help="Whether this is for the `keras-nightly` package.",
)
parser.add_argument(
"--RC",
type=str,
help="Whether this is for the release candidate.",
)
args = parser.parse_args()
is_nightly = args.nightly
rc = args.RC

build_directory = os.path.join(tempfile.gettempdir(), TMP_BUILD_DIRNAME)
keras_root_directory = pathlib.Path(__file__).parent.resolve()
Expand All @@ -472,6 +481,7 @@ def test_wheel(wheel_path, expected_version, requirements_path):
f"package_directory={package_directory}\n"
f"src_directory={src_directory}\n"
f"is_nightly={is_nightly}"
f"rc={rc}"
)
if os.path.exists(build_directory):
raise ValueError(f"Directory already exists: {build_directory}")
Expand All @@ -487,6 +497,7 @@ def test_wheel(wheel_path, expected_version, requirements_path):
src_directory,
dist_directory,
is_nightly,
rc,
)
wheel_filename = [f for f in saved_filenames if f.endswith(".whl")][0]
if VERBOSE:
Expand All @@ -504,4 +515,4 @@ def test_wheel(wheel_path, expected_version, requirements_path):
# Clean up: remove the build directory (no longer needed)
if VERBOSE:
print(f"Deleting temp build directory at {build_directory}...")
shutil.rmtree(build_directory)
shutil.rmtree(build_directory)