Przeglądaj źródła

add build date - tricky code!

rachels 3 lat temu
rodzic
commit
8ff6172e7b
2 zmienionych plików z 12 dodań i 1 usunięć
  1. 2 1
      locations/start.qsrc
  2. 10 0
      tools/txtmerge.py

+ 2 - 1
locations/start.qsrc

@@ -17,7 +17,8 @@ $usercom = 'inputProcessing'
 $fname = 'Tahoma'
 fsize = 12
 gs 'saveg'
-$version = '<<version_major>>.<<version_minor>>.<<version_revision>>.<<version_patch>> bug fix 2 for "The I broke all your lovely clothes and I''m not even sorry about it version."'
+gs 'addbuilddate'
+$version = '<<version_major>>.<<version_minor>>.<<version_revision>>.<<version_patch>> built on <<$builddate>> for "The I broke all your lovely clothes and I''m not even sorry about it version."'
 opPRE = 1
 
 *nl

+ 10 - 0
tools/txtmerge.py

@@ -38,6 +38,16 @@ for location in root.iter('Location'):
     except IOError:
         print("WARNING: missing location %s" % iname)
         pass
+from datetime import date
+from sys import version_info
+ofile.write(u"#addbuilddate" + '\n')
+today = date.today()
+if version_info.major == 2:
+	du = unicode(today.strftime("$builddate = '%B %d, %Y'"), 'utf8') + '\n'
+elif version_info.major == 3:
+	du = str(today.strftime("$builddate = '%B %d, %Y'")) + '\n'
+ofile.write(du)
+ofile.write(u"--- addbuilddate ---------------------------------" + '\n')
 
 ofile.close()