Пример #1
0
     usage(sys.argv[0])
     sys.exit(1)
 qt = ""
 proj = ""
 svnbase = svnserver + "trunk/"
 tag = ""
 addfiles = []
 cleanup = True
 binary = True
 source = True
 keeptemp = False
 makensis = ""
 cross = ""
 buildid = None
 platform = sys.platform
 treehash = gitscraper.get_refs(gitrepo)['refs/remotes/origin/HEAD']
 if sys.platform != "darwin":
     static = True
 else:
     static = False
 for o, a in opts:
     if o in ("-q", "--qmake"):
         qt = a
     if o in ("-p", "--project"):
         proj = a
         cleanup = False
     if o in ("-a", "--add"):
         addfiles.append(a)
     if o in ("-n", "--makensis"):
         makensis = a
     if o in ("-s", "--source-only"):
Пример #2
0
def deploy():
    startup = time.time()

    try:
        opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:n:sbdkx:i:h", [
            "qmake=", "project=", "tag=", "add=", "makensis=", "source-only",
            "binary-only", "dynamic", "keep-temp", "cross=", "buildid=", "help"
        ])
    except getopt.GetoptError as err:
        print(str(err))
        usage(sys.argv[0])
        sys.exit(1)
    qt = ""
    proj = ""
    svnbase = svnserver + "trunk/"
    tag = ""
    addfiles = []
    cleanup = True
    binary = True
    source = True
    keeptemp = False
    makensis = ""
    cross = ""
    buildid = None
    platform = sys.platform
    treehash = gitscraper.get_refs(gitrepo)['refs/remotes/origin/HEAD']
    if sys.platform != "darwin":
        static = True
    else:
        static = False
    for o, a in opts:
        if o in ("-q", "--qmake"):
            qt = a
        if o in ("-p", "--project"):
            proj = a
            cleanup = False
        if o in ("-a", "--add"):
            addfiles.append(a)
        if o in ("-n", "--makensis"):
            makensis = a
        if o in ("-s", "--source-only"):
            binary = False
        if o in ("-b", "--binary-only"):
            source = False
        if o in ("-d", "--dynamic") and sys.platform != "darwin":
            static = False
        if o in ("-k", "--keep-temp"):
            keeptemp = True
        if o in ("-t", "--tree"):
            treehash = a
        if o in ("-x", "--cross") and sys.platform != "win32":
            cross = a
            platform = "win32"
        if o in ("-i", "--buildid"):
            buildid = a
        if o in ("-h", "--help"):
            usage(sys.argv[0])
            sys.exit(0)

    if source == False and binary == False:
        print(
            "Building build neither source nor binary means nothing to do. Exiting."
        )
        sys.exit(1)

    print("Building " + progexe[platform] + " for " + platform)
    # search for qmake
    if qt == "":
        qm = findqt(cross)
    else:
        qm = checkqt(qt)
    if qm == "":
        print("ERROR: No suitable Qt installation found.")
        sys.exit(1)

    # create working folder. Use current directory if -p option used.
    if proj == "":
        w = tempfile.mkdtemp()
        # make sure the path doesn't contain backslashes to prevent issues
        # later when running on windows.
        workfolder = re.sub(r'\\', '/', w)
        revision = gitscraper.describe_treehash(gitrepo, treehash)
        # try to find a version number from describe output.
        # WARNING: this is broken and just a temporary workaround!
        v = re.findall(b'([\d\.a-f]+)', revision)
        if v:
            if v[-1].decode().find('.') >= 0:
                revision = "v" + v[-1].decode()
            else:
                revision = v[-1].decode()
        if buildid == None:
            versionextra = ""
        else:
            versionextra = "-" + buildid
        sourcefolder = workfolder + "/" + program + "-" + str(
            revision) + versionextra + "/"
        archivename = program + "-" + str(
            revision) + versionextra + "-src.tar.bz2"
        ver = str(revision)
        os.mkdir(sourcefolder)
        print("Version: %s" % revision)
    else:
        workfolder = "."
        sourcefolder = "."
        archivename = ""
    # check if project file explicitly given. If yes, don't get sources from svn
    if proj == "":
        proj = sourcefolder + project
        # get sources and pack source tarball
        if getsources(treehash, svnpaths, sourcefolder) != 0:
            tempclean(workfolder, cleanup and not keeptemp)
            sys.exit(1)

        # replace version strings.
        print("Updating version information in sources")
        for f in regreplace:
            infile = open(sourcefolder + "/" + f, "r")
            incontents = infile.readlines()
            infile.close()

            outfile = open(sourcefolder + "/" + f, "w")
            for line in incontents:
                newline = line
                for r in regreplace[f]:
                    # replacements made on the replacement string:
                    # %REVISION% is replaced with the revision number
                    replacement = re.sub("%REVISION%", str(revision), r[1])
                    newline = re.sub(r[0], replacement, newline)
                    # %BUILD% is replaced with buildid as passed on the command line
                    if buildid != None:
                        replacement = re.sub("%BUILDID%", "-" + str(buildid),
                                             replacement)
                    else:
                        replacement = re.sub("%BUILDID%", "", replacement)
                    newline = re.sub(r[0], replacement, newline)
                outfile.write(newline)
            outfile.close()

        if source == True:
            print("Creating source tarball %s\n" % archivename)
            tf = tarfile.open(archivename, mode='w:bz2')
            tf.add(sourcefolder,
                   os.path.basename(re.subn('/$', '', sourcefolder)[0]))
            tf.close()
            if binary == False:
                shutil.rmtree(workfolder)
                sys.exit(0)
    else:
        # figure version from sources. Need to take path to project file into account.
        versionfile = re.subn('[\w\.]+$', "version.h", proj)[0]
        ver = findversion(versionfile) + "-dev" + datetime.now().strftime(
            '%Y%m%d%H%M%S')
    # append buildid if any.
    if buildid != None:
        ver += "-" + buildid

    # check project file
    if not os.path.exists(proj):
        print("ERROR: path to project file wrong.")
        sys.exit(1)

    # copy specified (--add) files to working folder
    for f in addfiles:
        shutil.copy(f, sourcefolder)
    buildstart = time.time()
    header = "Building %s %s" % (program, ver)
    print(header)
    print(len(header) * "=")

    # build it.
    if not qmake(qm, proj, platform, sourcefolder, static, cross) == 0:
        tempclean(workfolder, cleanup and not keeptemp)
        sys.exit(1)
    if not build(sourcefolder, platform, cross) == 0:
        tempclean(workfolder, cleanup and not keeptemp)
        sys.exit(1)
    buildtime = time.time() - buildstart
    progfiles = programfiles
    progfiles.append(progexe[platform])
    if platform == "win32":
        if useupx == True:
            if not upxfile(sourcefolder, platform) == 0:
                tempclean(workfolder, cleanup and not keeptemp)
                sys.exit(1)
        dllfiles = finddlls(sourcefolder + "/" + progexe[platform], \
                            [os.path.dirname(qm)], cross)
        if len(dllfiles) > 0:
            progfiles.extend(dllfiles)
        archive = zipball(progfiles, ver, sourcefolder, platform)
        # only when running native right now.
        if nsisscript != "" and makensis != "":
            nsisfileinject(sourcefolder + "/" + nsisscript, sourcefolder \
                           + "/" + nsisscript + ".tmp", dllfiles)
            runnsis(ver, makensis, nsisscript + ".tmp", sourcefolder)
    elif platform == "darwin":
        archive = macdeploy(ver, sourcefolder, platform)
    else:
        if platform in ['linux', 'linux2']:
            for p in progfiles:
                prog = sourcefolder + "/" + p
                output = subprocess.Popen(["file", prog],
                                          stdout=subprocess.PIPE)
                res = output.communicate()
                if re.findall("ELF 64-bit", res[0]):
                    ver += "-64bit"
                    break

        archive = tarball(progfiles, ver, sourcefolder)

    # remove temporary files
    tempclean(workfolder, cleanup)

    # display summary
    headline = "Build Summary for %s" % program
    print("\n%s\n%s" % (headline, "=" * len(headline)))
    if archivename != "":
        filestats(archivename)
    filestats(archive)
    duration = time.time() - startup
    durmins = (int)(duration / 60)
    dursecs = (int)(duration % 60)
    buildmins = (int)(buildtime / 60)
    buildsecs = (int)(buildtime % 60)
    print("Overall time %smin %ssec, building took %smin %ssec." % \
        (durmins, dursecs, buildmins, buildsecs))
