setup.py
changeset 39608 ec68135a8935
parent 39572 b6b9488aae4c
child 39613 96bffce40f5b
equal deleted inserted replaced
39607:5362c96f2feb 39608:ec68135a8935
   608         filelen = _kernel32.GetModuleFileNameA(sys.dllhandle, ctypes.byref(buf),
   608         filelen = _kernel32.GetModuleFileNameA(sys.dllhandle, ctypes.byref(buf),
   609                                                size)
   609                                                size)
   610 
   610 
   611         if filelen > 0 and filelen != size:
   611         if filelen > 0 and filelen != size:
   612             dllbasename = os.path.basename(buf.value)
   612             dllbasename = os.path.basename(buf.value)
   613             if not dllbasename.lower().endswith('.dll'):
   613             if not dllbasename.lower().endswith(b'.dll'):
   614                 raise SystemExit('Python DLL does not end with .dll: %s' %
   614                 raise SystemExit('Python DLL does not end with .dll: %s' %
   615                                  dllbasename)
   615                                  dllbasename)
   616             pythonlib = dllbasename[:-4]
   616             pythonlib = dllbasename[:-4]
   617         else:
   617         else:
   618             log.warn('could not determine Python DLL filename; '
   618             log.warn('could not determine Python DLL filename; '
   621             hv = sys.hexversion
   621             hv = sys.hexversion
   622             pythonlib = 'python%d%d' % (hv >> 24, (hv >> 16) & 0xff)
   622             pythonlib = 'python%d%d' % (hv >> 24, (hv >> 16) & 0xff)
   623 
   623 
   624         log.info('using %s as Python library name' % pythonlib)
   624         log.info('using %s as Python library name' % pythonlib)
   625         with open('mercurial/hgpythonlib.h', 'wb') as f:
   625         with open('mercurial/hgpythonlib.h', 'wb') as f:
   626             f.write('/* this file is autogenerated by setup.py */\n')
   626             f.write(b'/* this file is autogenerated by setup.py */\n')
   627             f.write('#define HGPYTHONLIB "%s"\n' % pythonlib)
   627             f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib)
   628         objects = self.compiler.compile(['mercurial/exewrapper.c'],
   628         objects = self.compiler.compile(['mercurial/exewrapper.c'],
   629                                          output_dir=self.build_temp)
   629                                          output_dir=self.build_temp)
   630         dir = os.path.dirname(self.get_ext_fullpath('dummy'))
   630         dir = os.path.dirname(self.get_ext_fullpath('dummy'))
   631         self.hgtarget = os.path.join(dir, 'hg')
   631         self.hgtarget = os.path.join(dir, 'hg')
   632         self.compiler.link_executable(objects, self.hgtarget,
   632         self.compiler.link_executable(objects, self.hgtarget,
   998     extra['zipfile'] = 'lib/library.zip'
   998     extra['zipfile'] = 'lib/library.zip'
   999 
   999 
  1000 if os.name == 'nt':
  1000 if os.name == 'nt':
  1001     # Windows binary file versions for exe/dll files must have the
  1001     # Windows binary file versions for exe/dll files must have the
  1002     # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
  1002     # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
  1003     setupversion = version.split('+', 1)[0]
  1003     setupversion = version.split(b'+', 1)[0]
  1004 
  1004 
  1005 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
  1005 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
  1006     version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[1].splitlines()
  1006     version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[1].splitlines()
  1007     if version:
  1007     if version:
  1008         version = version[0]
  1008         version = version[0]