comparison setup.py @ 17061:f20e4d76b711

setup: compile hg.exe This implements a new command $ python setup.py build_hgexe -i which places the hg.exe in the root of the source tree.
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 29 Jun 2012 13:10:48 +0200
parents e6af8676302f
children d13f47c800fd
comparison
equal deleted inserted replaced
17060:69fa0459dd3b 17061:f20e4d76b711
333 f.write('# this file is autogenerated by setup.py\n') 333 f.write('# this file is autogenerated by setup.py\n')
334 f.write('docs = ') 334 f.write('docs = ')
335 f.write(out) 335 f.write(out)
336 f.close() 336 f.close()
337 337
338 class buildhgexe(build_ext):
339 description = 'compile hg.exe from mercurial/exewrapper.c'
340
341 def build_extensions(self):
342 if os.name != 'nt':
343 return
344 objects = self.compiler.compile(['mercurial/exewrapper.c'],
345 output_dir=self.build_temp)
346 dir = os.path.dirname(self.get_ext_fullpath('dummy'))
347 target = os.path.join(dir, 'hg')
348 self.compiler.link_executable(objects, target,
349 output_dir=self.build_temp)
350
338 class hginstallscripts(install_scripts): 351 class hginstallscripts(install_scripts):
339 ''' 352 '''
340 This is a specialization of install_scripts that replaces the @LIBDIR@ with 353 This is a specialization of install_scripts that replaces the @LIBDIR@ with
341 the configured directory for modules. If possible, the path is made relative 354 the configured directory for modules. If possible, the path is made relative
342 to the directory for scripts. 355 to the directory for scripts.
384 cmdclass = {'build': hgbuild, 397 cmdclass = {'build': hgbuild,
385 'build_mo': hgbuildmo, 398 'build_mo': hgbuildmo,
386 'build_ext': hgbuildext, 399 'build_ext': hgbuildext,
387 'build_py': hgbuildpy, 400 'build_py': hgbuildpy,
388 'build_hgextindex': buildhgextindex, 401 'build_hgextindex': buildhgextindex,
389 'install_scripts': hginstallscripts} 402 'install_scripts': hginstallscripts,
403 'build_hgexe': buildhgexe,
404 }
390 405
391 packages = ['mercurial', 'mercurial.hgweb', 'mercurial.httpclient', 406 packages = ['mercurial', 'mercurial.hgweb', 'mercurial.httpclient',
392 'hgext', 'hgext.convert', 'hgext.highlight', 'hgext.zeroconf', 407 'hgext', 'hgext.convert', 'hgext.highlight', 'hgext.zeroconf',
393 'hgext.largefiles'] 408 'hgext.largefiles']
394 409