Avoid an unhandled IndexError thrown from the PackagesSystemSet constructor
authorZac Medico <zmedico@gentoo.org>
Tue, 3 Jun 2008 20:37:11 +0000 (20:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 3 Jun 2008 20:37:11 +0000 (20:37 -0000)
when neither /etc/make.profile nor /etc/portage/profile exist.

svn path=/main/trunk/; revision=10560

pym/portage/sets/profiles.py

index 35cf4d87db2fb4dc114cc91ab0a90381d2895824..011412a538967c80a6705806f20a96c28cc5591c 100644 (file)
@@ -14,8 +14,12 @@ class PackagesSystemSet(PackageSet):
        def __init__(self, profile_paths):
                super(PackagesSystemSet, self).__init__()
                self._profile_paths = profile_paths
-               self.description = "System packages for profile %s" % self._profile_paths[-1]
-       
+               if profile_paths:
+                       description = self._profile_paths[-1]
+               else:
+                       description = None
+               self.description = "System packages for profile %s" % description
+
        def load(self):
                mylist = [grabfile_package(os.path.join(x, "packages")) for x in self._profile_paths]
                mylist = stack_lists(mylist, incremental=1)