grab*_package: optimize for non-existent files
authorZac Medico <zmedico@gentoo.org>
Wed, 24 Nov 2010 16:15:00 +0000 (08:15 -0800)
committerZac Medico <zmedico@gentoo.org>
Wed, 24 Nov 2010 16:15:00 +0000 (08:15 -0800)
pym/portage/util/__init__.py

index b32ebb86e2011c155317a570072540b1389ba3bb..e0908f0a3de9bbbbaa2c86ca42b8debf312b077d 100644 (file)
@@ -381,6 +381,8 @@ def grabdict_package(myfilename, juststrings=0, recursive=0, allow_wildcard=Fals
        """ Does the same thing as grabdict except it validates keys
            with isvalidatom()"""
        pkgs=grabdict(myfilename, juststrings, empty=1, recursive=recursive)
+       if not pkgs:
+               return pkgs
        if verify_eapi and eapi is None:
                eapi = read_corresponding_eapi_file(myfilename)
 
@@ -402,6 +404,8 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=Fals
        remember_source_file=False, verify_eapi=False, eapi=None):
 
        pkgs=grabfile(myfilename, compatlevel, recursive=recursive, remember_source_file=True)
+       if not pkgs:
+               return pkgs
        if verify_eapi and eapi is None:
                eapi = read_corresponding_eapi_file(myfilename)
        mybasename = os.path.basename(myfilename)