def fresh_working_set():
class WorkingSetPlusEditableInstalls(pkg_resources.WorkingSet):<EOL><INDENT>def __init__(self, *args, **kwargs):<EOL><INDENT>self._normalized_name_mapping = {}<EOL>super(WorkingSetPlusEditableInstalls, self).__init__(*args, **kwargs)<EOL><DEDENT>def add_entry(self, entry):<EOL><INDENT>"""<STR_LIT>"""<EOL>logger.debug('<STR_LIT>', entry)<EOL>self.entry_keys.setdefault(entry, [])<EOL>self.entries.append(entry)<EOL>for dist in pkg_resources.find_distributions(entry, False):<EOL><INDENT>replace = (dist.precedence == pkg_resources.EGG_DIST)<EOL>self._normalized_name_mapping[normalize_name(dist.key)] = dist.key<EOL>self.add(dist, entry, False, replace=replace)<EOL><DEDENT><DEDENT>def find_normalized(self, req):<EOL><INDENT>req = _package_req_to_pkg_resources_req(str(req))<EOL>req.key = self._normalized_name_mapping.get(normalize_name(req.key), req.key)<EOL>return self.find(req)<EOL><DEDENT><DEDENT>return WorkingSetPlusEditableInstalls()<EOL>
return a pkg_resources "working set", representing the *currently* installed packages