Пример #1
0
 def scan_egg_links(self, search_path):
     dirs = filter(os.path.isdir, search_path)
     egg_links = (
         (path, entry)
         for path in dirs
         for entry in os.listdir(path)
         if entry.endswith('.egg-link')
     )
     list(itertools.starmap(self.scan_egg_link, egg_links))
Пример #2
0
    def scan_egg_link(self, path, entry):
        with open(os.path.join(path, entry)) as raw_lines:
            # filter non-empty lines
            lines = list(filter(None, map(str.strip, raw_lines)))

        if len(lines) != 2:
            # format is not recognized; punt
            return

        egg_path, setup_path = lines

        for dist in find_distributions(os.path.join(path, egg_path)):
            dist.location = os.path.join(path, *lines)
            dist.precedence = SOURCE_DIST
            self.add(dist)