aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-09-20 16:22:08 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-09-20 16:22:08 +0000
commit8243a08d6d2121e4c1e92201c9d4361df42e5d8f (patch)
tree8885f3b3d554054901d15c7a77bad789a8aa12e8 /bin/dispatch-conf
parentUpdate syntax of numbers in some files which were missing in previous commit. (diff)
downloadportage-8243a08d6d2121e4c1e92201c9d4361df42e5d8f.tar.gz
portage-8243a08d6d2121e4c1e92201c9d4361df42e5d8f.tar.bz2
portage-8243a08d6d2121e4c1e92201c9d4361df42e5d8f.zip
Update system imports for compatibility with Python 3.
svn path=/main/trunk/; revision=14294
Diffstat (limited to 'bin/dispatch-conf')
-rwxr-xr-xbin/dispatch-conf20
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?