mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
Use setup.py instead of Makefile
This commit is contained in:
parent
9d296a6270
commit
ddb3b0f2c2
93
Makefile
93
Makefile
@ -1,93 +0,0 @@
|
|||||||
MAKE=make
|
|
||||||
|
|
||||||
PWD=`pwd`
|
|
||||||
|
|
||||||
# hosting variables
|
|
||||||
SLEEP_TIME=300
|
|
||||||
EXCLUDE=--exclude=*.tar.gz --exclude=*~ $(EXCLUDE-FILES)
|
|
||||||
ALL_BUT_GZ=$(subst $(wildcard *.tar.gz),,$(wildcard *))
|
|
||||||
DATADIR=/usr/share/plinth
|
|
||||||
PYDIR=$(DATADIR)/python/plinth
|
|
||||||
|
|
||||||
## Catch-all targets
|
|
||||||
default: config dirs docs
|
|
||||||
all: default
|
|
||||||
|
|
||||||
predepend:
|
|
||||||
sudo sh -c "apt-get install pandoc psmisc python2.7 python-bcrypt python-cherrypy3 python-django python-passlib python-bootstrapform libjs-twitter-bootstrap sudo"
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
touch predepend
|
|
||||||
|
|
||||||
install: default apache-install freedombox-setup-install
|
|
||||||
mkdir -p $(DESTDIR)/etc/init.d $(DESTDIR)/etc/plinth
|
|
||||||
cp plinth.sample.config $(DESTDIR)/etc/plinth/plinth.config
|
|
||||||
mkdir -p $(DESTDIR)$(PYDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)/usr/bin \
|
|
||||||
$(DESTDIR)/usr/share/doc/plinth $(DESTDIR)/usr/share/man/man1
|
|
||||||
cp -a static themes $(DESTDIR)$(DATADIR)/
|
|
||||||
cp -a actions $(DESTDIR)$(DATADIR)/
|
|
||||||
cp -a sudoers.d $(DESTDIR)/etc/sudoers.d
|
|
||||||
cp -a *.py modules templates $(DESTDIR)$(PYDIR)/
|
|
||||||
cp share/init.d/plinth $(DESTDIR)/etc/init.d
|
|
||||||
cp -a lib/* $(DESTDIR)/usr/lib
|
|
||||||
install plinth $(DESTDIR)/usr/bin/
|
|
||||||
mkdir -p $(DESTDIR)/var/lib/plinth/sessions $(DESTDIR)/var/log/plinth $(DESTDIR)/var/run
|
|
||||||
mkdir -p $(DESTDIR)/var/lib/plinth/data
|
|
||||||
rm -f $(DESTDIR)/var/lib/plinth/users/sqlite3.distrib
|
|
||||||
|
|
||||||
freedombox-setup-install:
|
|
||||||
install -m755 -D setup.d/86_plinth $(DESTDIR)/usr/lib/freedombox/setup.d/86_plinth
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm -rf $(DESTDIR)/usr/lib/python2.7/plinth $(DESTDIR)/usr/share/plinth/ \
|
|
||||||
$(DESTDIR)/etc/plinth $(DESTDIR)/var/lib/plinth $(DESTDIR)/usr/share/doc/plinth/ \
|
|
||||||
$(DESTDIR)/var/log/plinth
|
|
||||||
rm -f $(DESTDIR)/usr/bin/plinth $(DESTDIR)/etc/init.d/plinth \
|
|
||||||
$(DESTDIR)/usr/share/man/man1/plinth.1.gz $(DESTDIR)/var/run/plinth.pid
|
|
||||||
|
|
||||||
dirs:
|
|
||||||
@mkdir -p data/sessions
|
|
||||||
|
|
||||||
config: Makefile
|
|
||||||
@test -f plinth.config || cp plinth.sample.config plinth.config
|
|
||||||
|
|
||||||
docs:
|
|
||||||
@$(MAKE) -s -C doc
|
|
||||||
doc: docs
|
|
||||||
|
|
||||||
html:
|
|
||||||
@$(MAKE) -s -C doc html
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@rm -f cherrypy.config data/sessions/*
|
|
||||||
@find . -name "*~" -exec rm {} \;
|
|
||||||
@find . -name ".#*" -exec rm {} \;
|
|
||||||
@find . -name "#*" -exec rm {} \;
|
|
||||||
@find . -name "*.pyc" -exec rm {} \;
|
|
||||||
@find . -name "*.bak" -exec rm {} \;
|
|
||||||
@$(MAKE) -s -C doc clean
|
|
||||||
rm -f plinth.config
|
|
||||||
rm -f predepend
|
|
||||||
|
|
||||||
hosting:
|
|
||||||
bash start.sh &
|
|
||||||
while [ 1 ]; do make current-checkout.tar.gz current-repository.tar.gz; sleep $(SLEEP_TIME); done
|
|
||||||
|
|
||||||
current-checkout.tar.gz: $(ALL_BUT_GZ)
|
|
||||||
tar cz $(EXCLUDE) * > current-checkout.tar.gz
|
|
||||||
|
|
||||||
current-repository.tar.gz: $(ALL_BUT_GZ)
|
|
||||||
tar cz $(EXCLUDE) * .git > current-repository.tar.gz
|
|
||||||
|
|
||||||
apache-install:
|
|
||||||
install -D -m644 share/apache2/plinth.conf $(DESTDIR)/etc/apache2/sites-available/plinth.conf
|
|
||||||
install -D -m644 share/apache2/plinth-ssl.conf $(DESTDIR)/etc/apache2/sites-available/plinth-ssl.conf
|
|
||||||
apache-config: apache-install apache-modules
|
|
||||||
a2ensite plinth
|
|
||||||
a2ensite plinth-ssl
|
|
||||||
service apache2 reload
|
|
||||||
|
|
||||||
apache-modules:
|
|
||||||
# enable all required modules, create snakeoil cert.
|
|
||||||
./setup.d/86_plinth
|
|
||||||
service apache2 restart
|
|
||||||
@ -42,7 +42,7 @@ $(SOURCES):
|
|||||||
@rm -f $@
|
@rm -f $@
|
||||||
@ln -s ../$(patsubst %.mdwn,%,$@) $@
|
@ln -s ../$(patsubst %.mdwn,%,$@) $@
|
||||||
|
|
||||||
../TODO : $(TODO_SOURCES) ../Makefile Makefile
|
../TODO : $(TODO_SOURCES) Makefile
|
||||||
grep -ro --exclude=.git* --exclude=plinth.1 --exclude=*.tex --exclude=*.html \
|
grep -ro --exclude=.git* --exclude=plinth.1 --exclude=*.tex --exclude=*.html \
|
||||||
--exclude=README.mdwn --exclude=INSTALL.mdwn \
|
--exclude=README.mdwn --exclude=INSTALL.mdwn \
|
||||||
--exclude=TODO.mdwn --exclude=COPYING.mdwn \
|
--exclude=TODO.mdwn --exclude=COPYING.mdwn \
|
||||||
|
|||||||
110
setup.py
Executable file
110
setup.py
Executable file
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# This file is part of Plinth.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
Plinth setup file
|
||||||
|
"""
|
||||||
|
|
||||||
|
from distutils import log
|
||||||
|
from distutils.command.install_data import install_data
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
from setuptools import find_packages, setup
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from plinth import __version__
|
||||||
|
|
||||||
|
|
||||||
|
DIRECTORIES_TO_CREATE = [
|
||||||
|
'/var/lib/plinth',
|
||||||
|
'/var/lib/plinth/sessions',
|
||||||
|
'/var/log/plinth',
|
||||||
|
]
|
||||||
|
|
||||||
|
DIRECTORIES_TO_COPY = [
|
||||||
|
('/usr/share/plinth/static', 'static'),
|
||||||
|
('/usr/share/doc/plinth/', 'doc'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class CustomInstallData(install_data):
|
||||||
|
"""Override install command to allow directory creation"""
|
||||||
|
def run(self):
|
||||||
|
"""Execute install command"""
|
||||||
|
install_data.run(self) # Old style base class
|
||||||
|
|
||||||
|
# Create empty directories
|
||||||
|
for directory in DIRECTORIES_TO_CREATE:
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
log.info("creating directory '%s'", directory)
|
||||||
|
os.makedirs(directory)
|
||||||
|
|
||||||
|
# Recursively copy directories
|
||||||
|
for target, source in DIRECTORIES_TO_COPY:
|
||||||
|
if not os.path.exists(target):
|
||||||
|
log.info("recursive copy '%s' to '%s'", source, target)
|
||||||
|
shutil.copytree(source, target)
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='Plinth',
|
||||||
|
version=__version__,
|
||||||
|
description='A web front end for administering FreedomBox',
|
||||||
|
url='http://freedomboxfoundation.org',
|
||||||
|
packages=find_packages(),
|
||||||
|
scripts=['bin/plinth'],
|
||||||
|
license='COPYING',
|
||||||
|
classifiers=[
|
||||||
|
'Development Status :: 3 - Alpha',
|
||||||
|
'Environment :: Web Environment',
|
||||||
|
'Framework :: Django',
|
||||||
|
'Intended Audience :: End Users/Desktop',
|
||||||
|
'License :: DFSG approved',
|
||||||
|
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
|
||||||
|
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||||
|
'Natural Language :: English',
|
||||||
|
'Operating System :: POSIX :: Linux',
|
||||||
|
'Programming Language :: Python',
|
||||||
|
'Programming Language :: Unix Shell',
|
||||||
|
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
|
||||||
|
'Topic :: System :: Systems Administration',
|
||||||
|
],
|
||||||
|
install_requires=[
|
||||||
|
'cherrypy >= 3.0',
|
||||||
|
'django >= 1.6.0',
|
||||||
|
'django-bootstrap-form',
|
||||||
|
'withsqlite',
|
||||||
|
],
|
||||||
|
package_data={'plinth': ['modules/enabled/*',
|
||||||
|
'templates/*',
|
||||||
|
'modules/*/templates/*']},
|
||||||
|
data_files=[('/etc/init.d', ['data/etc/init.d/plinth']),
|
||||||
|
('/usr/lib/freedombox/setup.d/',
|
||||||
|
['data/usr/lib/freedombox/setup.d/86_plinth']),
|
||||||
|
('/usr/lib/freedombox/first-run.d',
|
||||||
|
['data/usr/lib/freedombox/first-run.d/90_firewall']),
|
||||||
|
('/etc/apache2/sites-available',
|
||||||
|
['data/etc/apache2/sites-available/plinth.conf',
|
||||||
|
'data/etc/apache2/sites-available/plinth-ssl.conf']),
|
||||||
|
('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']),
|
||||||
|
('/usr/share/plinth/actions',
|
||||||
|
glob.glob(os.path.join('actions', '*'))),
|
||||||
|
('/usr/share/man/man1', ['doc/plinth.1']),
|
||||||
|
('/etc/plinth', ['data/etc/plinth/plinth.config'])],
|
||||||
|
cmdclass={'install_data': CustomInstallData},
|
||||||
|
)
|
||||||
Loading…
x
Reference in New Issue
Block a user