diff --git a/prfromtransifex.ini b/prfromtransifex.ini index 6a5bab2..2ea15d3 100644 --- a/prfromtransifex.ini +++ b/prfromtransifex.ini @@ -1,41 +1,41 @@ [github] ; Github username of bot -user = MumbleTransifexBot +user = ETLegacyTransifexRobot ; Github password of bot -password = +password = ; Email used for commits -email = mumbletransifexbot@mumble.info +email = [transifex] ; Modes: default fetches all string, reviewed only reviewed ones mode = default ; Minimum number of percent needed for a translation to be included -minpercent = 0 +minpercent = 1 [workingrepo] -owner = MumbleTransifexBot -repo = mumble +owner = ETLegacyTransifexRobot +repo = etlegacy branch = master ; Clone URL for working repo -url = git@github.com:MumbleTransifexBot/mumble.git +url = git@github.com:ETLegacyTransifexRobot/etlegacy.git ; Local path the repo can be found -path = /home/mumbletransifexbot/mumble/ +path = /home/etlegacy/repositories/transifex-etlegacy [targetrepo] -owner = mumble-voip -repo = mumble +owner = etlegacy +repo = etlegacy branch = master ; Clone URL for pull request target repository -url = https://github.com/mumble-voip/mumble.git +url = https://github.com/etlegacy/etlegacy.git [pullrequest] ; Template string for pull request title title = Transifex translation update ; Template string for pull request body body = New translation updates available from transifex - https://www.transifex.com/organization/mumble/dashboard/mumble + https://www.transifex.com/projects/p/etlegacy/ ; Template string for commits in PR. Available variables ; %(mode)s See transifex.mode above ; %(minpercent)s See transifex.minpercent above @@ -45,33 +45,3 @@ commit = Transifex translation update Mode: %(mode)s Minimum percent translated: %(minpercent)s Matched %(langcount)d languages - -[misc] -; pri file to store language bookkeeping data in -; Will be re-written and commited to the repository -; if changes occur. -prifile = src/mumble/translations.pri -; Template to generate file from, available variables $(files)s -; for a space separated list of all files. -pritemplate = # Do not change manually - # Autogenerated by mumble transifex bot - TRANSLATIONS = %(files)s - -; qtc file to store language bookkeeping data in -; Will be re-written and commited to the repository -; if changes occur. -qrcfile = src/mumble/mumble_translations.qrc -; Template to generate file from, available variables $(files)s -; for a space separated list of all files. -qrctemplate = - - - %(files)s - - - -; Space separated translation files not retrieved from transifex -additionaltsfiles = mumble_en.ts \ No newline at end of file diff --git a/prfromtransifex.py b/prfromtransifex.py index d0f1f07..4d0424c 100755 --- a/prfromtransifex.py +++ b/prfromtransifex.py @@ -115,13 +115,7 @@ if __name__ == "__main__": pr_title = cfg.get('pullrequest', 'title') pr_body = cfg.get('pullrequest', 'body') pr_commit = cfg.get('pullrequest', 'commit') - - prifile = cfg.get('misc', 'prifile') - pritemplate = cfg.get('misc', 'pritemplate') - qrcfile = cfg.get('misc', 'qrcfile') - qrctemplate = cfg.get('misc', 'qrctemplate') - additionaltsfiles = cfg.get('misc', 'additionaltsfiles') - + if args.setup or not os.path.exists(wr_path): info("Setting up git repo") debug(git["clone", wr_url, wr_path]()) @@ -168,32 +162,10 @@ if __name__ == "__main__": txout = tx["pull", "-f", "-a", "--mode=" + mode, "--minimum-perc=" + minpercent]() debug(txout) - # Add all .ts files tx pull got to repo + # Add all .po files tx pull got to repo paths, files = zip(*re.findall(r"^\s->\s[\w_]+:\s([\w/\_]+/([\w_]+\.ts))$", txout, flags=re.MULTILINE)) debug(git["add"](*paths)) - - # Add additional ts files not in control of transifex (e.g. English source translation) - files = list(files) - files.extend(additionaltsfiles.split(" ")) - files.sort() - - # Write pri file listing ts files for build - prifilepath = os.path.join(wr_path, prifile) - info("Updating translations listing file '%s'", prifilepath) - tsfiles = (" ".join(files)) - with open(prifilepath, "w") as f: - f.write(pritemplate % {'files': tsfiles}) - debug(git["add"](prifilepath)) - - # Write qrc file listing qm files built from ts files for build - qrcfilepath = os.path.join(wr_path, qrcfile) - info("Updating translations listing file '%s'", qrcfilepath) - tstoqm = lambda f: " %s" % re.sub(r"(^.*)\.ts$", r"\1.qm", f) - qmfiles = os.linesep.join([tstoqm(f) for f in files]) - with open(qrcfilepath, "w") as f: - f.write(qrctemplate % {'files': qmfiles}) - debug(git["add"](qrcfilepath)) - + # Check if the repo changed debug("Checking for modifications") changed, changedfiles, _ = git["diff", "--cached", "--name-only", "--exit-code"].run(retcode=(0,1))