i18n/hggettext
branchstable
changeset 33619 16a175b3681e
parent 29732 041fecbb588a
child 33836 97ee669f1f6d
equal deleted inserted replaced
33618:cc047a733f69 33619:16a175b3681e
   110         cmdtable = getattr(mod, 'table', {})
   110         cmdtable = getattr(mod, 'table', {})
   111     functions.extend((c[0], False) for c in cmdtable.itervalues())
   111     functions.extend((c[0], False) for c in cmdtable.itervalues())
   112 
   112 
   113     for func, rstrip in functions:
   113     for func, rstrip in functions:
   114         if func.__doc__:
   114         if func.__doc__:
       
   115             funcmod = inspect.getmodule(func)
       
   116             extra = ''
       
   117             if funcmod.__package__ == funcmod.__name__:
       
   118                 extra = '/__init__'
       
   119             actualpath = '%s%s.py' % (funcmod.__name__.replace('.', '/'), extra)
       
   120 
   115             src = inspect.getsource(func)
   121             src = inspect.getsource(func)
   116             name = "%s.%s" % (path, func.__name__)
   122             name = "%s.%s" % (actualpath, func.__name__)
   117             lineno = inspect.getsourcelines(func)[1]
   123             lineno = inspect.getsourcelines(func)[1]
   118             doc = func.__doc__
   124             doc = func.__doc__
   119             if rstrip:
   125             if rstrip:
   120                 doc = doc.rstrip()
   126                 doc = doc.rstrip()
   121             lineno += offset(src, doc, name, 1)
   127             lineno += offset(src, doc, name, 1)
   122             print(poentry(path, lineno, doc))
   128             print(poentry(actualpath, lineno, doc))
   123 
   129 
   124 
   130 
   125 def rawtext(path):
   131 def rawtext(path):
   126     src = open(path).read()
   132     src = open(path).read()
   127     print(poentry(path, 1, src))
   133     print(poentry(path, 1, src))