Show More
@@ -134,42 +134,46 b' def pathdirs():' | |||
|
134 | 134 | def disabled(): |
|
135 | 135 | '''find disabled extensions from hgext |
|
136 | 136 | returns a dict of {name: desc}, and the max name length''' |
|
137 | ||
|
138 | import hgext | |
|
139 | extpath = os.path.dirname(os.path.abspath(hgext.__file__)) | |
|
140 | ||
|
137 | 141 | exts = {} |
|
138 | 142 | maxlength = 0 |
|
139 | for dir in filter(os.path.isdir, | |
|
140 | (os.path.join(pd, 'hgext') for pd in pathdirs())): | |
|
141 | for e in os.listdir(dir): | |
|
142 | if e.endswith('.py'): | |
|
143 | name = e.rsplit('.', 1)[0] | |
|
144 | path = os.path.join(dir, e) | |
|
145 | else: | |
|
146 | name = e | |
|
147 | path = os.path.join(dir, e, '__init__.py') | |
|
143 | for e in os.listdir(extpath): | |
|
148 | 144 | |
|
149 | if name in exts or name == '__init__' or not os.path.exists(path): | |
|
150 | continue | |
|
145 | if e.endswith('.py'): | |
|
146 | name = e.rsplit('.', 1)[0] | |
|
147 | path = os.path.join(extpath, e) | |
|
148 | else: | |
|
149 | name = e | |
|
150 | path = os.path.join(extpath, e, '__init__.py') | |
|
151 | ||
|
152 | if name in exts or name == '__init__' or not os.path.exists(path): | |
|
153 | continue | |
|
151 | 154 | |
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
|
155 | try: | |
|
156 | find(name) | |
|
157 | except KeyError: | |
|
158 | pass | |
|
159 | else: | |
|
160 | continue # enabled extension | |
|
158 | 161 | |
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|
162 | try: | |
|
163 | file = open(path) | |
|
164 | except IOError: | |
|
165 | continue | |
|
166 | else: | |
|
167 | doc = help.moduledoc(file) | |
|
168 | file.close() | |
|
166 | 169 | |
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 | if len(name) > maxlength: | |
|
172 | maxlength = len(name) | |
|
170 | if doc: # extracting localized synopsis | |
|
171 | exts[name] = gettext(doc).splitlines()[0] | |
|
172 | else: | |
|
173 | exts[name] = _('(no help text available)') | |
|
174 | ||
|
175 | if len(name) > maxlength: | |
|
176 | maxlength = len(name) | |
|
173 | 177 | |
|
174 | 178 | return exts, maxlength |
|
175 | 179 |
General Comments 0
You need to be logged in to leave comments.
Login now