##// END OF EJS Templates
setup: add command to generate index of extensions...
Yuya Nishihara -
r14538:3818c67a default
parent child Browse files
Show More
@@ -35,6 +35,7 b' tags'
35 cscope.*
35 cscope.*
36 i18n/hg.pot
36 i18n/hg.pot
37 locale/*/LC_MESSAGES/hg.mo
37 locale/*/LC_MESSAGES/hg.mo
38 hgext/__index__.py
38
39
39 # files installed with a local --pure build
40 # files installed with a local --pure build
40 mercurial/base85.py
41 mercurial/base85.py
@@ -56,7 +56,7 b' import os, subprocess, time'
56 import shutil
56 import shutil
57 import tempfile
57 import tempfile
58 from distutils import log
58 from distutils import log
59 from distutils.core import setup, Extension
59 from distutils.core import setup, Command, Extension
60 from distutils.dist import Distribution
60 from distutils.dist import Distribution
61 from distutils.command.build import build
61 from distutils.command.build import build
62 from distutils.command.build_ext import build_ext
62 from distutils.command.build_ext import build_ext
@@ -64,7 +64,7 b' from distutils.command.build_py import b'
64 from distutils.command.install_scripts import install_scripts
64 from distutils.command.install_scripts import install_scripts
65 from distutils.spawn import spawn, find_executable
65 from distutils.spawn import spawn, find_executable
66 from distutils.ccompiler import new_compiler
66 from distutils.ccompiler import new_compiler
67 from distutils.errors import CCompilerError
67 from distutils.errors import CCompilerError, DistutilsExecError
68 from distutils.sysconfig import get_python_inc
68 from distutils.sysconfig import get_python_inc
69 from distutils.version import StrictVersion
69 from distutils.version import StrictVersion
70
70
@@ -260,6 +260,34 b' class hgbuildpy(build_py):'
260 else:
260 else:
261 yield module
261 yield module
262
262
263 class buildhgextindex(Command):
264 description = 'generate prebuilt index of hgext (for frozen package)'
265 user_options = []
266 _indexfilename = 'hgext/__index__.py'
267
268 def initialize_options(self):
269 pass
270
271 def finalize_options(self):
272 pass
273
274 def run(self):
275 if os.path.exists(self._indexfilename):
276 os.unlink(self._indexfilename)
277
278 # here no extension enabled, disabled() lists up everything
279 code = ('import pprint; from mercurial import extensions; '
280 'pprint.pprint(extensions.disabled())')
281 out, err = runcmd([sys.executable, '-c', code], env)
282 if err:
283 raise DistutilsExecError(err)
284
285 f = open(self._indexfilename, 'w')
286 f.write('# this file is autogenerated by setup.py\n')
287 f.write('docs = ')
288 f.write(out)
289 f.close()
290
263 class hginstallscripts(install_scripts):
291 class hginstallscripts(install_scripts):
264 '''
292 '''
265 This is a specialization of install_scripts that replaces the @LIBDIR@ with
293 This is a specialization of install_scripts that replaces the @LIBDIR@ with
@@ -309,6 +337,7 b' class hginstallscripts(install_scripts):'
309 cmdclass = {'build_mo': hgbuildmo,
337 cmdclass = {'build_mo': hgbuildmo,
310 'build_ext': hgbuildext,
338 'build_ext': hgbuildext,
311 'build_py': hgbuildpy,
339 'build_py': hgbuildpy,
340 'build_hgextindex': buildhgextindex,
312 'install_scripts': hginstallscripts}
341 'install_scripts': hginstallscripts}
313
342
314 packages = ['mercurial', 'mercurial.hgweb',
343 packages = ['mercurial', 'mercurial.hgweb',
@@ -373,6 +402,8 b' if py2exeloaded:'
373 {'script':'hg',
402 {'script':'hg',
374 'copyright':'Copyright (C) 2005-2010 Matt Mackall and others',
403 'copyright':'Copyright (C) 2005-2010 Matt Mackall and others',
375 'product_version':version}]
404 'product_version':version}]
405 # sub command of 'build' because 'py2exe' does not handle sub_commands
406 build.sub_commands.insert(0, ('build_hgextindex', None))
376
407
377 if os.name == 'nt':
408 if os.name == 'nt':
378 # Windows binary file versions for exe/dll files must have the
409 # Windows binary file versions for exe/dll files must have the
General Comments 0
You need to be logged in to leave comments. Login now