Hardcode "ignore" method#678
Closed
sebleblanc wants to merge 1 commit intopython-babel:masterfrom
sebleblanc:sebleblanc-no-open-ignore
Closed
Hardcode "ignore" method#678sebleblanc wants to merge 1 commit intopython-babel:masterfrom sebleblanc:sebleblanc-no-open-ignore
sebleblanc wants to merge 1 commit intopython-babel:masterfrom
sebleblanc:sebleblanc-no-open-ignore
Conversation
The "ignore" method used to force the opening of the file. Some editors (emacs) create symbolic links to use as synchronization locks. Those links have an extension that matches the opened file, but the links themselves do not point to an existing file, thus causing Babel to attempt to open a file that does not exist. This fix skips opening of a file altogether when using the method "ignore" in the mapping file.
akx
requested changes
Dec 31, 2019
Member
akx
left a comment
There was a problem hiding this comment.
Aside from that else: nitpick, this looks good, thank you!
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "ignore" method forces the opening of a file, but this is pointless.
Some editors (emacs) create symbolic links to use as synchronization locks. These links have an extension that matches the opened file, but the links themselves do not point to an existing file, thus causing Babel to attempt to open a file that does not exist.
For example, on my machine, I have a file opened in my editor (project/i18n.py) resulting in the following link being created:
Babel will catch this file with the default
**.pymapping, so I created a mapping with the pattern[ignore: **/.*]thinking it would ignore all files beginning with a dot, but instead, it pointlessly attempts to open such files and pass them through a "no-op" processor. Since it does not discriminate against links, this results in a FileNotFoundError, aborting extraction of all messages.This fix skips opening of a file altogether when using the method "ignore" in the mapping file, by short-circuiting the
extract_from_filefunction when the method matches "ignore".Maybe Babel should by default silently skip a file when: