Skip to content

Commit

Permalink
use glob.escape() on the folder to allow paths with brackets []
Browse files Browse the repository at this point in the history
entrypoint fails to find the files if they are under a path with square brackets as glob tries to interpret them and fails.
Using `glob.escape(folder)` fixes that.
See ipython/ipython#11512 for details
  • Loading branch information
DerGenaue authored and takluyver committed Feb 2, 2022
1 parent 0399e68 commit 1819b2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ def iter_files_distros(path=None, repeated_distro='first'):

# Regular file imports (not egg, not zip file)
for path in itertools.chain(
glob.iglob(osp.join(folder, '*.dist-info', 'entry_points.txt')),
glob.iglob(osp.join(folder, '*.egg-info', 'entry_points.txt'))
glob.iglob(osp.join(glob.escape(folder), '*.dist-info', 'entry_points.txt')),
glob.iglob(osp.join(glob.escape(folder), '*.egg-info', 'entry_points.txt'))
):
distro_name_version = osp.splitext(osp.basename(osp.dirname(path)))[0]
distro = Distribution.from_name_version(distro_name_version)
Expand Down

0 comments on commit 1819b2f

Please sign in to comment.