2006-11-23 20:13:08 +01:00
|
|
|
#!/usr/bin/env python
|
2006-11-30 15:50:28 +01:00
|
|
|
#
|
|
|
|
# Copyright 2006 sense.lab e.V.
|
|
|
|
#
|
|
|
|
# This file is part of the CryptoBox.
|
|
|
|
#
|
|
|
|
# The CryptoBox is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# The CryptoBox 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 General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with the CryptoBox; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
# Dependencies: clearsilver(python), cherrypy, python-configobj
|
|
|
|
#
|
2006-11-23 20:13:08 +01:00
|
|
|
|
|
|
|
from distutils.core import setup
|
|
|
|
import distutils.sysconfig
|
|
|
|
import os
|
|
|
|
|
|
|
|
## define some strings (not patterns) to exclude specific files or directories
|
2006-11-28 15:26:14 +01:00
|
|
|
IGNORE_FILES = [ '.svn', 'intl' ]
|
2006-11-23 20:13:08 +01:00
|
|
|
|
2006-11-30 15:50:28 +01:00
|
|
|
## define the data destination directory (below the python directory - for debian this gets overridden the rules file)
|
2006-11-24 12:03:34 +01:00
|
|
|
pydir = distutils.sysconfig.get_python_lib()
|
2006-11-23 20:13:08 +01:00
|
|
|
## remove installation prefix to get relative path
|
2006-11-24 12:03:34 +01:00
|
|
|
pydir = pydir.replace(distutils.sysconfig.get_config_var("prefix") + os.path.sep, '')
|
|
|
|
pydir = os.path.join(pydir, 'cryptobox')
|
2006-11-23 20:13:08 +01:00
|
|
|
|
2006-11-24 12:03:34 +01:00
|
|
|
## shared data dir
|
2006-12-18 14:37:08 +01:00
|
|
|
datadir = os.path.join('share', 'cryptobox-server')
|
2006-11-24 12:03:34 +01:00
|
|
|
## doc dir
|
2006-12-18 14:37:08 +01:00
|
|
|
docdir = os.path.join('share', 'doc', 'cryptobox-server')
|
2006-11-23 21:52:30 +01:00
|
|
|
## configuration directory
|
2006-11-27 20:25:26 +01:00
|
|
|
confdir = os.path.join(os.path.sep, 'etc', 'cryptobox-server')
|
2006-11-23 21:52:30 +01:00
|
|
|
|
2006-11-24 12:03:34 +01:00
|
|
|
|
2006-12-14 01:21:08 +01:00
|
|
|
def listfiles(prefix, src):
|
2006-11-24 12:03:34 +01:00
|
|
|
"""create a list of files below a directory recursively
|
|
|
|
|
|
|
|
If the src contains more then one path element (multiple levels), then only the
|
|
|
|
last one (basename part) is added to the prefix path (e.g.: 'dest','src1/src2' will
|
|
|
|
create a list below 'dest/src2').
|
|
|
|
The result is a list of tuples: (destination, [srcfiles,...]).
|
|
|
|
This is the datatype expected by 'data_files' in setup."""
|
|
|
|
## we will not add the 'dirname' part of srcdir to the destination
|
|
|
|
src_dir, src_base = os.path.split(src)
|
2006-11-23 21:52:30 +01:00
|
|
|
## add the files of this directory
|
2006-12-14 01:21:08 +01:00
|
|
|
result = [(os.path.join(prefix, src_base), [ os.path.join(src, f)
|
|
|
|
for f in os.listdir(src)
|
|
|
|
if os.path.isfile(os.path.join(src, f)) \
|
|
|
|
and not f in IGNORE_FILES ])]
|
2006-11-23 21:52:30 +01:00
|
|
|
## add the files in subdirectories
|
2006-11-24 12:03:34 +01:00
|
|
|
for d in os.listdir(src):
|
|
|
|
if os.path.isdir(os.path.join(src,d)) and not d in IGNORE_FILES:
|
2006-12-14 01:21:08 +01:00
|
|
|
result.extend(listfiles(
|
|
|
|
os.path.join(prefix,src_base), os.path.join(src, d)))
|
2006-11-23 21:52:30 +01:00
|
|
|
return result
|
2006-11-24 12:03:34 +01:00
|
|
|
|
|
|
|
|
2006-12-14 01:21:08 +01:00
|
|
|
def getdatafiles(prefix, dirs):
|
2006-11-23 20:13:08 +01:00
|
|
|
filelist = []
|
|
|
|
for d in dirs:
|
2006-11-23 21:52:30 +01:00
|
|
|
if os.path.isdir(d):
|
2006-12-14 01:21:08 +01:00
|
|
|
filelist.extend(listfiles(prefix, d))
|
2006-11-23 21:52:30 +01:00
|
|
|
else:
|
|
|
|
filelist.append((prefix, [d]))
|
2006-11-23 20:13:08 +01:00
|
|
|
return filelist
|
|
|
|
|
|
|
|
|
2006-11-28 15:26:14 +01:00
|
|
|
def get_language_files(prefix):
|
2006-12-18 14:37:08 +01:00
|
|
|
"""return a destination-file mapping for all compiled language files (*.po)
|
|
|
|
"""
|
|
|
|
import sys
|
2006-11-28 15:26:14 +01:00
|
|
|
mapping = []
|
|
|
|
## find all language directories
|
|
|
|
intl_dirs = []
|
2006-12-14 01:21:08 +01:00
|
|
|
for (root, dirs, files) in os.walk(os.getcwd()):
|
|
|
|
if 'intl' in dirs:
|
|
|
|
intl_dirs.append(os.path.join(root, 'intl'))
|
2006-11-28 15:26:14 +01:00
|
|
|
for i_dir in intl_dirs:
|
2006-12-14 01:21:08 +01:00
|
|
|
for lang_dir in [os.path.join(i_dir, e)
|
|
|
|
for e in os.listdir(i_dir)
|
|
|
|
if os.path.isdir(os.path.join(i_dir, e)) and (not e in IGNORE_FILES)]:
|
2006-12-18 14:37:08 +01:00
|
|
|
po_files = [ os.path.join(lang_dir, e)
|
2006-12-14 01:21:08 +01:00
|
|
|
for e in os.listdir(lang_dir)
|
|
|
|
if os.path.isfile(os.path.join(lang_dir, e)) \
|
2006-12-18 14:37:08 +01:00
|
|
|
and (e[-3:] == '.po') ]
|
|
|
|
lang_files = []
|
|
|
|
for po_file in po_files:
|
|
|
|
if compile_po_file(po_file):
|
|
|
|
lang_files.append(po_file[:-3] + ".mo")
|
|
|
|
else:
|
|
|
|
sys.stderr.write("Failed to compile language file: %s\n" % po_file)
|
|
|
|
mapping.append((os.path.join(
|
|
|
|
prefix, os.path.basename(lang_dir), 'LC_MESSAGES'), lang_files))
|
2006-11-28 15:26:14 +01:00
|
|
|
return mapping
|
2006-12-18 14:37:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
def compile_po_file(po_file):
|
|
|
|
"""compile the binary mo file out of a po file
|
|
|
|
"""
|
|
|
|
import subprocess
|
|
|
|
return subprocess.call( [ "msgfmt", "-o", po_file[:-3] + ".mo", po_file ] ) == 0
|
2006-11-28 15:26:14 +01:00
|
|
|
|
|
|
|
|
2006-11-23 20:13:08 +01:00
|
|
|
setup(
|
2006-11-27 20:25:26 +01:00
|
|
|
name = 'cryptobox-server',
|
2006-11-23 20:13:08 +01:00
|
|
|
version = '0.3.0',
|
|
|
|
description = 'webinterface for handling encrypted disks',
|
2006-12-18 14:37:08 +01:00
|
|
|
author = 'Sense.Lab e.V.',
|
|
|
|
author_email = 'info@cryptobox.org',
|
2006-11-23 20:13:08 +01:00
|
|
|
maintainer = 'Lars Kruse',
|
|
|
|
maintainer_email = 'devel@sumpfralle.de',
|
|
|
|
license = 'GPL',
|
|
|
|
url = 'http://cryptobox.org',
|
2006-12-14 01:21:08 +01:00
|
|
|
packages = [ 'cryptobox', 'cryptobox.core', 'cryptobox.web',
|
|
|
|
'cryptobox.plugins', 'cryptobox.tests' ],
|
2006-12-18 14:37:08 +01:00
|
|
|
data_files = getdatafiles(datadir, ['templates', 'www-data', 'plugins']) +
|
2006-12-14 01:21:08 +01:00
|
|
|
getdatafiles(confdir, [os.path.join('conf-examples', 'cryptobox.conf')]) +
|
|
|
|
getdatafiles(os.path.join(confdir, 'events.d'), [
|
|
|
|
os.path.join('event-scripts', 'README'),
|
|
|
|
os.path.join('event-scripts', '_event_scripts_')]) +
|
|
|
|
getdatafiles(docdir, ['conf-examples', 'event-scripts', 'README', 'changelog',
|
2006-12-18 14:37:08 +01:00
|
|
|
'LICENSE', 'copyright', os.path.join('doc', 'html'), 'README.davfs',
|
|
|
|
'README.samba', 'README.proxy', 'README.ssl' ]) +
|
|
|
|
getdatafiles(os.path.join(docdir, 'conf-examples'),
|
|
|
|
[os.path.join('debian', 'cryptobox-server.init')]) +
|
|
|
|
get_language_files(os.path.join('share', 'locale')),
|
2006-11-23 21:52:30 +01:00
|
|
|
package_dir = { '': 'src' },
|
2006-12-18 14:37:08 +01:00
|
|
|
scripts = [ os.path.join('bin', 'CryptoBoxWebserver'),
|
|
|
|
os.path.join('bin', 'CryptoBoxRootActions') ],
|
2006-11-23 20:13:08 +01:00
|
|
|
classifiers = [
|
|
|
|
'Development Status :: 2 - Beta',
|
|
|
|
'Environment :: Web Environment',
|
|
|
|
'Intended Audience :: End Users/Desktop',
|
|
|
|
'Intended Audience :: System Administrators',
|
|
|
|
'License :: OSI Approved :: GNU General Public License (GPL)',
|
|
|
|
'Topic :: System :: Systems Administration',
|
|
|
|
'Operating System :: POSIX',
|
|
|
|
'Operating System :: Unix',
|
|
|
|
'Programming Language :: Python'],
|
|
|
|
)
|
|
|
|
|