Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing glob2 and replacing with glob(,recursive=True) where used. #5005

Merged
merged 8 commits into from
Sep 25, 2023

Conversation

ryanskeith
Copy link
Contributor

@ryanskeith ryanskeith commented Sep 15, 2023

Description

Removed glob2 from code, requirements and recipes.

  • Removed code
  • Replaced all places with glob(..., recursive=True) for same functionality.
  • glob2.fnmatch.fnmatch references seem to be the simple cases of fnmatch

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Sep 15, 2023
news/4792-remove-glob2 Outdated Show resolved Hide resolved
conda_build/build.py Outdated Show resolved Hide resolved
conda_build/utils.py Outdated Show resolved Hide resolved
@kenodegard
Copy link
Contributor

pre-commit.ci autofix

@ryanskeith
Copy link
Contributor Author

This is addressing #4792.

@dholth
Copy link
Contributor

dholth commented Sep 22, 2023

How does this compare to https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob ?

@ryanskeith
Copy link
Contributor Author

How does this compare to https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob ?

In general @dholth, or is there a specific instance?

@kenodegard
Copy link
Contributor

@dholth comparing glob2, glob, and pathlib for ** globbing, pathlib only matches dirs (including the root dir) while glob2/glob matches any path:

$ ls -lahR
total 0
drwxr-xr-x@  4 kodegard  staff   128B Sep 25 11:29 .
drwxr-xr-x  77 kodegard  staff   2.4K Sep 25 11:29 ..
-rw-r--r--@  1 kodegard  staff     0B Sep 25 11:29 file
drwxr-xr-x@  4 kodegard  staff   128B Sep 25 11:29 nested

./nested:
total 0
drwxr-xr-x@ 4 kodegard  staff   128B Sep 25 11:29 .
drwxr-xr-x@ 4 kodegard  staff   128B Sep 25 11:29 ..
-rw-r--r--@ 1 kodegard  staff     0B Sep 25 11:29 file
drwxr-xr-x@ 3 kodegard  staff    96B Sep 25 11:29 nested

./nested/nested:
total 0
drwxr-xr-x@ 3 kodegard  staff    96B Sep 25 11:29 .
drwxr-xr-x@ 4 kodegard  staff   128B Sep 25 11:29 ..
-rw-r--r--@ 1 kodegard  staff     0B Sep 25 11:29 file

$ python - <<HEREDOC
import glob2, glob, pathlib
print(*glob2.glob('**'))
print(*glob.glob('**', recursive=True))
print(*pathlib.Path.cwd().glob('**'))
HEREDOC
file nested nested/file nested/nested nested/nested/file
file nested nested/file nested/nested nested/nested/file
/Users/kodegard/scratch/glob /Users/kodegard/scratch/glob/nested /Users/kodegard/scratch/glob/nested/nested

@kenodegard kenodegard merged commit ce91aa5 into conda:main Sep 25, 2023
@ryanskeith ryanskeith deleted the issue/4792 branch December 1, 2023 18:26
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Dec 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants