customization: Create customization path in /var/www

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2018-09-28 11:43:07 +05:30 committed by James Valleroy
parent 9721eeac2b
commit e1d3497886
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

113
setup.py
View File

@ -19,19 +19,20 @@
FreedomBox Service setup file. FreedomBox Service setup file.
""" """
import glob
import os
import shutil
import subprocess
from distutils import log from distutils import log
from distutils.command.build import build from distutils.command.build import build
from distutils.dir_util import remove_tree
from distutils.command.clean import clean from distutils.command.clean import clean
from distutils.command.install_data import install_data from distutils.command.install_data import install_data
from distutils.core import Command from distutils.core import Command
from distutils.dir_util import remove_tree
from distutils.util import change_root from distutils.util import change_root
import glob
import os
import setuptools import setuptools
from setuptools.command.install import install from setuptools.command.install import install
import shutil
import subprocess
from plinth import __version__ from plinth import __version__
from plinth.tests.coverage import coverage from plinth.tests.coverage import coverage
@ -59,9 +60,7 @@ DISABLED_APPS_TO_REMOVE = [
'udiskie', 'udiskie',
] ]
LOCALE_PATHS = [ LOCALE_PATHS = ['plinth/locale']
'plinth/locale'
]
class DjangoCommand(Command): class DjangoCommand(Command):
@ -90,7 +89,7 @@ class DjangoCommand(Command):
class CompileTranslations(DjangoCommand): class CompileTranslations(DjangoCommand):
"""New command to compile .po translation files.""" """New command to compile .po translation files."""
description = "compile .po translation files into .mo files""" description = "compile .po translation files into .mo files" ""
def run(self): def run(self):
"""Execute the command.""" """Execute the command."""
@ -102,7 +101,7 @@ class CompileTranslations(DjangoCommand):
class UpdateTranslations(DjangoCommand): class UpdateTranslations(DjangoCommand):
"""New command to update .po translation files.""" """New command to update .po translation files."""
description = "update .po translation files from source code""" description = "update .po translation files from source code" ""
def run(self): def run(self):
"""Execute the command.""" """Execute the command."""
@ -151,6 +150,7 @@ class CustomInstall(install):
class CustomInstallData(install_data): class CustomInstallData(install_data):
"""Override install command to allow directory creation and copy""" """Override install command to allow directory creation and copy"""
def run(self): def run(self):
"""Execute install command""" """Execute install command"""
subprocess.check_call(['make', '-C', 'doc']) subprocess.check_call(['make', '-C', 'doc'])
@ -222,48 +222,57 @@ setuptools.setup(
], ],
tests_require=['coverage >= 3.7'], tests_require=['coverage >= 3.7'],
include_package_data=True, include_package_data=True,
package_data={'plinth': ['templates/*', package_data={
'modules/*/static/*', 'plinth': [
'modules/*/templates/*', 'templates/*', 'modules/*/static/*', 'modules/*/templates/*',
'locale/*/LC_MESSAGES/*.[pm]o']}, 'locale/*/LC_MESSAGES/*.[pm]o'
data_files=[('/usr/lib/firewalld/services/', ]
glob.glob('data/usr/lib/firewalld/services/*.xml')), },
('/etc/apache2/conf-available', data_files=[
glob.glob('data/etc/apache2/conf-available/*.conf')), ('/usr/lib/firewalld/services/',
('/etc/apache2/sites-available', glob.glob('data/usr/lib/firewalld/services/*.xml')),
glob.glob('data/etc/apache2/sites-available/*.conf')), ('/etc/apache2/conf-available',
('/etc/apache2/includes', glob.glob('data/etc/apache2/conf-available/*.conf')),
glob.glob('data/etc/apache2/includes/*.conf')), ('/etc/apache2/sites-available',
('/etc/apt/apt.conf.d', glob.glob('data/etc/apache2/sites-available/*.conf')),
glob.glob('data/etc/apt/apt.conf.d/60unattended-upgrades')), ('/etc/apache2/includes',
('/etc/avahi/services/', glob.glob('data/etc/apache2/includes/*.conf')),
glob.glob('data/etc/avahi/services/*.service')), ('/etc/apt/apt.conf.d',
('/etc/ikiwiki', glob.glob('data/etc/apt/apt.conf.d/60unattended-upgrades')),
glob.glob('data/etc/ikiwiki/*.setup')), ('/etc/avahi/services/',
('/etc/NetworkManager/dispatcher.d/', glob.glob('data/etc/avahi/services/*.service')),
['data/etc/NetworkManager/dispatcher.d/10-freedombox-batman']), ('/etc/ikiwiki', glob.glob('data/etc/ikiwiki/*.setup')),
('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']), ('/etc/NetworkManager/dispatcher.d/',
('/lib/systemd/system', ['data/etc/NetworkManager/dispatcher.d/10-freedombox-batman']),
glob.glob('data/lib/systemd/system/*.service')), ('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']),
('/etc/mediawiki', glob.glob('data/etc/mediawiki/*.php')), ('/lib/systemd/system',
('/usr/share/plinth/actions', glob.glob('data/lib/systemd/system/*.service')),
glob.glob(os.path.join('actions', '*'))), ('/etc/mediawiki', glob.glob('data/etc/mediawiki/*.php')),
('/usr/share/polkit-1/rules.d', ('/usr/share/plinth/actions', glob.glob(os.path.join('actions', '*'))),
['data/usr/share/polkit-1/rules.d/50-plinth.rules']), ('/usr/share/polkit-1/rules.d',
('/usr/share/man/man1', ['doc/plinth.1']), ['data/usr/share/polkit-1/rules.d/50-plinth.rules']),
('/etc/plinth', ['data/etc/plinth/plinth.config']), ('/usr/share/man/man1', ['doc/plinth.1']),
('/usr/share/augeas/lenses', ('/etc/plinth', ['data/etc/plinth/plinth.config']),
glob.glob('data/usr/share/augeas/lenses/*.aug')), ('/usr/share/augeas/lenses',
('/usr/share/augeas/lenses/tests', glob.glob('data/usr/share/augeas/lenses/*.aug')),
glob.glob('data/usr/share/augeas/lenses/tests/test_*.aug')), ('/usr/share/augeas/lenses/tests',
('/usr/share/pam-configs/', glob.glob('data/usr/share/augeas/lenses/tests/test_*.aug')),
glob.glob('data/usr/share/pam-configs/*-freedombox')), ('/usr/share/pam-configs/',
('/etc/plinth/modules-enabled', glob.glob('data/usr/share/pam-configs/*-freedombox')),
glob.glob(os.path.join('data/etc/plinth/modules-enabled', ('/etc/plinth/modules-enabled',
'*'))), glob.glob(os.path.join('data/etc/plinth/modules-enabled', '*'))),
('/var/lib/polkit-1/localauthority/10-vendor.d', ('/var/lib/polkit-1/localauthority/10-vendor.d', [
['data/var/lib/polkit-1/localauthority/10-vendor.d/' 'data/var/lib/polkit-1/localauthority/10-vendor.d/'
'org.freedombox.NetworkManager.pkla'])], 'org.freedombox.NetworkManager.pkla'
]),
(
'/var/www/plinth/custom/static/theme/icons/',
[
'data/var/www/plinth/custom/static/themes/default/icons/.gitignore',
# TODO Cannot be copied since a symlink is not a regular file
# 'data/var/www/plinth/custom/static/theme',
])
],
cmdclass={ cmdclass={
'install': CustomInstall, 'install': CustomInstall,
'build': CustomBuild, 'build': CustomBuild,