From 09f3f23e10076f7cf3f69520817efe8bb180956e Mon Sep 17 00:00:00 2001 From: nsaikiran Date: Fri, 14 Jul 2017 12:46:33 +0530 Subject: [PATCH] [#846] Remove disabled apps as part of install --- setup.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 798bb7e90..b325890f6 100755 --- a/setup.py +++ b/setup.py @@ -30,13 +30,13 @@ from distutils.util import change_root import glob import os import setuptools +from setuptools.command.install import install import shutil import subprocess from plinth import __version__ from plinth.tests.coverage import coverage - DIRECTORIES_TO_CREATE = [ '/var/lib/plinth', '/var/lib/plinth/sessions', @@ -48,6 +48,15 @@ DIRECTORIES_TO_COPY = [ ('/usr/share/plinth/static', 'static'), ] +ENABLED_APPS_PATH = "/etc/plinth/modules-enabled/" + +DISABLED_APPS_TO_REMOVE = [ + 'apps', + 'system', + 'xmpp', + 'owncloud' +] + LOCALE_PATHS = [ 'plinth/locale' ] @@ -109,6 +118,7 @@ class CustomBuild(build): class CustomClean(clean): """Override clean command to clean doc, locales, and egg-info.""" + def run(self): """Execute clean command""" subprocess.check_call(['rm', '-rf', 'Plinth.egg-info/']) @@ -124,6 +134,19 @@ class CustomClean(clean): clean.run(self) +class CustomInstall(install): + """Override install command.""" + + def run(self): + log.info("Removing disabled apps") + for app in DISABLED_APPS_TO_REMOVE: + file_path = os.path.join(ENABLED_APPS_PATH, app) + log.info("removing '%s'", file_path) + subprocess.check_call(['rm', '-f', file_path]) + + install.run(self) + + class CustomInstallData(install_data): """Override install command to allow directory creation and copy""" def run(self): @@ -237,6 +260,7 @@ setuptools.setup( ['data/var/lib/polkit-1/localauthority/10-vendor.d/' 'org.freedombox.NetworkManager.pkla'])], cmdclass={ + 'install': CustomInstall, 'build': CustomBuild, 'clean': CustomClean, 'compile_translations': CompileTranslations,