Skip to content

Commit

Permalink
never include any modules in the exclude list
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jan 13, 2025
1 parent 50c112b commit c03bd75
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,13 +892,14 @@ def remove_packages(*mods: str) -> None:
removes them from the "modules" and "packages" list and adds them to "excludes" list
"""
for m in list(modules):
for x in mods:
if m.startswith(x):
modules.remove(m)
break
if any(m.startswith(x) for x in mods):
modules.remove(m)
break
for p in list(packages):
if any(p.startswith(x) for x in mods):
packages.remove(p)
break
for x in mods:
if x in packages:
packages.remove(x)
if x not in excludes:
excludes.append(x)

Expand All @@ -907,15 +908,16 @@ def add_packages(*pkgs: str) -> None:
""" adds the given packages to the packages list,
and adds all the modules found in this package (including the package itself)
"""
for x in pkgs:
filtered_pkgs = tuple(pkg for pkg in pkgs if not any(pkg.startswith(exclude) for exclude in excludes))
for x in filtered_pkgs:
if x not in packages:
packages.append(x)
add_modules(*pkgs)
add_modules(*filtered_pkgs)


def add_modules(*mods: str) -> None:
def add(v):
if v not in modules:
if v not in modules and not any(v.startswith(exclude) for exclude in excludes):
modules.append(v)
do_add_modules(add, *mods)

Expand Down

0 comments on commit c03bd75

Please sign in to comment.