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

rose-arch add option to exclude file matching a pattern #2752

Open
ColemanTom opened this issue Dec 21, 2023 · 1 comment
Open

rose-arch add option to exclude file matching a pattern #2752

ColemanTom opened this issue Dec 21, 2023 · 1 comment
Milestone

Comments

@ColemanTom
Copy link
Contributor

I was wondering if rose-arch could be extended to exclude files matching a glob pattern? I have not looked into how rose-arch works, but with tar at least, you can use the --exclude option to exclude patterns. I think this would be a useful addition so you could archive a directory and just have some exclude patterns instead of being too specific about which files to include if there is a lot of options.

@oliver-sanders
Copy link
Member

I think it's expanding globs Python side using the glob library:

for source_glob in shlex.split(
self._get_conf(config, t_node, "source", compulsory=True)
):
is_compulsory_source = is_compulsory_target
if source_glob.startswith("(") and source_glob.endswith(")"):
source_glob = source_glob[1:-1]
is_compulsory_source = False
paths = glob(source_prefix + source_glob)

(But I'm not familiar with this code)

If that's right, then we should be able to do whatever we want with this.

Sadly, there isn't any implementation of extglob in the Python standard library, but we could have a separate exclusion glob to filter by.

Possibly worth mentioning fnamematch which is a drop in replacement for Python's glob which extends the syntax a little which might be useful for fine control over inclusion/exclusion.

@oliver-sanders oliver-sanders added this to the back-burner milestone Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants