Merge pull request #8528 from chrahunt/simplify-get-entrypoints

Remove redundant entrypoint text normalization
This commit is contained in:
Christopher Hunt 2020-07-03 09:10:10 -04:00 committed by GitHub
commit 8097de5364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -122,16 +122,8 @@ def get_entrypoints(filename):
if not os.path.exists(filename):
return {}, {}
# This is done because you can pass a string to entry_points wrappers which
# means that they may or may not be valid INI files. The attempt here is to
# strip leading and trailing whitespace in order to make them valid INI
# files.
with io.open(filename, encoding="utf-8") as fp:
data = io.StringIO()
for line in fp:
data.write(line.strip())
data.write(u"\n")
data.seek(0)
data = fp.read()
# get the entry points and then the script names
entry_points = pkg_resources.EntryPoint.parse_map(data)