mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 21:24:36 +00:00
Call sphinx-build from withing Python instead of a subprocess
This commit is contained in:
parent
ae1283f2e1
commit
e99e2b18e0
@ -9,7 +9,9 @@
|
|||||||
import os.path as op
|
import os.path as op
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .build import print_and_do, read_changelog_file, filereplace
|
from pkg_resources import load_entry_point
|
||||||
|
|
||||||
|
from .build import read_changelog_file, filereplace
|
||||||
|
|
||||||
CHANGELOG_FORMAT = """
|
CHANGELOG_FORMAT = """
|
||||||
{version} ({date})
|
{version} ({date})
|
||||||
@ -58,5 +60,10 @@ def gen(basepath, destpath, changelogpath, tixurl, confrepl=None, confpath=None,
|
|||||||
filereplace(changelogtmpl, changelog_out, changelog='\n'.join(rendered_logs))
|
filereplace(changelogtmpl, changelog_out, changelog='\n'.join(rendered_logs))
|
||||||
conf_out = op.join(basepath, 'conf.py')
|
conf_out = op.join(basepath, 'conf.py')
|
||||||
filereplace(confpath, conf_out, **confrepl)
|
filereplace(confpath, conf_out, **confrepl)
|
||||||
cmd = 'sphinx-build "{}" "{}"'.format(basepath, destpath)
|
# We used to call sphinx-build with print_and_do(), but the problem was that the virtualenv
|
||||||
print_and_do(cmd)
|
# of the calling python wasn't correctly considered and caused problems with documentation
|
||||||
|
# relying on autodoc (which tries to import the module to auto-document, but fail because of
|
||||||
|
# missing dependencies which are in the virtualenv). Here, we do exactly what is done when
|
||||||
|
# calling the command from bash.
|
||||||
|
cmd = load_entry_point('Sphinx', 'console_scripts', 'sphinx-build')
|
||||||
|
cmd(['sphinx-build', basepath, destpath])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user