Skip to content

Commit

Permalink
Merge branch 'PR-Ralim#3-Version-rule-and-format' into PR-Ralim#4-TS1…
Browse files Browse the repository at this point in the history
…00-Logo-Left
  • Loading branch information
GeminiServer committed Mar 19, 2020
2 parents e323de2 + a5ec2bc commit da84188
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
31 changes: 23 additions & 8 deletions Translation Editor/make_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
from datetime import datetime
import sys
import fontTables

# To cause no confusion with the original firmware version of TS100,
# which actually has the latest firmware version 2.18
# Lets go ahead start with version 2.20.0001 BETA
# Version String: xx.yy.zzzz TAG --> x:Major y:Minor z:Build TAG: REL | BETA | ALPHA
BUILD_VERSION = 'V2.20.0001 BETA'
import re
import subprocess

TRANSLATION_CPP = "Translation.cpp"

Expand Down Expand Up @@ -101,7 +97,7 @@ def getConstants():
consants.append(('SymbolVolts', 'V'))
consants.append(('SymbolDC', 'DC'))
consants.append(('SymbolCellCount', 'S'))
consants.append(('SymbolVersionNumber', BUILD_VERSION))
consants.append(('SymbolVersionNumber', buildVersion))
return consants


Expand Down Expand Up @@ -457,6 +453,22 @@ def writeLanguage(languageCode, defs, f):
# ----- Block end
f.write(to_unicode("#endif\n"))

def readVersion():
with open(os.path.relpath(jsonDir +
"/../workspace/TS100/version.h"),"r") as version_file:
try:
for line in version_file:
if re.findall(r'^.*(?<=(#define)).*(?<=(BUILD_VERSION))', line):
line = re.findall(r'\"(.+?)\"',line)
if line:
version = line[0]
try: version += "."+ subprocess.check_output(
["git","describe", "--always"]).strip().decode('ascii').upper()
except OSError: version += " git"
finally:
if version_file:
version_file.close();
return version

def read_opts():
""" Reading input parameters
Expand Down Expand Up @@ -503,14 +515,17 @@ def writeTarget(outFile, defs, langCodes):
for langCode in langCodes:
writeLanguage(langCode, defs, f)


if __name__ == "__main__":
try:
jsonDir, outFile = read_opts()
except:
print("usage: make_translation.py {json dir} {cpp dir}")
sys.exit(1)

try: buildVersion = readVersion()
except: print("error: could not get/extract build version"); sys.exit(1)

print("Build version: " + buildVersion)
print("Making " + outFile + " from " + jsonDir)

langDict = readTranslations(jsonDir)
Expand Down
1 change: 1 addition & 0 deletions workspace/TS100/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ echo " Builder for the"
echo " Alternate Open Source Firmware"
echo " for Miniware TS100 or TS80"
echo " by Ralim"
echo " "
echo "*********************************************"

# Calculate available languages
Expand Down
7 changes: 7 additions & 0 deletions workspace/TS100/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Firmware build version - format: xx.yy.zzzzzz
* x: Major - y: Minor - z: git short hash generated automaticaly from git
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4'
*/

#define BUILD_VERSION "v2.08"

0 comments on commit da84188

Please sign in to comment.