environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/pkg_resources.py
def insert_on(self, path, loc = None):
        """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 insert_on(self, path, loc = None):
        """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
Insert self.location in path before its nearest parent directory