Пример #3
0
#!/usr/bin/python

import gitscraper
import os
import sys

if len(sys.argv) < 2:
    print("Usage: %s <version|hash>" % sys.argv[0])
    sys.exit()

repository = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../..")
if '.' in sys.argv[1]:
    version = sys.argv[1]
    basename = "rockbox-" + version
    ref = "refs/tags/v" + version + "-final"
    refs = gitscraper.get_refs(repository)
    if ref in refs:
        tree = refs[ref]
    else:
        print("Could not find hash for version!")
        sys.exit()
else:
    tree = sys.argv[1]
    basename = "rockbox-" + tree

gitscraper.archive_files(repository, tree, [], basename, archive="7z")

print("done.")


Пример #4
0
#!/usr/bin/python

import gitscraper
import os
import sys

if len(sys.argv) < 2:
    print("Usage: %s <version|hash>" % sys.argv[0])
    sys.exit()

repository = os.path.abspath(
    os.path.dirname(os.path.abspath(__file__)) + "/../..")
if '.' in sys.argv[1]:
    version = sys.argv[1]
    basename = "rockbox-" + version
    ref = "refs/tags/v" + version + "-final"
    refs = gitscraper.get_refs(repository)
    if ref in refs:
        tree = refs[ref]
    else:
        print("Could not find hash for version!")
        sys.exit()
