setup: build exewrapper with Unicode support on py3
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 19 Oct 2018 18:34:42 -0400
changeset 40397 36b134c436b8
parent 40396 973ff03d9bc0
child 40398 0ac794e0e285
setup: build exewrapper with Unicode support on py3 I didn't see a compiler switch documented anywhere, but I diffed the command line for full VC++ project when toggling between MBCS and Unicode. This is all they do.
setup.py
--- a/setup.py	Fri Oct 19 18:32:13 2018 -0400
+++ b/setup.py	Fri Oct 19 18:34:42 2018 -0400
@@ -631,8 +631,14 @@
         with open('mercurial/hgpythonlib.h', 'wb') as f:
             f.write(b'/* this file is autogenerated by setup.py */\n')
             f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib)
+
+        macros = None
+        if sys.version_info[0] >= 3:
+            macros = [('_UNICODE', None), ('UNICODE', None)]
+
         objects = self.compiler.compile(['mercurial/exewrapper.c'],
-                                         output_dir=self.build_temp)
+                                         output_dir=self.build_temp,
+                                         macros=macros)
         dir = os.path.dirname(self.get_ext_fullpath('dummy'))
         self.hgtarget = os.path.join(dir, 'hg')
         self.compiler.link_executable(objects, self.hgtarget,