Patchwork D8142: setup: exclude the __index__ module from itself when generating

login
register
mail settings
Submitter phabricator
Date Feb. 24, 2020, 5:35 a.m.
Message ID <differential-rev-PHID-DREV-5qv7fyrmhbwwod4tj6jw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45292/
State Superseded
Headers show

Comments

phabricator - Feb. 24, 2020, 5:35 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This module is generated on Windows to hold all of the extension names and the
  help summaries, so that they are discoverable inside the py2exe zipfile.  The
  problem is this file is generated by dumping the disabled list, and that list
  comes from walking the filesystem.  So once an install from source into a
  virtualenv created this module, then next build from source from that virtualenv
  would also see __index__.py in the filesystem, and include it.  Clearly that's
  wrong because this isn't a real extension, so just filter it from the list when
  generating it.
  
  The Mercurial installer was unaffected by this, but the TortoiseHg package was.
  In the final package, `hg help -v extensions` and the panel of extensions both
  showed it.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D8142

AFFECTED FILES
  setup.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 24, 2020, 3:40 p.m.
marmoute added a comment.
marmoute accepted this revision.


  This looks good to me.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8142/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8142

To: mharbison72, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -665,7 +665,9 @@ 
         # here no extension enabled, disabled() lists up everything
         code = (
             'import pprint; from mercurial import extensions; '
-            'pprint.pprint(extensions.disabled())'
+            'ext = extensions.disabled();'
+            'ext.pop("__index__", None);'
+            'pprint.pprint(ext)'
         )
         returncode, out, err = runcmd(
             [sys.executable, '-c', code], localhgenv()