else:
    tree = sys.argv[1]
    basename = "rockbox-" + tree

gitscraper.archive_files(repository, tree, [], basename, archive="7z")

print("done.")
Пример #5
0
def main():
    if len(sys.argv) > 1:
        if sys.argv[1] == '--help':
            printhelp()
            sys.exit(0)
    if len(sys.argv) > 1:
        if sys.argv[1] == '--pretty':
            pretty = 1
    else:
        pretty = 0

    # get gitpaths to temporary folder
    workfolder = tempfile.mkdtemp() + "/"
    repo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
    tree = gitscraper.get_refs(repo)['refs/remotes/origin/master']
    filesprops = gitscraper.scrape_files(repo, tree, gitpaths, dest=workfolder,
            timestamp_files=["rbutil/rbutilqt/lang"])

    projectfolder = workfolder + langbase
    # lupdate translations and drop all obsolete translations
    subprocess.Popen(["lupdate-qt4", "-no-obsolete", "rbutilqt.pro"],
            stdout=subprocess.PIPE, stderr=subprocess.PIPE,
            cwd=projectfolder).communicate()
    # lrelease translations to get status
    output = subprocess.Popen(["lrelease-qt4", "rbutilqt.pro"],
            stdout=subprocess.PIPE, stderr=subprocess.PIPE,
            cwd=projectfolder).communicate()
    lines = re.split(r"\n", output[0])

    re_updating = re.compile(r"^Updating.*")
    re_generated = re.compile(r"Generated.*")
    re_ignored = re.compile(r"Ignored.*")
    re_qmlang = re.compile(r"'.*/rbutil_(.*)\.qm'")
    re_qmbase = re.compile(r"'.*/(rbutil_.*)\.qm'")
    re_genout = re.compile(r"[^0-9]([0-9]+) .*[^0-9]([0-9]+) .*[^0-9]([0-9]+) ")
    re_ignout = re.compile(r"([0-9]+) ")

    # print header
    titlemax = 0
    for l in langs:
        cur = len(langs[l])
        if titlemax < cur:
            titlemax = cur

    if pretty == 1:
        spaces = [7, 5, 5, 5, 5, 27, 17]
        delim = "+--" + titlemax * "-"
        for s in spaces:
            delim += "+" + "-" * s
        delim += "+"
        head = "| Language" + (titlemax - 8) * " " \
                + " |  Code |Trans| Fin |Unfin| Untr|           Updated         |       Done      |"
        print delim
        print "|" + " " * ((len(head) / 2 - len(tree) / 2) - 1) + str(tree) \
                + " " * ((len(head) / 2 - len(tree) / 2) - 1) + "|"
        print delim
        print head
        print delim
    else:
        r = str(tree) + " (" + gitscraper.get_file_timestamp(repo, tree, ".") + ")"
        print "|  *Translation status as of revision " + r + "*  ||||||||"
        print "| *Language* | *Language Code* | *Translations* | *Finished* | " \
        "*Unfinished* | *Untranslated* | *Updated* | *Done* |"

    # scan output
    i = 0
    while i < len(lines):
        line = lines[i]
        if re_updating.search(line):
            lang = re_qmlang.findall(line)
            tsfile = "rbutil/rbutilqt/lang/" + re_qmbase.findall(line)[0] + ".ts"
            tsdate = filesprops[1][tsfile]

            line = lines[i + 1]
            if re_generated.search(line):
                values = re_genout.findall(line)
                translations = string.atoi(values[0][0])
                finished = string.atoi(values[0][1])
                unfinished = string.atoi(values[0][2])
                line = lines[i + 2]
                if not line.strip():
                    line = lines[i + 3]
                if re_ignored.search(line):
                    ignored = string.atoi(re_ignout.findall(line)[0])
                else:
                    ignored = 0
            if lang[0] in langs:
                name = langs[lang[0]].strip()
            else:
                name = '(unknown)'

            percent = (float(finished + unfinished) * 100 / float(translations + ignored))
            bar = "#" * int(percent / 10)
            if (percent % 10) > 5:
                bar += "+"
            bar += " " * (10 - len(bar))
            if pretty == 1:
                fancylang = lang[0] + " " * (5 - len(lang[0]))
            else:
                fancylang = lang[0]
            status = [fancylang, translations, finished, unfinished, ignored, tsdate, percent, bar]
            if pretty == 1:
                thisname = name + (titlemax - len(name)) * " "
                print "| " + thisname + " | %5s | %3s | %3s | %3s | %3s | %25s | %3i%% %s |" % tuple(status)
            else:
                if percent > 90:
                    color = '%%GREEN%%'
                else:
                    if percent > 50:
                        color = '%%ORANGE%%'
                    else:
                        color = '%%RED%%'

                text = "| " + name + " | %s | %s | %s | %s | %s | %s | " + color + "%3i%%%%ENDCOLOR%% %s |"
                print text % tuple(status)
        i += 1

    if pretty == 1:
        print delim

    shutil.rmtree(workfolder)
