mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-15 09:51:21 +00:00
setup.py: Remove files shipped in the past
- This only effects development environments where ./setup.py is run but not the shipped product. - Write log messages about removing the files only when actually removing the file. This is so that the log output is quiet when no action is taken (typical). Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
6179d98a07
commit
94883b3c92
20
setup.py
20
setup.py
@ -7,6 +7,7 @@ FreedomBox Service setup file.
|
||||
import collections
|
||||
import glob
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
@ -42,6 +43,12 @@ DISABLED_APPS_TO_REMOVE = [
|
||||
'xmpp',
|
||||
'disks',
|
||||
'udiskie',
|
||||
'restore',
|
||||
'repro',
|
||||
]
|
||||
|
||||
REMOVED_FILES = [
|
||||
'/etc/apt/preferences.d/50freedombox3.pref',
|
||||
]
|
||||
|
||||
LOCALE_PATHS = ['plinth/locale']
|
||||
@ -121,11 +128,16 @@ class CustomClean(clean):
|
||||
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])
|
||||
file_path = pathlib.Path(ENABLED_APPS_PATH) / app
|
||||
if file_path.exists():
|
||||
log.info("removing '%s'", str(file_path))
|
||||
subprocess.check_call(['rm', '-f', str(file_path)])
|
||||
|
||||
for path in REMOVED_FILES:
|
||||
if pathlib.Path(path).exists():
|
||||
log.info('removing %s', path)
|
||||
subprocess.check_call(['rm', '-f', path])
|
||||
|
||||
install.run(self)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user