]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/ndiff.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Tools / scripts / ndiff.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/ndiff.py b/AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/ndiff.py
deleted file mode 100644 (file)
index c0e79e2..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#! /usr/bin/env python\r
-\r
-# Module ndiff version 1.7.0\r
-# Released to the public domain 08-Dec-2000,\r
-# by Tim Peters (tim.one@home.com).\r
-\r
-# Provided as-is; use at your own risk; no warranty; no promises; enjoy!\r
-\r
-# ndiff.py is now simply a front-end to the difflib.ndiff() function.\r
-# Originally, it contained the difflib.SequenceMatcher class as well.\r
-# This completes the raiding of reusable code from this formerly\r
-# self-contained script.\r
-\r
-"""ndiff [-q] file1 file2\r
-    or\r
-ndiff (-r1 | -r2) < ndiff_output > file1_or_file2\r
-\r
-Print a human-friendly file difference report to stdout.  Both inter-\r
-and intra-line differences are noted.  In the second form, recreate file1\r
-(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.\r
-\r
-In the first form, if -q ("quiet") is not specified, the first two lines\r
-of output are\r
-\r
--: file1\r
-+: file2\r
-\r
-Each remaining line begins with a two-letter code:\r
-\r
-    "- "    line unique to file1\r
-    "+ "    line unique to file2\r
-    "  "    line common to both files\r
-    "? "    line not present in either input file\r
-\r
-Lines beginning with "? " attempt to guide the eye to intraline\r
-differences, and were not present in either input file.  These lines can be\r
-confusing if the source files contain tab characters.\r
-\r
-The first file can be recovered by retaining only lines that begin with\r
-"  " or "- ", and deleting those 2-character prefixes; use ndiff with -r1.\r
-\r
-The second file can be recovered similarly, but by retaining only "  " and\r
-"+ " lines; use ndiff with -r2; or, on Unix, the second file can be\r
-recovered by piping the output through\r
-\r
-    sed -n '/^[+ ] /s/^..//p'\r
-"""\r
-\r
-__version__ = 1, 7, 0\r
-\r
-import difflib, sys\r
-\r
-def fail(msg):\r
-    out = sys.stderr.write\r
-    out(msg + "\n\n")\r
-    out(__doc__)\r
-    return 0\r
-\r
-# open a file & return the file object; gripe and return 0 if it\r
-# couldn't be opened\r
-def fopen(fname):\r
-    try:\r
-        return open(fname, 'U')\r
-    except IOError, detail:\r
-        return fail("couldn't open " + fname + ": " + str(detail))\r
-\r
-# open two files & spray the diff to stdout; return false iff a problem\r
-def fcompare(f1name, f2name):\r
-    f1 = fopen(f1name)\r
-    f2 = fopen(f2name)\r
-    if not f1 or not f2:\r
-        return 0\r
-\r
-    a = f1.readlines(); f1.close()\r
-    b = f2.readlines(); f2.close()\r
-    for line in difflib.ndiff(a, b):\r
-        print line,\r
-\r
-    return 1\r
-\r
-# crack args (sys.argv[1:] is normal) & compare;\r
-# return false iff a problem\r
-\r
-def main(args):\r
-    import getopt\r
-    try:\r
-        opts, args = getopt.getopt(args, "qr:")\r
-    except getopt.error, detail:\r
-        return fail(str(detail))\r
-    noisy = 1\r
-    qseen = rseen = 0\r
-    for opt, val in opts:\r
-        if opt == "-q":\r
-            qseen = 1\r
-            noisy = 0\r
-        elif opt == "-r":\r
-            rseen = 1\r
-            whichfile = val\r
-    if qseen and rseen:\r
-        return fail("can't specify both -q and -r")\r
-    if rseen:\r
-        if args:\r
-            return fail("no args allowed with -r option")\r
-        if whichfile in ("1", "2"):\r
-            restore(whichfile)\r
-            return 1\r
-        return fail("-r value must be 1 or 2")\r
-    if len(args) != 2:\r
-        return fail("need 2 filename args")\r
-    f1name, f2name = args\r
-    if noisy:\r
-        print '-:', f1name\r
-        print '+:', f2name\r
-    return fcompare(f1name, f2name)\r
-\r
-# read ndiff output from stdin, and print file1 (which=='1') or\r
-# file2 (which=='2') to stdout\r
-\r
-def restore(which):\r
-    restored = difflib.restore(sys.stdin.readlines(), which)\r
-    sys.stdout.writelines(restored)\r
-\r
-if __name__ == '__main__':\r
-    args = sys.argv[1:]\r
-    if "-profile" in args:\r
-        import profile, pstats\r
-        args.remove("-profile")\r
-        statf = "ndiff.pro"\r
-        profile.run("main(args)", statf)\r
-        stats = pstats.Stats(statf)\r
-        stats.strip_dirs().sort_stats('time').print_stats()\r
-    else:\r
-        main(args)\r