Patchwork D328: setup: Fix installing in a mingw environment

login
register
mail settings
Submitter phabricator
Date Aug. 11, 2017, 12:52 a.m.
Message ID <differential-rev-PHID-DREV-wv4cgtnv6k52i6s25j37-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22836/
State Superseded
Headers show

Comments

phabricator - Aug. 11, 2017, 12:52 a.m.
glandium created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The addition, in https://phab.mercurial-scm.org/rHG9a4adc76c88a1a217983f051766b3009c0bca3aa, of a hack for the MSVC compiler class was
  overwriting the original class for the Mingw32CCompiler class, leading to an
  error when the HackedMingw32CCompiler is instantiated.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  setup.py

CHANGE DETAILS




To: glandium, #hg-reviewers
Cc: mercurial-devel
phabricator - Aug. 11, 2017, 1:01 a.m.
quark accepted this revision.
quark added a comment.


  Looks good to me. Bonus point if you can remove `_` so the variable names match the rest of the code.

REPOSITORY
  rHG Mercurial

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

To: glandium, #hg-reviewers, quark
Cc: quark, mercurial-devel
phabricator - Aug. 11, 2017, 1:17 a.m.
glandium added a comment.


  Sorry, I rebased to stable, and that created a new differential: https://phab.mercurial-scm.org/D329, even though I updated the local tag.

REPOSITORY
  rHG Mercurial

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

To: glandium, #hg-reviewers, quark
Cc: quark, mercurial-devel
phabricator - Aug. 11, 2017, 1:31 a.m.
quark added a comment.


  @glandium `phabsend` verifies the tags with old versions on Phabricator (so it requires obsstore to work properly). After https://phab.mercurial-scm.org/D122, it will be possible to `phabsend --amend` and `phabsend` will use the commit message to update corresponding diffs.

REPOSITORY
  rHG Mercurial

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

To: glandium, #hg-reviewers, quark
Cc: quark, mercurial-devel
phabricator - Aug. 11, 2017, 1:36 a.m.
quark requested changes to this revision.
quark added a comment.
This revision now requires changes to proceed.


  https://phab.mercurial-scm.org/D329 is a replacement. Maybe abandon this diff then.

REPOSITORY
  rHG Mercurial

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

To: glandium, #hg-reviewers, quark
Cc: quark, mercurial-devel

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -784,11 +784,11 @@ 
     from distutils import cygwinccompiler
 
     # the -mno-cygwin option has been deprecated for years
-    compiler = cygwinccompiler.Mingw32CCompiler
+    mingw32_compiler_class = cygwinccompiler.Mingw32CCompiler
 
     class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
         def __init__(self, *args, **kwargs):
-            compiler.__init__(self, *args, **kwargs)
+            mingw32_compiler_class.__init__(self, *args, **kwargs)
             for i in 'compiler compiler_so linker_exe linker_so'.split():
                 try:
                     getattr(self, i).remove('-mno-cygwin')
@@ -809,11 +809,11 @@ 
     # effect.
     from distutils import msvccompiler
 
-    compiler = msvccompiler.MSVCCompiler
+    msvc_compiler_class = msvccompiler.MSVCCompiler
 
     class HackedMSVCCompiler(msvccompiler.MSVCCompiler):
         def initialize(self):
-            compiler.initialize(self)
+            msvc_compiler_class.initialize(self)
             # "warning LNK4197: export 'func' specified multiple times"
             self.ldflags_shared.append('/ignore:4197')
             self.ldflags_shared_debug.append('/ignore:4197')