|
40 | 40 | print("[ ERROR ] -v and -M options cannot be used together")
|
41 | 41 | sys.exit(1)
|
42 | 42 |
|
43 |
| -newMajorVersion = args.major if args.major else currentMajorVersion |
44 |
| -newMinorVersion = args.minor if args.minor else currentMinorVersion |
45 |
| -newPatchVersion = args.patch if args.patch else str(int(currentPatchVersion) + 1) |
| 43 | +if args.version: |
| 44 | + # Validate version number |
| 45 | + if not regex.match("[0-9]+\.[0-9]+\.[0-9]+", args.version): |
| 46 | + print("[ ERROR ] Invalid version number") |
| 47 | + sys.exit(1) |
| 48 | + newMajorVersion = args.version.split(".")[0] |
| 49 | + newMinorVersion = args.version.split(".")[1] |
| 50 | + newPatchVersion = args.version.split(".")[2] |
| 51 | +else: |
| 52 | + newMajorVersion = args.major if args.major else currentMajorVersion |
| 53 | + newMinorVersion = args.minor if args.minor else currentMinorVersion |
| 54 | + newPatchVersion = args.patch if args.patch else str(int(currentPatchVersion) + 1) |
| 55 | + |
46 | 56 | print(f"New Version: v{newMajorVersion}.{newMinorVersion}.{newPatchVersion}\n\n")
|
47 | 57 |
|
48 | 58 | # Write to version.txt
|
|
77 | 87 | citationFile.write(template)
|
78 | 88 | print("Written to CITATION.cff")
|
79 | 89 |
|
80 |
| -# Write to .hdoc.toml |
81 |
| -with open("tmp/hdocTemplate.toml", "r") as templateFile: |
82 |
| - template = templateFile.read() |
83 |
| - print("Loaded .hdoc.toml template") |
84 |
| - |
85 |
| -with open("../.hdoc.toml", "w") as hdocFile: |
86 |
| - versionString = f"v{newMajorVersion}.{newMinorVersion}.{newPatchVersion}" |
87 |
| - template = template.replace("$${{ INSERT_VERSION_NUMBER_HERE }}$$", versionString) |
88 |
| - hdocFile.write(template) |
89 |
| - print("Written to .hdoc.toml") |
| 90 | +# # Write to .hdoc.toml |
| 91 | +# with open("tmp/hdocTemplate.toml", "r") as templateFile: |
| 92 | +# template = templateFile.read() |
| 93 | +# print("Loaded .hdoc.toml template") |
| 94 | +# |
| 95 | +# with open("../.hdoc.toml", "w") as hdocFile: |
| 96 | +# versionString = f"v{newMajorVersion}.{newMinorVersion}.{newPatchVersion}" |
| 97 | +# template = template.replace("$${{ INSERT_VERSION_NUMBER_HERE }}$$", versionString) |
| 98 | +# hdocFile.write(template) |
| 99 | +# print("Written to .hdoc.toml") |
0 commit comments