mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
setup.py, make: avoid problems with outdated, existing hgext/__index__.py*
"make clean" already removed __index__.py[cdo], but not the __index__.py (automatically generated by "python setup.py build_hgextindex"). "setup.py build_hgextindex" did not generate a new index if file __index__.py[cdo] already existed, because if __index__.py was removed, the compiled file containing the old information was imported and used. Generate an empty file (with a new timestamp to generate a new .py[cdo]) instead and make mercurial.extensions ignore the unset docs attribute. One of the problems was a failed test-help.t, to reproduce: $ rm hgext/__index__.py* $ echo 'docs = {"mq": "dummy"}' > hgext/__index__.py $ make test-help.t With this a "make clean" or "python setup.py build_hgextindex" helps.
This commit is contained in:
parent
99c7bacd5e
commit
aedd3b060c
2
Makefile
2
Makefile
@ -56,7 +56,7 @@ clean:
|
||||
find contrib doc hgext i18n mercurial tests \
|
||||
\( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
|
||||
rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
|
||||
rm -f MANIFEST MANIFEST.in mercurial/__version__.py tests/*.err
|
||||
rm -f MANIFEST MANIFEST.in mercurial/__version__.py hgext/__index__.py tests/*.err
|
||||
rm -rf build mercurial/locale
|
||||
$(MAKE) -C doc clean
|
||||
|
||||
|
@ -281,7 +281,7 @@ def disabled():
|
||||
return dict((name, gettext(desc))
|
||||
for name, desc in __index__.docs.iteritems()
|
||||
if name not in _order)
|
||||
except ImportError:
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
paths = _disabledpaths()
|
||||
@ -304,7 +304,7 @@ def disabledext(name):
|
||||
return
|
||||
else:
|
||||
return gettext(__index__.docs.get(name))
|
||||
except ImportError:
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
paths = _disabledpaths()
|
||||
|
4
setup.py
4
setup.py
@ -331,7 +331,9 @@ class buildhgextindex(Command):
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self._indexfilename):
|
||||
os.unlink(self._indexfilename)
|
||||
f = open(self._indexfilename, 'w')
|
||||
f.write('# empty\n')
|
||||
f.close()
|
||||
|
||||
# here no extension enabled, disabled() lists up everything
|
||||
code = ('import pprint; from mercurial import extensions; '
|
||||
|
Loading…
Reference in New Issue
Block a user