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

--ignore-dirs='.venv' has no effect #1091

Open
BrentHuang opened this issue Jun 30, 2024 · 6 comments
Open

--ignore-dirs='.venv' has no effect #1091

BrentHuang opened this issue Jun 30, 2024 · 6 comments

Comments

@BrentHuang
Copy link

--ignore-dirs='.venv' has no effect
v2.15.0

@akx
Copy link
Member

akx commented Jul 17, 2024

I can't reproduce this; see below.

By default, hidden (dot) directories are excluded by extraction; below, I'll have to explicitly opt in to not do that by setting --ignore-dirs by hand, and then it'll start extracting a whole lot.

$ docker run -it python:3.10 bash
root@6f2b64a305cd:/# cd $(mktemp -d)
root@6f2b64a305cd:/tmp/tmp.8ys8yjc9lV# python3.10 -m venv .venv
root@6f2b64a305cd:/tmp/tmp.8ys8yjc9lV# source .venv/bin/activate
(.venv) root@6f2b64a305cd:/tmp/tmp.8ys8yjc9lV# pip install babel
Successfully installed babel-2.15.0
(.venv) root@6f2b64a305cd:/tmp/tmp.8ys8yjc9lV# pybabel extract -o test.pot .
writing PO template file to test.pot
(.venv) root@6f2b64a305cd:/tmp/tmp.8ys8yjc9lV# pybabel extract --ignore-dirs=.venv -o test.pot .
writing PO template file to test.pot
(.venv) root@6f2b64a305cd:/tmp/tmp.8ys8yjc9lV# pybabel extract --ignore-dirs=blob -o test.pot .
extracting messages from .venv/lib/python3.10/site-packages/_distutils_hack/__init__.py
extracting messages from .venv/lib/python3.10/site-packages/_distutils_hack/override.py
extracting messages from .venv/lib/python3.10/site-packages/babel/__init__.py
extracting messages from .venv/lib/python3.10/site-packages/babel/core.py
extracting messages from .venv/lib/python3.10/site-packages/babel/dates.py
extracting messages from .venv/lib/python3.10/site-packages/babel/languages.py
...

Do you have specific repro steps?

@BrentHuang
Copy link
Author

pybabel extract --ignore-dirs=".venv build" -o test.pot .

when there are more than one.

@akx
Copy link
Member

akx commented Jul 18, 2024

Can you try

pybabel extract --ignore-dirs=.venv --ignore-dirs=build -o test.pot .

instead? The documentation for the option seems to be misleading.

@BrentHuang
Copy link
Author

Is it so troublesome? Why can't I write more than one in --ignore-dirs? This should be a bug.

@akx
Copy link
Member

akx commented Jul 19, 2024

I was hoping you could give that command a shot first to see if it works for you.

Anyway: If spaces were interpreted as separators in the single argument, how would you ignore translations in a directory that had spaces in its name, e.g. Other Project/?

@BrentHuang
Copy link
Author

BrentHuang commented Jul 22, 2024

Yes, I tried it and it worked.
You are right. When there are spaces in the directory name, either write it in multiple --ignore-dirs or escape the name in on --ignore-dirs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants