babel
babel copied to clipboard
--ignore-dirs='.venv' has no effect
--ignore-dirs='.venv' has no effect
v2.15.0
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?
pybabel extract --ignore-dirs=".venv build" -o test.pot .
when there are more than one.
Can you try
pybabel extract --ignore-dirs=.venv --ignore-dirs=build -o test.pot .
instead? The documentation for the option seems to be misleading.
Is it so troublesome? Why can't I write more than one in --ignore-dirs? This should be a bug.
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/?
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.