##// END OF EJS Templates
extensions: process disabled external paths when `hgext` package is in-memory...
Matt Harbison -
r50671:9d8757dd stable
parent child Browse files
Show More
@@ -729,6 +729,8 b' def _disabledpaths():'
729 '''find paths of disabled extensions. returns a dict of {name: path}'''
729 '''find paths of disabled extensions. returns a dict of {name: path}'''
730 import hgext
730 import hgext
731
731
732 exts = {}
733
732 # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and
734 # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and
733 # it might not be on a filesystem even if it does.
735 # it might not be on a filesystem even if it does.
734 if util.safehasattr(hgext, '__file__'):
736 if util.safehasattr(hgext, '__file__'):
@@ -738,23 +740,21 b' def _disabledpaths():'
738 try:
740 try:
739 files = os.listdir(extpath)
741 files = os.listdir(extpath)
740 except OSError:
742 except OSError:
741 return {}
743 pass
742 else:
744 else:
743 return {}
745 for e in files:
746 if e.endswith(b'.py'):
747 name = e.rsplit(b'.', 1)[0]
748 path = os.path.join(extpath, e)
749 else:
750 name = e
751 path = os.path.join(extpath, e, b'__init__.py')
752 if not os.path.exists(path):
753 continue
754 if name in exts or name in _order or name == b'__init__':
755 continue
756 exts[name] = path
744
757
745 exts = {}
746 for e in files:
747 if e.endswith(b'.py'):
748 name = e.rsplit(b'.', 1)[0]
749 path = os.path.join(extpath, e)
750 else:
751 name = e
752 path = os.path.join(extpath, e, b'__init__.py')
753 if not os.path.exists(path):
754 continue
755 if name in exts or name in _order or name == b'__init__':
756 continue
757 exts[name] = path
758 for name, path in _disabledextensions.items():
758 for name, path in _disabledextensions.items():
759 # If no path was provided for a disabled extension (e.g. "color=!"),
759 # If no path was provided for a disabled extension (e.g. "color=!"),
760 # don't replace the path we already found by the scan above.
760 # don't replace the path we already found by the scan above.
General Comments 0
You need to be logged in to leave comments. Login now