Пример #6
0
     usage(sys.argv[0])
     sys.exit(1)
 qt = ""
 proj = ""
 svnbase = svnserver + "trunk/"
 tag = ""
 addfiles = []
 cleanup = True
 binary = True
 source = True
 keeptemp = False
 makensis = ""
 cross = ""
 buildid = None
 platform = sys.platform
 treehash = gitscraper.get_refs(gitrepo)['refs/remotes/origin/HEAD']
 if sys.platform != "darwin":
     static = True
 else:
     static = False
 for o, a in opts:
     if o in ("-q", "--qmake"):
         qt = a
     if o in ("-p", "--project"):
         proj = a
         cleanup = False
     if o in ("-a", "--add"):
         addfiles.append(a)
     if o in ("-n", "--makensis"):
         makensis = a
     if o in ("-s", "--source-only"):
Пример #7
0
def langstat(pretty=True):
    '''Get translation stats and print to stdout.'''
    # get gitpaths to temporary folder
    workfolder = tempfile.mkdtemp() + "/"
    repo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
    tree = gitscraper.get_refs(repo)['refs/remotes/origin/master']
    filesprops = gitscraper.scrape_files(
        repo,
        tree,
        GITPATHS,
        dest=workfolder,
        timestamp_files=["rbutil/rbutilqt/lang"])

    projectfolder = workfolder + LANGBASE
    # lupdate translations and drop all obsolete translations
    subprocess.Popen(["lupdate", "-no-obsolete", "rbutilqt.pro"],
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     cwd=projectfolder).communicate()
    # lrelease translations to get status
    output = subprocess.Popen(["lrelease", "rbutilqt.pro"],
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,
                              cwd=projectfolder).communicate()
    lines = re.split(r"\n", output[0].decode())

    re_updating = re.compile(r"^Updating.*")
    re_generated = re.compile(r"Generated.*")
    re_ignored = re.compile(r"Ignored.*")
    re_qmlang = re.compile(r"'.*/rbutil_(.*)\.qm'")
    re_qmbase = re.compile(r"'.*/(rbutil_.*)\.qm'")
    re_genout = re.compile(
        r"[^0-9]([0-9]+) .*[^0-9]([0-9]+) .*[^0-9]([0-9]+) ")
    re_ignout = re.compile(r"([0-9]+) ")

    # print header
    titlemax = 0
    for lang in LANGS:
        cur = len(LANGS[lang])
        if titlemax < cur:
            titlemax = cur

    if pretty:
        delim = "+--" + titlemax * "-"
        for spc in [7, 5, 5, 5, 5, 27, 17]:
            delim += "+" + "-" * spc
        delim += "+"
        head = ("| {:%s} | {:6}|{:5}|{:5}|{:5}|{:5}| {:26}| {:16}|" %
                titlemax).format("Language", "Code", "Trans", "Fin", "Unfin",
                                 "Untr", "Updated", "Done")
        print(delim)
        print(("| {:^%s} |" % (len(head) - 4)).format(tree))
        print(delim)
        print(head)
        print(delim)
    else:
        rev = "%s (%s)" % (tree, gitscraper.get_file_timestamp(
            repo, tree, "."))
        print("|  *Translation status as of revision %s*  ||||||||" % rev)
        print("| *Language* | *Language Code* | *Translations* "
              "| *Finished* | *Unfinished* | *Untranslated* | *Updated* "
              "| *Done* |")

    # scan output
    for i in range(len(lines)):
        line = lines[i]
        if re_updating.search(line):
            lang = re_qmlang.findall(line)
            tsfile = "rbutil/rbutilqt/lang/%s.ts" % re_qmbase.findall(line)[0]
            tsdate = filesprops[1][tsfile]

            line = lines[i + 1]
            if re_generated.search(line):
                values = re_genout.findall(line)
                translations = int(values[0][0])
                finished = int(values[0][1])
                unfinished = int(values[0][2])
                line = lines[i + 2]
                if not line.strip():
                    line = lines[i + 3]
                if re_ignored.search(line):
                    ignored = int(re_ignout.findall(line)[0])
                else:
                    ignored = 0
            if lang[0] in LANGS:
                name = LANGS[lang[0]].strip()
            else:
                name = '(unknown)'

            percent = (finished + unfinished) * 100. / (translations + ignored)
            progress = "#" * int(percent / 10)
            if (percent % 10) > 5:
                progress += "+"
            progress += " " * (10 - len(progress))
            if pretty:
                fancylang = lang[0] + " " * (5 - len(lang[0]))
            else:
                fancylang = lang[0]
            if pretty:
                print(
                    ("| {:%i} | {:5} | {:3} | {:3} | {:3} | {:3} | {:25} | "
                     "{:3}%% {} |" % titlemax).format(name, fancylang,
                                                      translations, finished,
                                                      unfinished,
                                                      ignored, tsdate,
                                                      int(percent), progress))
            else:
                if percent > 90:
                    color = r'%GREEN%'
                else:
                    if percent > 50:
                        color = r'%ORANGE%'
                    else:
                        color = r'%RED%'

                print("| %s | %s | %s | %s | %s | %s | %s | %s %i%% "
                      "%%ENDCOLOR%% %s |" %
                      (name, fancylang, translations, finished, unfinished,
                       ignored, tsdate, color, percent, progress))

    if pretty:
        print(delim)

    shutil.rmtree(workfolder)
