comparison mercurial/debugcommands.py @ 43687:f1dabf99db17

debugextensions: gracefully handle missing __file__ attributes This was crashing PyOxidizer. Differential Revision: https://phab.mercurial-scm.org/D7452
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 17 Nov 2019 01:34:52 -0500
parents 1fb19665c166
children a9b14ef701d1
comparison
equal deleted inserted replaced
43686:1fb19665c166 43687:f1dabf99db17
1027 exts = extensions.extensions(ui) 1027 exts = extensions.extensions(ui)
1028 hgver = util.version() 1028 hgver = util.version()
1029 fm = ui.formatter(b'debugextensions', opts) 1029 fm = ui.formatter(b'debugextensions', opts)
1030 for extname, extmod in sorted(exts, key=operator.itemgetter(0)): 1030 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
1031 isinternal = extensions.ismoduleinternal(extmod) 1031 isinternal = extensions.ismoduleinternal(extmod)
1032 extsource = pycompat.fsencode(extmod.__file__) 1032 extsource = None
1033
1034 if util.safehasattr(extmod, '__file__'):
1035 extsource = pycompat.fsencode(extmod.__file__)
1036 elif getattr(sys, 'oxidized', False):
1037 extsource = pycompat.sysexecutable
1033 if isinternal: 1038 if isinternal:
1034 exttestedwith = [] # never expose magic string to users 1039 exttestedwith = [] # never expose magic string to users
1035 else: 1040 else:
1036 exttestedwith = getattr(extmod, 'testedwith', b'').split() 1041 exttestedwith = getattr(extmod, 'testedwith', b'').split()
1037 extbuglink = getattr(extmod, 'buglink', None) 1042 extbuglink = getattr(extmod, 'buglink', None)