mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-31 03:31:41 +00:00
use build_py to fix build on RTD
it seems that our subcommands are ignored over there, for some mysterious reason.
This commit is contained in:
parent
824f9c72a2
commit
86487d192a
1 changed files with 27 additions and 0 deletions
27
setup.py
27
setup.py
|
@ -7,6 +7,8 @@
|
||||||
from distutils.command.build import build
|
from distutils.command.build import build
|
||||||
from distutils.core import Command
|
from distutils.core import Command
|
||||||
from distutils.errors import DistutilsOptionError
|
from distutils.errors import DistutilsOptionError
|
||||||
|
from distutils import log
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
min_python = (3, 2)
|
min_python = (3, 2)
|
||||||
my_python = sys.version_info
|
my_python = sys.version_info
|
||||||
|
@ -195,13 +197,38 @@ def run(self):
|
||||||
""" % mod)
|
""" % mod)
|
||||||
|
|
||||||
# (function, predicate), see http://docs.python.org/2/distutils/apiref.html#distutils.cmd.Command.sub_commands
|
# (function, predicate), see http://docs.python.org/2/distutils/apiref.html#distutils.cmd.Command.sub_commands
|
||||||
|
# seems like this doesn't work on RTD, see below for build_py hack.
|
||||||
build.sub_commands.append(('build_api', None))
|
build.sub_commands.append(('build_api', None))
|
||||||
build.sub_commands.append(('build_usage', None))
|
build.sub_commands.append(('build_usage', None))
|
||||||
|
|
||||||
|
|
||||||
|
class build_py_custom(build_py):
|
||||||
|
"""override build_py to also build our stuf
|
||||||
|
|
||||||
|
it is unclear why this is necessary, but in some environments
|
||||||
|
(Readthedocs.org, specifically), the above
|
||||||
|
``build.sub_commands.append()`` doesn't seem to have an effect:
|
||||||
|
our custom build commands seem to be ignored when running
|
||||||
|
``setup.py install``.
|
||||||
|
|
||||||
|
This class overrides the ``build_py`` target by forcing it to run
|
||||||
|
our custom steps as well.
|
||||||
|
|
||||||
|
See also the `bug report on RTD
|
||||||
|
<https://github.com/rtfd/readthedocs.org/issues/1740>`_.
|
||||||
|
"""
|
||||||
|
def run(self):
|
||||||
|
super().run()
|
||||||
|
self.announce('calling custom build steps', level=log.INFO)
|
||||||
|
self.run_command('build_api')
|
||||||
|
self.run_command('build_usage')
|
||||||
|
|
||||||
|
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
'build_ext': build_ext,
|
'build_ext': build_ext,
|
||||||
'build_api': build_api,
|
'build_api': build_api,
|
||||||
'build_usage': build_usage,
|
'build_usage': build_usage,
|
||||||
|
'build_py': build_py_custom,
|
||||||
'sdist': Sdist
|
'sdist': Sdist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue