Пример #1
0
def _strings_path_from_path(path):
    """Calculate and cache `strings $path` and return the cached path."""
    from hashlib import md5
    import applib
    import buildutils
    from os.path import exists
    cache_dir = join(
        applib.user_cache_dir("komodo-dev", "ActiveState"), "strings")
    strings_dir = join(cache_dir, md5(dirname(path)).hexdigest())
    strings_path = join(strings_dir, basename(path)+".strings")
    if not exists(strings_dir):
        os.makedirs(strings_dir)
    stdout = buildutils.capture_stdout(["strings", path])
    fout = open(strings_path, 'w')
    fout.write(stdout)
    fout.close()
    return strings_path
Пример #2
0
def _strings_path_from_path(path):
    """Calculate and cache `strings $path` and return the cached path."""
    from hashlib import md5
    import applib
    import buildutils
    from os.path import exists
    cache_dir = join(applib.user_cache_dir("komodo-dev", "ActiveState"),
                     "strings")
    strings_dir = join(cache_dir, md5(dirname(path)).hexdigest())
    strings_path = join(strings_dir, basename(path) + ".strings")
    if not exists(strings_dir):
        os.makedirs(strings_dir)
    stdout = buildutils.capture_stdout(["strings", path])
    fout = open(strings_path, 'w')
    fout.write(stdout)
    fout.close()
    return strings_path
Пример #3
0
def _od_path_from_path(path, od_opts=["-c"]):
    """Calculate and cache `od $od_opts $path` and return the cached path."""
    from hashlib import md5
    import applib
    import buildutils
    import which
    from os.path import exists
    cache_dir = join(applib.user_cache_dir("komodo-dev", "ActiveState"), "od")
    od_dir = join(cache_dir, md5(dirname(path)).hexdigest())
    od_path = join(od_dir, basename(path) + ".od")
    if not exists(od_dir):
        os.makedirs(od_dir)
    od = "od"
    if sys.platform == "win32":
        od = r"C:\mozilla-build\msys\bin\od.exe"  # HACK for Trent's machine.
    argv = [od] + od_opts + [path]
    stdout = buildutils.capture_stdout(argv)
    fout = open(od_path, 'w')
    fout.write(stdout)
    fout.close()
    return od_path
Пример #4
0
def _od_path_from_path(path, od_opts=["-c"]):
    """Calculate and cache `od $od_opts $path` and return the cached path."""
    from hashlib import md5
    import applib
    import buildutils
    import which
    from os.path import exists
    cache_dir = join(
        applib.user_cache_dir("komodo-dev", "ActiveState"), "od")
    od_dir = join(cache_dir, md5(dirname(path)).hexdigest())
    od_path = join(od_dir, basename(path)+".od")
    if not exists(od_dir):
        os.makedirs(od_dir)
    od = "od"
    if sys.platform == "win32":
        od = r"C:\mozilla-build\msys\bin\od.exe" # HACK for Trent's machine.
    argv = [od] + od_opts + [path]
    stdout = buildutils.capture_stdout(argv)
    fout = open(od_path, 'w')
    fout.write(stdout)
    fout.close()
    return od_path
Пример #5
0
            # file.
            complete_mar_dir = mar_cacher.get_image_for_mar_path(
                complete_mar_rpath, skip_checksum_check=opts.offline)
            for f in files:
                if not f.endswith(".patch"): continue # for now
                if opts.diff == '-': pass # show all diffs
                elif opts.diff not in f: continue
                f = normpath(splitext(f)[0])
                path = join(complete_mar_dir, f)
                old_path = join(old_complete_mar_dir, f)

                # Try a normal diff.
                diff_argv = ["diff", "-u", old_path, path]
                if opts.force_text_diff:
                    diff_argv.insert(1, "--text")
                diff = buildutils.capture_stdout(diff_argv, ignore_status=True)
                is_binary = False
                if diff.startswith("Binary files"):
                    is_binary = True
                    diff = ""
                if diff.startswith('--- '):
                    diff = diff.split('\n', 2)[-1]
                if diff.strip():
                    print "diff '%s':" % f
                    print _indent(diff)
                elif is_binary:
                    print "diff '%s': (binary diff)" % f
                else:
                    print "diff '%s': (none)" % f
                if not is_binary:
                    continue
Пример #6
0
            # file.
            complete_mar_dir = mar_cacher.get_image_for_mar_path(
                complete_mar_rpath, skip_checksum_check=opts.offline)
            for f in files:
                if not f.endswith(".patch"): continue  # for now
                if opts.diff == '-': pass  # show all diffs
                elif opts.diff not in f: continue
                f = normpath(splitext(f)[0])
                path = join(complete_mar_dir, f)
                old_path = join(old_complete_mar_dir, f)

                # Try a normal diff.
                diff_argv = ["diff", "-u", old_path, path]
                if opts.force_text_diff:
                    diff_argv.insert(1, "--text")
                diff = buildutils.capture_stdout(diff_argv, ignore_status=True)
                is_binary = False
                if diff.startswith("Binary files"):
                    is_binary = True
                    diff = ""
                if diff.startswith('--- '):
                    diff = diff.split('\n', 2)[-1]
                if diff.strip():
                    print "diff '%s':" % f
                    print _indent(diff)
                elif is_binary:
                    print "diff '%s': (binary diff)" % f
                else:
                    print "diff '%s': (none)" % f
                if not is_binary:
                    continue