Only re.compile() the normalize_needed pattern once
authorZac Medico <zmedico@gentoo.org>
Tue, 16 Oct 2007 21:15:00 +0000 (21:15 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 16 Oct 2007 21:15:00 +0000 (21:15 -0000)
rather than for each dblink constructor call.

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

pym/portage/dbapi/vartree.py

index 38d323849f9fb2f340036d1e698bd34bef209220..99db296615fc74f269c0ff64d19ea3bb7f71151f 100644 (file)
@@ -821,6 +821,10 @@ class dblink(object):
        This class provides an interface to the installed package database
        At present this is implemented as a text backend in /var/db/pkg.
        """
+
+       import re
+       _normalize_needed = re.compile(r'//|^[^/]|.+/$')
+
        def __init__(self, cat, pkg, myroot, mysettings, treetype=None,
                vartree=None):
                """
@@ -872,8 +876,6 @@ class dblink(object):
                self._installed_instance = None
                self.contentscache = None
                self._contents_inodes = None
-               import re
-               self._normalize_needed = re.compile(r'//|^[^/]|.+/$')
 
        def lockdb(self):
                if self._lock_vdb: