|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
def set_version(new_version: str) -> None: |
|
|
|
new_contents = f'{VERSION_LINE_START}"{new_version}"\n' |
|
|
|
def set_version(python_version: str, csharp_version: str) -> None: |
|
|
|
new_contents = f'{VERSION_LINE_START}"{python_version}"\n' |
|
|
|
print(f"Setting {path} to version {new_version}") |
|
|
|
print(f"Setting {path} to version {python_version}") |
|
|
|
# Package version is a bit stricter - only set it if we're not a "dev" version. |
|
|
|
if "dev" not in new_version: |
|
|
|
package_version = new_version + "-preview" |
|
|
|
|
|
|
|
if csharp_version is not None: |
|
|
|
package_version = csharp_version + "-preview" |
|
|
|
print( |
|
|
|
f"Setting package version to {package_version} in {UNITY_PACKAGE_JSON_PATH}" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
parser = argparse.ArgumentParser() |
|
|
|
parser.add_argument("--new-version", default=None) |
|
|
|
parser.add_argument("--python-version", default=None) |
|
|
|
parser.add_argument("--csharp-version", default=None) |
|
|
|
if args.new_version: |
|
|
|
print(f"Updating to verison {args.new_version}") |
|
|
|
set_version(args.new_version) |
|
|
|
|
|
|
|
if args.python_version: |
|
|
|
print(f"Updating python library to version {args.python_version}") |
|
|
|
if args.csharp_version: |
|
|
|
print(f"Updating C# package to version {args.csharp_version}") |
|
|
|
set_version(args.python_version, args.csharp_version) |
|
|
|
else: |
|
|
|
ok = check_versions() |
|
|
|
return_code = 0 if ok else 1 |