| 868 | | if not os.path.isdir(dirname): |
| 869 | | parser.error('%r is not a directory' % dirname) |
| | 869 | if os.path.isdir(dirname): |
| | 870 | def callback(filename, method, options): |
| | 871 | if method == 'ignore': |
| | 872 | return |
| | 873 | filepath = os.path.normpath(os.path.join(dirname, |
| | 874 | filename)) |
| | 875 | optstr = '' |
| | 876 | if options: |
| | 877 | optstr = ' (%s)' % ', '.join( |
| | 878 | ['%s="%s"' % (k, v) for k, v |
| | 879 | in options.items()]) |
| | 880 | self.log.info('extracting messages from %s%s', |
| | 881 | filepath, optstr) |
| 871 | | def callback(filename, method, options): |
| 872 | | if method == 'ignore': |
| 873 | | return |
| 874 | | filepath = os.path.normpath(os.path.join(dirname, filename)) |
| 875 | | optstr = '' |
| 876 | | if options: |
| 877 | | optstr = ' (%s)' % ', '.join(['%s="%s"' % (k, v) for |
| 878 | | k, v in options.items()]) |
| 879 | | self.log.info('extracting messages from %s%s', filepath, |
| 880 | | optstr) |
| | 883 | extracted = extract_from_dir(dirname, method_map, |
| | 884 | options_map, keywords, |
| | 885 | options.comment_tags, |
| | 886 | callback=callback) |
| | 887 | for filename, lineno, message, comments in extracted: |
| | 888 | filepath = os.path.normpath(os.path.join(dirname, |
| | 889 | filename)) |
| | 890 | catalog.add(message, None, [(filepath, lineno)], |
| | 891 | auto_comments=comments) |
| | 892 | else: |
| | 893 | extracted = extract_from_file( |
| | 894 | 'python', dirname, keywords, options.comment_tags) |
| | 895 | for lineno, message, comments in extracted: |
| | 896 | filepath = os.path.normpath(dirname) |
| | 897 | catalog.add(message, None, [(filepath, lineno)], |
| | 898 | auto_comments=comments) |
| 882 | | extracted = extract_from_dir(dirname, method_map, options_map, |
| 883 | | keywords, options.comment_tags, |
| 884 | | callback=callback) |
| 885 | | for filename, lineno, message, comments in extracted: |
| 886 | | filepath = os.path.normpath(os.path.join(dirname, filename)) |
| 887 | | catalog.add(message, None, [(filepath, lineno)], |
| 888 | | auto_comments=comments) |
| 889 | | |