From 2fa5a7fc00a726c119f7626c702ffb7fa464b25b Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 1 Jul 1991 18:23:06 +0000 Subject: Use posix.popen to read output from a command instead if command.get*. --- Tools/scripts/xxci.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Tools/scripts/xxci.py b/Tools/scripts/xxci.py index 3ac73f3..253ad2d 100755 --- a/Tools/scripts/xxci.py +++ b/Tools/scripts/xxci.py @@ -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) -- cgit v0.12