629 |
629 |
630 log.info('using %s as Python library name' % pythonlib) |
630 log.info('using %s as Python library name' % pythonlib) |
631 with open('mercurial/hgpythonlib.h', 'wb') as f: |
631 with open('mercurial/hgpythonlib.h', 'wb') as f: |
632 f.write(b'/* this file is autogenerated by setup.py */\n') |
632 f.write(b'/* this file is autogenerated by setup.py */\n') |
633 f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib) |
633 f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib) |
|
634 |
|
635 macros = None |
|
636 if sys.version_info[0] >= 3: |
|
637 macros = [('_UNICODE', None), ('UNICODE', None)] |
|
638 |
634 objects = self.compiler.compile(['mercurial/exewrapper.c'], |
639 objects = self.compiler.compile(['mercurial/exewrapper.c'], |
635 output_dir=self.build_temp) |
640 output_dir=self.build_temp, |
|
641 macros=macros) |
636 dir = os.path.dirname(self.get_ext_fullpath('dummy')) |
642 dir = os.path.dirname(self.get_ext_fullpath('dummy')) |
637 self.hgtarget = os.path.join(dir, 'hg') |
643 self.hgtarget = os.path.join(dir, 'hg') |
638 self.compiler.link_executable(objects, self.hgtarget, |
644 self.compiler.link_executable(objects, self.hgtarget, |
639 libraries=[], |
645 libraries=[], |
640 output_dir=self.build_temp) |
646 output_dir=self.build_temp) |