ó 1Tc@s¶dZddlZddlZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z mZmZddlmZd efd „ƒYZdS( s? sphinx.setup_command ~~~~~~~~~~~~~~~~~~~~ Setuptools/distutils commands to assist the building of sphinx documentation. :author: Sebastian Wiesner :contact: basti.wiesner@gmx.net :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. iÿÿÿÿN(tStringIO(tCommand(tDistutilsOptionErrortDistutilsExecError(tSphinx(tdarkredtnocolortcolor_terminal(tabspathtBuildDocc BszeZdZdZd#d$d%d'd(d)d*d+d,d-d.g ZdddgZd„Zd„Zd&d „Z d!„Z d"„Z RS(/s7 Distutils command to build Sphinx documentation. The Sphinx build can then be triggered from distutils, and some Sphinx options can be set in ``setup.py`` or ``setup.cfg`` instead of Sphinx own configuration file. For instance, from `setup.py`:: # this is only necessary when not using setuptools/distribute from sphinx.setup_command import BuildDoc cmdclass = {'build_sphinx': BuildDoc} name = 'My project' version = '1.2' release = '1.2.0' setup( name=name, author='Bernard Montgomery', version=release, cmdclass=cmdclass, # these are optional and override conf.py settings command_options={ 'build_sphinx': { 'project': ('setup.py', name), 'version': ('setup.py', version), 'release': ('setup.py', release)}}, ) Or add this section in ``setup.cfg``:: [build_sphinx] project = 'My project' version = 1.2 release = 1.2.0 sBuild Sphinx documentations fresh-envtEsdiscard saved environments all-filestasbuild all filess source-dir=tssSource directorys build-dir=sBuild directorys config-dir=tcs'Location of the configuration directorysbuilder=tbs&The builder to use. Defaults to "html"sproject=sThe documented project's namesversion=sThe short X.Y versionsrelease=s.The full version, including alpha/beta/rc tagsstoday=sCHow to format the current date, used as the replacement for |today|s link-indextis!Link index.html to the master doccCsct|_|_d|_|_d|_d|_d|_d|_ d|_ d|_ t|_ dS(Nthtmlt( tFalset fresh_envt all_filestNonet source_dirt build_dirtbuildertprojecttversiontreleasettodayt config_dirt link_index(tself((s>/usr/local/lib/python2.7/site-packages/sphinx/setup_command.pytinitialize_optionsSs      cCs`xYdD]Q}tjj|ƒs%qnx0tj|ƒD]\}}}d|kr5|Sq5WqWdS(Ntdoctdocssconf.py(R!R"(tostpathtisdirtwalkR(Rtguesstroottdirnamest filenames((s>/usr/local/lib/python2.7/site-packages/sphinx/setup_command.pyt_guess_source_dir^s   cCsat||ƒ}|dkr/t|||ƒ|St|tjƒs]td|||fƒ‚n|S(Ns'%s' must be a %s (got `%s`)(tgetattrRtsetattrt isinstancettypest StringTypesR(Rtoptiontwhattdefaulttval((s>/usr/local/lib/python2.7/site-packages/sphinx/setup_command.pyt_ensure_stringlikejs cCsc|jdkr5|jƒ|_|jd|jƒn|jdƒ|jdkr`tj|_nt|jƒ|_|jdkr|j|_nt|jƒ|_|j dkrô|j dƒ}tj j t|j ƒdƒ|_ |j|j ƒnt|j ƒ|_ tj j |j dƒ|_|j|jƒtj j |j |jƒ|_|j|jƒdS(NsUsing source directory %sRtbuildtsphinxtdoctrees(RRR+tannouncetensure_dirnameR#tcurdirRRRtget_finalized_commandR$tjoint build_basetmkpatht doctree_dirRtbuilder_target_dir(RR6((s>/usr/local/lib/python2.7/site-packages/sphinx/setup_command.pytfinalize_optionsts& !c CsÀtƒstƒn|js(tƒ}n tj}i}|jrP|j|d/usr/local/lib/python2.7/site-packages/sphinx/setup_command.pytrunŠsD              (s fresh-envR sdiscard saved environment(s all-filesR sbuild all files(s source-dir=R sSource directoryN(s build-dir=NsBuild directory(s config-dir=R s'Location of the configuration directory(sbuilder=Rs&The builder to use. Defaults to "html"(sproject=NsThe documented project's name(sversion=NsThe short X.Y version(srelease=Ns.The full version, including alpha/beta/rc tags(stoday=NsCHow to format the current date, used as the replacement for |today|(s link-indexRs!Link index.html to the master doc( t__name__t __module__t__doc__t descriptionRt user_optionstboolean_optionsR R+R5RBR^(((s>/usr/local/lib/python2.7/site-packages/sphinx/setup_command.pyR s&$  (RaRJR#R/Rt distutils.cmdRtdistutils.errorsRRtsphinx.applicationRtsphinx.util.consoleRRRtsphinx.util.osutilRR (((s>/usr/local/lib/python2.7/site-packages/sphinx/setup_command.pyt s