def uploadStringsIfChanged(): # needs to have upload secret to protect apptranslator.org server from abuse path = os.path.join("scripts", "secrets.json") with open(path) as file: d = file.read() config = json.loads(d) print(config) uploadsecret = config["TranslationUploadSecret"] if None is uploadsecret: print("Skipping string upload because don't have upload secret") return # TODO: we used to have a check if svn is up-to-date # should we restore it for git? strings = extract_strings_from_c_files() strings.sort() s = "AppTranslator strings\n" + string.join(strings, "\n") s = s.encode("utf8") if lastUploaded() == s: print( "Skipping upload because strings haven't changed since last upload") else: uploadStringsToServer(s, uploadsecret) saveLastUploaded(s) print("Don't forget to checkin strings/last_uploaded.txt")
def generate_code(s): strings_dict = parseTranslations(s) strings = extract_strings_from_c_files(True) strings_list = [tmp[0] for tmp in strings] for s in strings_dict.keys(): if s not in strings_list: del strings_dict[s] untranslated_dict = dump_missing_per_language(strings_list, strings_dict) untranslated = get_untranslated_as_list(untranslated_dict) for s in untranslated: if s not in strings_dict: strings_dict[s] = [] gen_c_code(strings_dict, strings)
def uploadStringsIfChanged(skip_svn_check=False): # needs to have upload secret to protect apptranslator.org server from # abuse config = util.load_config() uploadsecret = config.trans_ul_secret if None is uploadsecret: print("Skipping string upload because don't have upload secret") return if not skip_svn_check: # Note: this check might be confusing due to how svn work # Unforunately, if you have local latest revision 5 and do a checkin to create # revision 6, svn info says that locally you're still on revision 5, even though # the code is actually as revision 6. # You need to do "svn update" to update local version number # Unfortunately I can't do it automatically here since it would be dangerous # (i.e. it would update code locally). # svn update is called in build.py, so it's not a problem if it's run # from ./scripts/build-release.bat or ./scripts/build-pre-release.bat try: (local_ver, latest_ver) = util.get_svn_versions() except: print( "Skipping string upload because SVN isn't available to check for up-to-date-ness" ) return if int(latest_ver) > int(local_ver): print( "Skipping string upload because your local version (%s) is older than latest in svn (%s)" % (local_ver, latest_ver)) return strings = extract_strings_from_c_files() strings.sort() s = "AppTranslator strings\n" + string.join(strings, "\n") s = s.encode("utf8") if lastUploaded() == s: print( "Skipping upload because strings haven't changed since last upload" ) else: uploadStringsToServer(s, uploadsecret) saveLastUploaded(s) print("Don't forget to checkin strings/last_uploaded.txt")
def uploadStringsIfChanged(skip_svn_check=False): # needs to have upload secret to protect apptranslator.org server from # abuse config = util.load_config() uploadsecret = config.trans_ul_secret if None is uploadsecret: print("Skipping string upload because don't have upload secret") return if not skip_svn_check: # Note: this check might be confusing due to how svn work # Unforunately, if you have local latest revision 5 and do a checkin to create # revision 6, svn info says that locally you're still on revision 5, even though # the code is actually as revision 6. # You need to do "svn update" to update local version number # Unfortunately I can't do it automatically here since it would be dangerous # (i.e. it would update code locally). # svn update is called in build.py, so it's not a problem if it's run # from ./scripts/build-release.bat or ./scripts/build-pre-release.bat try: (local_ver, latest_ver) = util.get_svn_versions() except: print( "Skipping string upload because SVN isn't available to check for up-to-date-ness") return if int(latest_ver) > int(local_ver): print( "Skipping string upload because your local version (%s) is older than latest in svn (%s)" % (local_ver, latest_ver)) return strings = extract_strings_from_c_files() strings.sort() s = "AppTranslator strings\n" + string.join(strings, "\n") s = s.encode("utf8") if lastUploaded() == s: print( "Skipping upload because strings haven't changed since last upload") else: uploadStringsToServer(s, uploadsecret) saveLastUploaded(s) print("Don't forget to checkin strings/last_uploaded.txt")
def uploadStringsIfChanged(): # needs to have upload secret to protect apptranslator.org server from abuse config = util.load_config() uploadsecret = config.trans_ul_secret if None is uploadsecret: print("Skipping string upload because don't have upload secret") return # TODO: we used to have a check if svn is up-to-date # should we restore it for git? strings = extract_strings_from_c_files() strings.sort() s = "AppTranslator strings\n" + string.join(strings, "\n") s = s.encode("utf8") if lastUploaded() == s: print( "Skipping upload because strings haven't changed since last upload") else: uploadStringsToServer(s, uploadsecret) saveLastUploaded(s) print("Don't forget to checkin strings/last_uploaded.txt")
def uploadStringsIfChanged(): # needs to have upload secret to protect apptranslator.org server from abuse config = util.load_config() uploadsecret = config.trans_ul_secret if None is uploadsecret: print("Skipping string upload because don't have upload secret") return # TODO: we used to have a check if svn is up-to-date # should we restore it for git? strings = extract_strings_from_c_files() strings.sort() s = "AppTranslator strings\n" + string.join(strings, "\n") s = s.encode("utf8") if lastUploaded() == s: print( "Skipping upload because strings haven't changed since last upload" ) else: uploadStringsToServer(s, uploadsecret) saveLastUploaded(s) print("Don't forget to checkin strings/last_uploaded.txt")