Skip to content

exclude_glob doesn't respect ** operatorΒ #1269

@mcoconnor

Description

@mcoconnor

Context

One of the more useful tools in glob is being able to use the ** operator to match patterns at any point in the tree; however, that requires the recursive flag to be turned on in the glob.glob function: https://docs.python.org/3.9/library/glob.html#glob.glob

It appears that that has not been used:

for path in glob.glob(os.path.join(temp_project_path, glob_path)):

and
for path in glob.glob(os.path.join(temp_project_path, glob_path)):

However, the ** operator is used in the example in the docs:
https://github.com/zappa/Zappa/blame/f2f03ba8b58c9e2bdbbff7b5e8c905e3a8c08021/README.md#L951

Expected Behavior

An exclude_glob entry with a **, e.g. "**/__pycache__" should recurse through the directory tree to identify and eliminate matching paths

Actual Behavior

** operators are ignored by glob

Possible Fix

Add the recursive=True argument to each of the places where exclude_glob paths are used

Steps to Reproduce

  1. Identify a directory common to multiple paths in the project
  2. Add a matching glob path to exclude_glob
  3. Run zappa package
  4. Observe that the paths have not been removed from the packaged project

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-reviewNeeds attention from a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions