From 38d480d4eea1d2db421d4fa9ed9af2a32bbebe37 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Sat, 23 Apr 2011 17:59:32 -0700 Subject: [PATCH] fix python-3 compatibility for euse bug 364081 --- bin/euse | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/euse b/bin/euse index 8262271..5590fbb 100755 --- a/bin/euse +++ b/bin/euse @@ -185,7 +185,7 @@ VER # worth another look to avoid calling python unnecessariy. Or we could # just write the whole thing in python. ;) reduce_incrementals() { - echo $@ | python -c "import sys + echo $@ | python -c "from __future__ import print_function;import sys r=[] for x in sys.stdin.read().split(): if x[0] == '-' and x[1:] in r: @@ -196,14 +196,14 @@ for x in sys.stdin.read().split(): r.append(x) elif x == '-*': r = ['-*'] elif x not in r: r.append(x) -print ' '.join(r)" +print(' '.join(r))" } # }}} # Function: reduce_incrementals_trump {{{ # Similar to reduce_incrementals but negative flags trump positive # flags, regardless of which follows which reduce_incrementals_trump() { - echo $@ | python -c "import sys + echo $@ | python -c "from __future__ import print_function;import sys r=[] for x in sys.stdin.read().split(): if x[0] == '-' and x[1:] in r: @@ -211,7 +211,7 @@ for x in sys.stdin.read().split(): r.append(x) elif x == '-*': r = ['-*'] elif x not in r and not '-'+x in r: r.append(x) -print ' '.join(r)" +print(' '.join(r))" } # }}} # Function: reduce_package_use {{{ @@ -222,7 +222,7 @@ print ' '.join(r)" # * - Lines of package atom followed by flags # (app-editors/vim flag1 flag2 -flag3) reduce_package_use() { - echo "${@}" | python -c "import sys,re + echo "${@}" | python -c "from __future__ import print_function;import sys,re h={}; getflags=re.compile(r'(-?[\w*-]+)') for x in sys.stdin.read().split('\n'): if not x: continue @@ -242,7 +242,7 @@ for x in sys.stdin.read().split('\n'): elif x == '-*': r = h[pkg] = ['-*'] elif x not in r: r.append(x) -print '\n'.join(['%s %s' % (pkg,' '.join(flgs)) for pkg,flgs in h.iteritems() if len(flgs)])" +print('\n'.join(['%s %s' % (pkg,' '.join(flgs)) for pkg,flgs in h.items() if len(flgs)]))" } # }}} # Function: get_useflags {{{ @@ -511,8 +511,8 @@ get_flagstatus_helper_pkg() { if [[ -z "${atoms[@]/[<>=]*/}" ]]; then atoms=($( echo "${atoms[@]}" | python -c " -import portage.dep as dep, sys -print ' '.join(dep.match_to_list('$5-$6',sys.stdin.read().split()))")) +from __future__ import print_function;import portage.dep as dep, sys +print(' '.join(dep.match_to_list('$5-$6',sys.stdin.read().split()))")) fi flags=$(for atom in ${atoms[@]}; do [[ -z $atom ]] && continue -- 2.26.2