Пример #8
0
def langstat(pretty=True):
    # get gitpaths to temporary folder
    workfolder = tempfile.mkdtemp() + "/"
    repo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
    tree = gitscraper.get_refs(repo)['refs/remotes/origin/master']
    filesprops = gitscraper.scrape_files(
        repo, tree, GITPATHS, dest=workfolder,
        timestamp_files=["rbutil/rbutilqt/lang"])

    projectfolder = workfolder + LANGBASE
    # lupdate translations and drop all obsolete translations
    subprocess.Popen(["lupdate-qt4", "-no-obsolete", "rbutilqt.pro"],
                     stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                     cwd=projectfolder).communicate()
    # lrelease translations to get status
    output = subprocess.Popen(["lrelease-qt4", "rbutilqt.pro"],
                              stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                              cwd=projectfolder).communicate()
    lines = re.split(r"\n", output[0].decode())

    re_updating = re.compile(r"^Updating.*")
    re_generated = re.compile(r"Generated.*")
    re_ignored = re.compile(r"Ignored.*")
    re_qmlang = re.compile(r"'.*/rbutil_(.*)\.qm'")
    re_qmbase = re.compile(r"'.*/(rbutil_.*)\.qm'")
    re_genout = re.compile(
        r"[^0-9]([0-9]+) .*[^0-9]([0-9]+) .*[^0-9]([0-9]+) ")
    re_ignout = re.compile(r"([0-9]+) ")

    # print header
    titlemax = 0
    for lang in LANGS:
        cur = len(LANGS[lang])
        if titlemax < cur:
            titlemax = cur

    if pretty:
        delim = "+--" + titlemax * "-"
        for spc in [7, 5, 5, 5, 5, 27, 17]:
            delim += "+" + "-" * spc
        delim += "+"
        head = ("| {:%s} | {:6}|{:5}|{:5}|{:5}|{:5}| {:26}| {:16}|"
                % titlemax).format("Language", "Code", "Trans", "Fin", "Unfin",
                                   "Untr", "Updated", "Done")
        print(delim)
        print(("| {:^%s} |" % (len(head) - 4)).format(tree))
        print(delim)
        print(head)
        print(delim)
    else:
        rev = "%s (%s)" % (
            tree, gitscraper.get_file_timestamp(repo, tree, "."))
        print("|  *Translation status as of revision %s*  ||||||||" % rev)
        print("| *Language* | *Language Code* | *Translations* "
              "| *Finished* | *Unfinished* | *Untranslated* | *Updated* "
              "| *Done* |")

    # scan output
    for i in range(len(lines)):
        line = lines[i]
        if re_updating.search(line):
            lang = re_qmlang.findall(line)
            tsfile = "rbutil/rbutilqt/lang/%s.ts" % re_qmbase.findall(line)[0]
            tsdate = filesprops[1][tsfile]

            line = lines[i + 1]
            if re_generated.search(line):
                values = re_genout.findall(line)
                translations = int(values[0][0])
                finished = int(values[0][1])
                unfinished = int(values[0][2])
                line = lines[i + 2]
                if not line.strip():
                    line = lines[i + 3]
                if re_ignored.search(line):
                    ignored = int(re_ignout.findall(line)[0])
                else:
                    ignored = 0
            if lang[0] in LANGS:
                name = LANGS[lang[0]].strip()
            else:
                name = '(unknown)'

            percent = (finished + unfinished) * 100. / (translations + ignored)
            bar = "#" * int(percent / 10)
            if (percent % 10) > 5:
                bar += "+"
            bar += " " * (10 - len(bar))
            if pretty:
                fancylang = lang[0] + " " * (5 - len(lang[0]))
            else:
                fancylang = lang[0]
            if pretty:
                print(("| {:%i} | {:5} | {:3} | {:3} | {:3} | {:3} | {:25} | "
                       "{:3}%% {} |"
                       % titlemax).format(
                           name, fancylang, translations, finished, unfinished,
                           ignored, tsdate, int(percent), bar))
            else:
                if percent > 90:
                    color = r'%GREEN%'
                else:
                    if percent > 50:
                        color = r'%ORANGE%'
                    else:
                        color = r'%RED%'

                print("| %s | %s | %s | %s | %s | %s | %s | %s %i%% "
                      "%%ENDCOLOR%% %s |" %
                      (name, fancylang, translations, finished, unfinished,
                          ignored, tsdate, color, percent, bar))

    if pretty:
        print(delim)

    shutil.rmtree(workfolder)
