Clean documentation directory when 'setup.py clean' is run

This commit is contained in:
Sunil Mohan Adapa 2014-11-04 11:09:12 +05:30
parent 7f307dc5a2
commit 7906b0ab5e

View File

@ -21,6 +21,7 @@ Plinth setup file
"""
from distutils import log
from distutils.command.clean import clean
from distutils.command.install_data import install_data
from distutils.util import change_root
import glob
@ -44,6 +45,15 @@ DIRECTORIES_TO_COPY = [
]
class CustomClean(clean):
"""Override clean command to clean documentation directory"""
def run(self):
"""Execute clean command"""
subprocess.check_call(['make', '-C', 'doc', 'clean'])
clean.run(self)
class CustomInstallData(install_data):
"""Override install command to allow directory creation and copy"""
def run(self):
@ -125,5 +135,6 @@ setuptools.setup(
('/etc/plinth/modules-enabled',
glob.glob(os.path.join('data/etc/plinth/modules-enabled',
'*')))],
cmdclass={'install_data': CustomInstallData},
cmdclass={'clean': CustomClean,
'install_data': CustomInstallData},
)