diff options
Diffstat (limited to 'bin/dispatch-conf')
-rwxr-xr-x | bin/dispatch-conf | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 38359c5b3..5247cdb60 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -19,7 +19,13 @@ if not hasattr(__builtins__, "set"): from stat import * from random import * -import atexit, commands, re, shutil, stat, sys +import atexit, re, shutil, stat, sys +try: + from subprocess import getoutput as subprocess_getoutput + from subprocess import getstatusoutput as subprocess_getstatusoutput +except ImportError: + from commands import getoutput as subprocess_getoutput + from commands import getstatusoutput as subprocess_getstatusoutput try: import portage except ImportError: @@ -131,11 +137,11 @@ class dispatch: else: mrgfail = portage.dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf) if os.path.exists(archive + '.dist'): - unmodified = len(commands.getoutput(DIFF_CONTENTS % (conf['current'], archive + '.dist'))) == 0 + unmodified = len(subprocess_getoutput(DIFF_CONTENTS % (conf['current'], archive + '.dist'))) == 0 else: unmodified = 0 if os.path.exists(mrgconf): - if mrgfail or len(commands.getoutput(DIFF_CONTENTS % (conf['new'], mrgconf))) == 0: + if mrgfail or len(subprocess_getoutput(DIFF_CONTENTS % (conf['new'], mrgconf))) == 0: os.unlink(mrgconf) newconf = conf['new'] else: @@ -146,13 +152,13 @@ class dispatch: if newconf == mrgconf and \ self.options.get('ignore-previously-merged') != 'yes' and \ os.path.exists(archive+'.dist') and \ - len(commands.getoutput(DIFF_CONTENTS % (archive+'.dist', conf['new']))) == 0: + len(subprocess_getoutput(DIFF_CONTENTS % (archive+'.dist', conf['new']))) == 0: # The current update is identical to the archived .dist # version that has previously been merged. os.unlink(mrgconf) newconf = conf['new'] - mystatus, myoutput = commands.getstatusoutput( + mystatus, myoutput = subprocess_getstatusoutput( DIFF_CONTENTS % (conf ['current'], newconf)) same_file = 0 == len(myoutput) if mystatus >> 8 == 2: @@ -160,9 +166,9 @@ class dispatch: same_cvs = False same_wsc = False else: - same_cvs = 0 == len(commands.getoutput( + same_cvs = 0 == len(subprocess_getoutput( DIFF_CVS_INTERP % (conf ['current'], newconf))) - same_wsc = 0 == len(commands.getoutput( + same_wsc = 0 == len(subprocess_getoutput( DIFF_WSCOMMENTS % (conf ['current'], newconf))) # Do options permit? |