Skip to content

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

Description

@BrentHuang

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

Activity

  1. akx commented on Jul 17, 2024

    @akx
    Member

    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?

  2. BrentHuang commented on Jul 18, 2024

    @BrentHuang
    Author

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

    when there are more than one.

  3. akx commented on Jul 18, 2024

    @akx
    Member

    Can you try

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

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

  4. BrentHuang commented on Jul 19, 2024

    @BrentHuang
    Author

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

  5. akx commented on Jul 19, 2024

    @akx
    Member

    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/?

  6. BrentHuang commented on Jul 22, 2024

    @BrentHuang
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions