Move deprecated profile check out of global scope.
authorZac Medico <zmedico@gentoo.org>
Sun, 23 Apr 2006 23:19:48 +0000 (23:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 23 Apr 2006 23:19:48 +0000 (23:19 -0000)
svn path=/main/trunk/; revision=3204

bin/emerge
pym/portage.py

index 13b99bdcda34e20d30762e9491a3b504ac297ef6..3c1f0b15693d3dfbb65103c01f809d425e7f437f 100755 (executable)
@@ -153,6 +153,8 @@ def sorted_versions(verlist):
                ret.insert(x, ver)
        return ret
 
+portage.deprecated_profile_check()
+
 if portage.settings.has_key("PORTAGE_NICENESS"):
        try:
                os.nice(int(portage.settings["PORTAGE_NICENESS"]))
index acd34f1f46df1b7c94c57c50e066d87f64a40399..0b5a1c29e63ca62608fe41ca187d4657be812166 100644 (file)
@@ -6445,19 +6445,23 @@ os.umask(022)
 profiledir=None
 if os.path.isdir(PROFILE_PATH):
        profiledir = PROFILE_PATH
-       if "PORTAGE_CALLER" in os.environ and os.environ["PORTAGE_CALLER"] == "emerge" and os.access(DEPRECATED_PROFILE_FILE, os.R_OK):
-               deprecatedfile = open(DEPRECATED_PROFILE_FILE, "r")
-               dcontent = deprecatedfile.readlines()
-               deprecatedfile.close()
-               newprofile = dcontent[0]
-               writemsg(red("\n!!! Your current profile is deprecated and not supported anymore.\n"))
-               writemsg(red("!!! Please upgrade to the following profile if possible:\n"))
-               writemsg(8*" "+green(newprofile)+"\n")
-               if len(dcontent) > 1:
-                       writemsg("To upgrade do the following steps:\n")
-                       for myline in dcontent[1:]:
-                               writemsg(myline)
-                       writemsg("\n\n")
+
+def deprecated_profile_check():
+       if not os.access(DEPRECATED_PROFILE_FILE, os.R_OK):
+               return False
+       deprecatedfile = open(DEPRECATED_PROFILE_FILE, "r")
+       dcontent = deprecatedfile.readlines()
+       deprecatedfile.close()
+       newprofile = dcontent[0]
+       writemsg(red("\n!!! Your current profile is deprecated and not supported anymore.\n"))
+       writemsg(red("!!! Please upgrade to the following profile if possible:\n"))
+       writemsg(8*" "+green(newprofile)+"\n")
+       if len(dcontent) > 1:
+               writemsg("To upgrade do the following steps:\n")
+               for myline in dcontent[1:]:
+                       writemsg(myline)
+               writemsg("\n\n")
+       return True
 
 if os.path.exists(USER_VIRTUALS_FILE):
        writemsg(red("\n!!! /etc/portage/virtuals is deprecated in favor of\n"))