]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use posix.popen to read output from a command instead if command.get*.
authorGuido van Rossum <guido@python.org>
Mon, 1 Jul 1991 18:23:06 +0000 (18:23 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 1 Jul 1991 18:23:06 +0000 (18:23 +0000)
Tools/scripts/xxci.py

index 3ac73f34b37e32e8e753331340da428d9b8004d4..253ad2dce9aa2d8f5c23e4347b0044172655c797 100755 (executable)
@@ -1,3 +1,4 @@
+#! /ufs/guido/bin/sgi/python
 #! /usr/local/python
 
 # xxci
@@ -57,18 +58,19 @@ def badsuffix(file):
 def go(args):
        for file in args:
                print file + ':'
-               if run('rcsdiff -c', file):
+               if differing(file):
+                       sts = posix.system('rcsdiff ' + file) # ignored
                        if askyesno('Check in ' + file + ' ? '):
-                               sts = run('rcs -l', file) # ignored
-                               # can't use run() here because it's interactive
+                               sts = posix.system('rcs -l ' + file) # ignored
                                sts = posix.system('ci -l ' + file)
 
-def run(cmd, file):
-       sts, output = commands.getstatusoutput(cmd + commands.mkarg(file))
-       if sts:
-               print output
-               print 'Exit status', sts
-       return sts
+def differing(file):
+       try:
+               this = open(file, 'r').read()
+               that = posix.popen('co -p '+file+' 2>/dev/null', 'r').read()
+               return this <> that
+       except:
+               return 1
 
 def askyesno(prompt):
        s = raw_input(prompt)