diff options
author | Guido van Rossum <guido@python.org> | 1991-07-01 18:23:06 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-07-01 18:23:06 (GMT) |
commit | 2fa5a7fc00a726c119f7626c702ffb7fa464b25b (patch) | |
tree | 9179e237fa4efad27262fa9da0418e9ee624b5fd /Tools/scripts | |
parent | 9c5c80824c0e1b60972e33fcfdfdca20b082df9e (diff) | |
download | cpython-2fa5a7fc00a726c119f7626c702ffb7fa464b25b.zip cpython-2fa5a7fc00a726c119f7626c702ffb7fa464b25b.tar.gz cpython-2fa5a7fc00a726c119f7626c702ffb7fa464b25b.tar.bz2 |
Use posix.popen to read output from a command instead if command.get*.
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/xxci.py | 20 |
1 files 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) |