Пример #9
0
def main():
    if len(sys.argv) > 1:
        if sys.argv[1] == '--help':
            printhelp()
            sys.exit(0)
    if len(sys.argv) > 1:
        if sys.argv[1] == '--pretty':
            pretty = 1
    else:
        pretty = 0

    # get gitpaths to temporary folder
    workfolder = tempfile.mkdtemp() + "/"
    repo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
    tree = gitscraper.get_refs(repo)['refs/remotes/origin/master']
    filesprops = gitscraper.scrape_files(
        repo,
        tree,
        gitpaths,
        dest=workfolder,
        timestamp_files=["rbutil/rbutilqt/lang"])

    projectfolder = workfolder + langbase
    # lupdate translations and drop all obsolete translations
    subprocess.Popen(["lupdate-qt4", "-no-obsolete", "rbutilqt.pro"],
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     cwd=projectfolder).communicate()
    # lrelease translations to get status
    output = subprocess.Popen(["lrelease-qt4", "rbutilqt.pro"],
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,
                              cwd=projectfolder).communicate()
    lines = re.split(r"\n", output[0])

    re_updating = re.compile(r"^Updating.*")
    re_generated = re.compile(r"Generated.*")
    re_ignored = re.compile(r"Ignored.*")
    re_qmlang = re.compile(r"'.*/rbutil_(.*)\.qm'")
    re_qmbase = re.compile(r"'.*/(rbutil_.*)\.qm'")
    re_genout = re.compile(
        r"[^0-9]([0-9]+) .*[^0-9]([0-9]+) .*[^0-9]([0-9]+) ")
    re_ignout = re.compile(r"([0-9]+) ")

    # print header
    titlemax = 0
    for l in langs:
        cur = len(langs[l])
        if titlemax < cur:
            titlemax = cur

    if pretty == 1:
        spaces = [7, 5, 5, 5, 5, 27, 17]
        delim = "+--" + titlemax * "-"
        for s in spaces:
            delim += "+" + "-" * s
        delim += "+"
        head = "| Language" + (titlemax - 8) * " " \
                + " |  Code |Trans| Fin |Unfin| Untr|           Updated         |       Done      |"
        print delim
        print "|" + " " * ((len(head) / 2 - len(tree) / 2) - 1) + str(tree) \
                + " " * ((len(head) / 2 - len(tree) / 2) - 1) + "|"
        print delim
        print head
        print delim
    else:
        r = str(tree) + " (" + gitscraper.get_file_timestamp(repo, tree,
                                                             ".") + ")"
        print "|  *Translation status as of revision " + r + "*  ||||||||"
        print "| *Language* | *Language Code* | *Translations* | *Finished* | " \
        "*Unfinished* | *Untranslated* | *Updated* | *Done* |"

    # scan output
    i = 0
    while i < len(lines):
        line = lines[i]
        if re_updating.search(line):
            lang = re_qmlang.findall(line)
            tsfile = "rbutil/rbutilqt/lang/" + re_qmbase.findall(
                line)[0] + ".ts"
            tsdate = filesprops[1][tsfile]

            line = lines[i + 1]
            if re_generated.search(line):
                values = re_genout.findall(line)
                translations = string.atoi(values[0][0])
                finished = string.atoi(values[0][1])
                unfinished = string.atoi(values[0][2])
                line = lines[i + 2]
                if not line.strip():
                    line = lines[i + 3]
                if re_ignored.search(line):
                    ignored = string.atoi(re_ignout.findall(line)[0])
                else:
                    ignored = 0
            if lang[0] in langs:
                name = langs[lang[0]].strip()
            else:
                name = '(unknown)'

            percent = (float(finished + unfinished) * 100 /
                       float(translations + ignored))
            bar = "#" * int(percent / 10)
            if (percent % 10) > 5:
                bar += "+"
            bar += " " * (10 - len(bar))
            if pretty == 1:
                fancylang = lang[0] + " " * (5 - len(lang[0]))
            else:
                fancylang = lang[0]
            status = [
                fancylang, translations, finished, unfinished, ignored, tsdate,
                percent, bar
            ]
            if pretty == 1:
                thisname = name + (titlemax - len(name)) * " "
                print "| " + thisname + " | %5s | %3s | %3s | %3s | %3s | %25s | %3i%% %s |" % tuple(
                    status)
            else:
                if percent > 90:
                    color = '%%GREEN%%'
                else:
                    if percent > 50:
                        color = '%%ORANGE%%'
                    else:
                        color = '%%RED%%'

                text = "| " + name + " | %s | %s | %s | %s | %s | %s | " + color + "%3i%%%%ENDCOLOR%% %s |"
                print text % tuple(status)
        i += 1

    if pretty == 1:
        print delim

    shutil.rmtree(workfolder)