MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Tools/i18n/pygettext.py:686–843  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

684
685
686def main():
687 try:
688 opts, args = getopt.getopt(
689 sys.argv[1:],
690 'ac::d:DEhk:Kno:p:S:Vvw:x:X:',
691 ['extract-all', 'add-comments=?', 'default-domain=', 'escape',
692 'help', 'keyword=', 'no-default-keywords',
693 'add-location', 'no-location', 'output=', 'output-dir=',
694 'style=', 'verbose', 'version', 'width=', 'exclude-file=',
695 'docstrings', 'no-docstrings',
696 ])
697 except getopt.error as msg:
698 usage(1, msg)
699
700 # for holding option values
701 class Options:
702 # constants
703 GNU = 1
704 SOLARIS = 2
705 # defaults
706 extractall = 0 # FIXME: currently this option has no effect at all.
707 escape = 0
708 keywords = []
709 outpath = ''
710 outfile = 'messages.pot'
711 writelocations = 1
712 locationstyle = GNU
713 verbose = 0
714 width = 78
715 excludefilename = ''
716 docstrings = 0
717 nodocstrings = {}
718 comment_tags = set()
719
720 options = Options()
721 locations = {'gnu' : options.GNU,
722 'solaris' : options.SOLARIS,
723 }
724 no_default_keywords = False
725 # parse options
726 for opt, arg in opts:
727 if opt in ('-h', '--help'):
728 usage(0)
729 elif opt in ('-a', '--extract-all'):
730 print("DeprecationWarning: -a/--extract-all is not implemented and will be removed in a future version",
731 file=sys.stderr)
732 options.extractall = 1
733 elif opt in ('-c', '--add-comments'):
734 options.comment_tags.add(arg)
735 elif opt in ('-d', '--default-domain'):
736 options.outfile = arg + '.pot'
737 elif opt in ('-E', '--escape'):
738 options.escape = 1
739 elif opt in ('-D', '--docstrings'):
740 options.docstrings = 1
741 elif opt in ('-k', '--keyword'):
742 options.keywords.append(arg)
743 elif opt in ('-K', '--no-default-keywords'):

Callers 1

pygettext.pyFile · 0.70

Calls 15

visit_fileMethod · 0.95
make_escapesFunction · 0.85
process_keywordsFunction · 0.85
getFilesForNameFunction · 0.85
GettextVisitorClass · 0.85
write_pot_fileFunction · 0.85
usageFunction · 0.70
OptionsClass · 0.70
openFunction · 0.50
addMethod · 0.45
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…