setup.py
changeset 17732 93d97a212559
parent 17709 b7fff47bb128
child 17926 65a46635fb31
--- a/setup.py	Mon Oct 08 16:46:11 2012 -0500
+++ b/setup.py	Tue Aug 07 11:04:41 2012 +0200
@@ -344,14 +344,18 @@
         if isinstance(self.compiler, HackedMingw32CCompiler):
             self.compiler.compiler_so = self.compiler.compiler # no -mdll
             self.compiler.dll_libraries = [] # no -lmsrvc90
+        hv = sys.hexversion
+        pythonlib = 'python%d%d' % (hv >> 24, (hv >> 16) & 0xff)
+        f = open('mercurial/hgpythonlib.h', 'wb')
+        f.write('/* this file is autogenerated by setup.py */\n')
+        f.write('#define HGPYTHONLIB "%s"\n' % pythonlib)
+        f.close()
         objects = self.compiler.compile(['mercurial/exewrapper.c'],
                                          output_dir=self.build_temp)
         dir = os.path.dirname(self.get_ext_fullpath('dummy'))
         target = os.path.join(dir, 'hg')
-        pythonlib = ("python%d%d" %
-               (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
         self.compiler.link_executable(objects, target,
-                                      libraries=[pythonlib],
+                                      libraries=[],
                                       output_dir=self.build_temp)
 
 class hginstallscripts(install_scripts):