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 not working for multiple directories #1094

Closed
john-psina opened this issue Jul 5, 2024 · 3 comments
Closed

--ignore-dirs not working for multiple directories #1094

john-psina opened this issue Jul 5, 2024 · 3 comments

Comments

@john-psina
Copy link
Contributor

Overview Description

When trying to add several folders to --exclude-dirs, the filter stops working and all folders in the project are taken.

Steps to Reproduce

  1. pybabel extract --input-dirs=. --ignore-dirs="venv* alembic*" -o locales/messages.pot
  2. The filter does not work at all

Actual Results

extracting messages from notify.py
extracting messages from alembic\env.py
extracting messages from alembic\versions\673b7ac42339_.py
...
extracting messages from alembic\versions\f5247959f18a_.py
extracting messages from venv\Lib\site-packages_virtualenv.py
...
extracting messages from venv\Lib\site-packages\aiogram_init_.py
extracting messages from venv\Lib\site-packages\aiogram_meta_.py
extracting messages from venv\Lib\site-packages\aiogram\exceptions.py
extracting messages from venv\Lib\site-packages\aiogram\loggers.py
extracting messages from venv\Lib\site-packages\aiogram\client_init_.py
extracting messages from venv\Lib\site-packages\aiogram\client\bot.py
extracting messages from venv\Lib\site-packages\aiogram\client\context_controller.py
extracting messages from venv\Lib\site-packages\aiogram\client\default.py
extracting messages from venv\Lib\site-packages\aiogram\client\telegram.py

Expected Results

extracting messages from notify.py

Additional Information

I decided to look into the problem, so I looked into the code. I found that the problem occurs in the call to the "_make_directory_filter" function. self.ignore_dirs is passed inside the function, which is not separated by spaces. A few strips of code above is the following code:


ignore_dirs = listify_value(self.ignore_dirs)
    if ignore_dirs:
        self.directory_filter = _make_directory_filter(self.ignore_dirs)
    ...

I assume that instead of "self.ignore_dirs" you need to pass "ignore_dirs" to the function. Otherwise, it turns out that the _make_directory_filter function accepts a list of one string, while it is intended to accept a list of strings that were previously separated by spaces.

@john-psina
Copy link
Contributor Author

john-psina commented Jul 5, 2024

I really don't want to fork the repository just to change a single line of code, so I tried to provide as much detail as possible about the problem and suggested a solution. I hope you can fix this problem as soon as possible

john-psina added a commit to john-psina/babel that referenced this issue Jul 6, 2024
akx pushed a commit that referenced this issue Jul 10, 2024
@tomasr8
Copy link
Member

tomasr8 commented Jul 11, 2024

@john-psina Would you like to submit a PR with a fix?

@akx
Copy link
Member

akx commented Jul 17, 2024

This was fixed via #1095, I believe :)

@akx akx closed this as completed Jul 17, 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

3 participants