From 720c38cf60850d07bb6e09877c668691a6bab3aa Mon Sep 17 00:00:00 2001 From: Alan Chin Date: Tue, 24 Jan 2023 10:38:36 -0800 Subject: [PATCH] Update release script for linux environments (#3086) Signed-off-by: Alan Chin Co-authored-by: Kevin Bates --- create-release.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/create-release.py b/create-release.py index 2609cb062..d0bd13ed8 100755 --- a/create-release.py +++ b/create-release.py @@ -77,7 +77,12 @@ def dependency_exists(command) -> bool: def sed(file: str, pattern: str, replace: str) -> None: """Perform regex substitution on a given file""" try: - check_run(["sed", "-i", "", "-e", f"s#{pattern}#{replace}#g", file], capture_output=False) + if sys.platform in ["linux", "linux2"]: + check_run(["sed", "-i", "-e", f"s#{pattern}#{replace}#g", file], capture_output=False) + elif sys.platform == "darwin": + check_run(["sed", "-i", "", "-e", f"s#{pattern}#{replace}#g", file], capture_output=False) + else: # windows, other + raise RuntimeError(f"Current operating system not supported for release publishing: {sys.platform}: ") except Exception as ex: raise RuntimeError(f"Error processing updated to file {file}: ") from ex