Logo Search packages:      
Sourcecode: distribute version File versions  Download package

def pkg_resources::Distribution::insert_on (   self,
  path,
  loc = None 
)

Insert self.location in path before its nearest parent directory

Definition at line 2265 of file pkg_resources.py.

02265                                          :
        """Insert self.location in path before its nearest parent directory"""

        loc = loc or self.location

        if self.project_name == 'setuptools':
            try:
                version = self.version
            except ValueError:
                version = ''
            if '0.7' in version:
                raise ValueError(
                    "A 0.7-series setuptools cannot be installed "
                    "with distribute. Found one at %s" % str(self.location))

        if not loc:
            return

        if path is sys.path:
            self.check_version_conflict()

        nloc = _normalize_cached(loc)
        bdir = os.path.dirname(nloc)
        npath= map(_normalize_cached, path)

        bp = None
        for p, item in enumerate(npath):
            if item==nloc:
                break
            elif item==bdir and self.precedence==EGG_DIST:
                # if it's an .egg, give it precedence over its directory
                path.insert(p, loc)
                npath.insert(p, nloc)
                break
        else:
            path.append(loc)
            return

        # p is the spot where we found or inserted loc; now remove duplicates
        while 1:
            try:
                np = npath.index(nloc, p+1)
            except ValueError:
                break
            else:
                del npath[np], path[np]
                p = np  # ha!

        return



    def check_version_conflict(self):


Generated by  Doxygen 1.6.0   Back to index