From 7906b0ab5e01ca4333d7134a35417da8c66c0f97 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 4 Nov 2014 11:09:12 +0530 Subject: [PATCH] Clean documentation directory when 'setup.py clean' is run --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e499964a3..85c8806c3 100755 --- a/setup.py +++ b/setup.py @@ -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}, )