summaryrefslogtreecommitdiff
path: root/update-windows-installer.py
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-26 00:27:18 -0400
committerpommicket <pommicket@gmail.com>2023-08-26 00:27:18 -0400
commitf999900e3a1cf54b57fe051f248dae56f31f8b7c (patch)
treef92ba4df84c708cd0dfb1e588906ee476ff85b1f /update-windows-installer.py
parent7497aa73e5590a438d17eb4642e4aaba4fe66863 (diff)
update version, add script for updating windows installer2.5.1
Diffstat (limited to 'update-windows-installer.py')
-rw-r--r--update-windows-installer.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/update-windows-installer.py b/update-windows-installer.py
new file mode 100644
index 0000000..eb272a3
--- /dev/null
+++ b/update-windows-installer.py
@@ -0,0 +1,42 @@
+# update windows installer ProductVersion/ProductCode/PackageCode
+# this needs to be done for every release of ted
+
+import uuid
+import re
+from datetime import datetime
+
+timestamp = datetime.utcnow()
+# will break in 2100. FUCK YOU PEOPEL OF THE FUTURE!!
+version_start = '%02d.%02d.%02d' % (timestamp.year % 100, timestamp.month, timestamp.day)
+product_code = str(uuid.uuid4()).upper()
+package_code = str(uuid.uuid4()).upper()
+
+PATH = 'windows_installer/ted/ted.vdproj'
+
+f = open(PATH)
+text = f.read()
+f.close()
+
+text = re.sub(r'"ProductCode" = "8:\{.*\}"', '"ProductCode" = "8:{%s}"' % product_code, text)
+text = re.sub(r'"PackageCode" = "8:\{.*\}"', '"PackageCode" = "8:{%s}"' % package_code, text)
+curr_version = re.search('"ProductVersion" = "8:([^"]*)"', text).group(1)
+curr_version_start = curr_version[:len(version_start)]
+daily_id = 0
+if curr_version_start > version_start:
+ print('time went backwards. aborting.')
+ exit(1)
+elif curr_version_start == version_start:
+ daily_id = int(curr_version[len(version_start):]) + 1
+ if daily_id >= 100:
+
+ print('''you've updated the windows installer 100 times today.
+i think you should take a break.
+aborting.
+''')
+ exit(1)
+
+version = '%s%02d' % (version_start, daily_id)
+text = re.sub(r'"ProductVersion" = "8:([^"]*)"', r'"ProductVersion" = "8:%s"' % version, text)
+f = open(PATH, 'w')
+f.write(text)
+f.close()