Skip to content

Commit

Permalink
Hardcode "ignore" method
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebleblanc authored and akx committed Dec 31, 2019
1 parent df9c01c commit c42bc9e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions babel/messages/extract.py
Expand Up @@ -236,9 +236,12 @@ def extract_from_file(method, filename, keywords=DEFAULT_KEYWORDS,
:returns: list of tuples of the form ``(lineno, message, comments, context)``
:rtype: list[tuple[int, str|tuple[str], list[str], str|None]
"""
if method == 'ignore':
return []

with open(filename, 'rb') as fileobj:
return list(extract(method, fileobj, keywords, comment_tags, options,
strip_comment_tags))
return list(extract(method, fileobj, keywords, comment_tags,
options, strip_comment_tags))


def extract(method, fileobj, keywords=DEFAULT_KEYWORDS, comment_tags=(),
Expand Down

0 comments on commit c42bc9e

Please sign in to comment.