From 9a327677f6984ca6e2ec73846e10549fd81595e2 Mon Sep 17 00:00:00 2001 From: antarus Date: Sun, 1 Apr 2007 05:13:21 +0000 Subject: [PATCH] Add support for new-style imports while keeping support for old imports as a fallback svn path=/; revision=382 --- trunk/src/dep-clean/dep-clean | 5 ++++- trunk/src/eclean/eclean | 5 ++++- trunk/src/epkgmove/epkgmove | 5 ++++- trunk/src/etcat/etcat | 5 ++++- trunk/src/genpkgindex/genpkgindex | 18 +++++++++++++----- trunk/src/gensync/gensync | 6 +++++- trunk/src/gentoolkit/pprinter.py | 11 ++++++++--- trunk/src/glsa-check/glsa-check | 7 ++++++- 8 files changed, 48 insertions(+), 14 deletions(-) diff --git a/trunk/src/dep-clean/dep-clean b/trunk/src/dep-clean/dep-clean index b64edb9..2f2bde0 100644 --- a/trunk/src/dep-clean/dep-clean +++ b/trunk/src/dep-clean/dep-clean @@ -7,7 +7,10 @@ import sys import gentoolkit -from output import * +try: + from portage.output import * +except ImportError: + from output import * __author__ = "Karl Trygve Kalleberg, Brandon Low, Jerry Haltom" __email__ = "karltk@gentoo.org, lostlogic@gentoo.org, ssrit@larvalstage" diff --git a/trunk/src/eclean/eclean b/trunk/src/eclean/eclean index 5c5f117..00be5e9 100644 --- a/trunk/src/eclean/eclean +++ b/trunk/src/eclean/eclean @@ -24,7 +24,10 @@ import fpformat import signal sys.path.insert(0,'/usr/lib/portage/pym') import portage -from output import * +try: + from portage.output import * +except ImportError: + from output import * listdir = portage.listdir diff --git a/trunk/src/epkgmove/epkgmove b/trunk/src/epkgmove/epkgmove index 8ce0ae0..42b6e7d 100644 --- a/trunk/src/epkgmove/epkgmove +++ b/trunk/src/epkgmove/epkgmove @@ -17,7 +17,10 @@ from random import randint from optparse import OptionParser import portage -from output import * +try: + from portage.output import * +except ImportError: + from output import * __author__ = "Ian Leitch" __email__ = "port001@gentoo.org" diff --git a/trunk/src/etcat/etcat b/trunk/src/etcat/etcat index 3ffa35d..5137683 100755 --- a/trunk/src/etcat/etcat +++ b/trunk/src/etcat/etcat @@ -93,7 +93,10 @@ sys.path.insert(0, "/usr/lib/gentoolkit/pym") import gentoolkit from stat import * -from output import * +try: + from portage.output import * +except ImportError: + from output import * __author__ = "Alastair Tse" __email__ = "liquidx@gentoo.org" diff --git a/trunk/src/genpkgindex/genpkgindex b/trunk/src/genpkgindex/genpkgindex index ffbc6c2..2259fb9 100644 --- a/trunk/src/genpkgindex/genpkgindex +++ b/trunk/src/genpkgindex/genpkgindex @@ -12,12 +12,20 @@ if getattr(__builtins__, "set", None) is None: for x in ['CFLAGS','CXXFLAGS', 'LDFLAGS','USE']: os.environ[x]='' -import xpak import portage -import portage_checksum -import portage_dep -import portage_util -import portage_const + +try: + import portage.xpak as xpak + import portage.checksum as portage_checksum + import portage.dep as portage_dep + import portage.util as portage_util + import portage.const as portage_const +except ImportError: + import xpak + import portage_checksum + import portage_dep + import portage_util + import portage_const argc=len(sys.argv) diff --git a/trunk/src/gensync/gensync b/trunk/src/gensync/gensync index 493ccb8..52f25ed 100755 --- a/trunk/src/gensync/gensync +++ b/trunk/src/gensync/gensync @@ -22,7 +22,11 @@ import fileinput sys.path.insert(0, "/usr/lib/portage/pym") import portage -from output import * + +try: + from portage.output import * +except ImportError: + from output import * class ConfigDefaults: def __init__(self): diff --git a/trunk/src/gentoolkit/pprinter.py b/trunk/src/gentoolkit/pprinter.py index 66a45f2..255c6d8 100644 --- a/trunk/src/gentoolkit/pprinter.py +++ b/trunk/src/gentoolkit/pprinter.py @@ -6,9 +6,14 @@ # # $Header$ -import gentoolkit -import output import sys +import gentoolkit + +try: + import portage.output as output +except ImportError: + import output + def print_error(s): """Prints an error string to stderr.""" @@ -108,4 +113,4 @@ def subsection(s): def emph(s): """Print a string as emphasized.""" - return output.white(s) \ No newline at end of file + return output.white(s) diff --git a/trunk/src/glsa-check/glsa-check b/trunk/src/glsa-check/glsa-check index fedba47..6d2a11b 100644 --- a/trunk/src/glsa-check/glsa-check +++ b/trunk/src/glsa-check/glsa-check @@ -7,7 +7,12 @@ import os import sys sys.path.insert(0, "/usr/lib/gentoolkit/pym") sys.path.insert(0, "/usr/lib/portage/pym") -from output import * + +try: + from portage.output import * +except ImportError: + from output import * + from getopt import getopt,GetoptError __program__ = "glsa-check" -- 2.26.2