[Setup] Add a CleanDocs class

This commit is contained in:
Calum Lind 2016-11-27 17:04:12 +00:00
parent 98add5fecd
commit 7468078b71
2 changed files with 22 additions and 3 deletions

View File

@ -19,6 +19,7 @@ from distutils import cmd
from distutils.command.build import build as _build
from distutils.command.clean import clean as _clean
from distutils.command.install_data import install_data as _install_data
from shutil import rmtree
from setuptools import find_packages, setup
from setuptools.command.test import test as _test
@ -70,6 +71,25 @@ class BuildDocs(BuildDoc):
BuildDoc.run(self)
class CleanDocs(cmd.Command):
description = 'Clean the documentation build and rst files'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
for docs_dir in ('docs/build', 'docs/source/modules'):
try:
print('Deleting {}'.format(docs_dir))
rmtree(docs_dir)
except OSError:
pass
class BuildWebUI(cmd.Command):
description = 'Minify WebUI files'
@ -324,6 +344,7 @@ cmdclass = {
'build_docs': BuildDocs,
'install_data': InstallData,
'clean_plugins': CleanPlugins,
'clean_docs': CleanDocs,
'clean': Clean,
'egg_info_plugins': EggInfoPlugins,
'test': PyTest,

View File

@ -178,10 +178,8 @@ whitelist_externals =
[testenv:docs]
sitepackages = {[docsbase]sitepackages}
deps = {[docsbase]deps}
whitelist_externals =
bash
commands =
bash -c 'rm -f docs/source/modules/*.rst'
python setup.py clean_docs
python -c "print '> sphinx-apidoc --force -o docs/source/modules/ deluge deluge/plugins\n'\
'> sphinx-build -v -E -T -b html -d docs/build/doctrees docs/source docs/build/html';\
import subprocess, sys; proc = subprocess.Popen(\