improved code style of setup script

added new README files
This commit is contained in:
lars 2006-12-14 00:21:08 +00:00
parent 21ff8991f2
commit 2aed13ae18
1 changed files with 30 additions and 14 deletions

View File

@ -44,7 +44,7 @@ docdir = os.path.join(pydir, 'doc')
confdir = os.path.join(os.path.sep, 'etc', 'cryptobox-server') confdir = os.path.join(os.path.sep, 'etc', 'cryptobox-server')
def listfiles(prefix,src): def listfiles(prefix, src):
"""create a list of files below a directory recursively """create a list of files below a directory recursively
If the src contains more then one path element (multiple levels), then only the If the src contains more then one path element (multiple levels), then only the
@ -55,19 +55,23 @@ def listfiles(prefix,src):
## we will not add the 'dirname' part of srcdir to the destination ## we will not add the 'dirname' part of srcdir to the destination
src_dir, src_base = os.path.split(src) src_dir, src_base = os.path.split(src)
## add the files of this directory ## add the files of this directory
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 ])] 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 ])]
## add the files in subdirectories ## add the files in subdirectories
for d in os.listdir(src): for d in os.listdir(src):
if os.path.isdir(os.path.join(src,d)) and not d in IGNORE_FILES: if os.path.isdir(os.path.join(src,d)) and not d in IGNORE_FILES:
result.extend(listfiles(os.path.join(prefix,src_base),os.path.join(src,d))) result.extend(listfiles(
os.path.join(prefix,src_base), os.path.join(src, d)))
return result return result
def getdatafiles(prefix,dirs): def getdatafiles(prefix, dirs):
filelist = [] filelist = []
for d in dirs: for d in dirs:
if os.path.isdir(d): if os.path.isdir(d):
filelist.extend(listfiles(prefix,d)) filelist.extend(listfiles(prefix, d))
else: else:
filelist.append((prefix, [d])) filelist.append((prefix, [d]))
return filelist return filelist
@ -78,12 +82,19 @@ def get_language_files(prefix):
mapping = [] mapping = []
## find all language directories ## find all language directories
intl_dirs = [] intl_dirs = []
for root,dirs,files in os.walk(os.getcwd()): for (root, dirs, files) in os.walk(os.getcwd()):
if 'intl' in dirs: intl_dirs.append(os.path.join(root,'intl')) if 'intl' in dirs:
print intl_dirs intl_dirs.append(os.path.join(root, 'intl'))
for i_dir in intl_dirs: for i_dir in intl_dirs:
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) ]: for lang_dir in [os.path.join(i_dir, e)
mapping.append((os.path.join(prefix, os.path.basename(lang_dir),'LC_MESSAGES'), [ os.path.join(lang_dir,e) for e in os.listdir(lang_dir) if os.path.isfile(os.path.join(lang_dir,e)) and (e[-3:] == '.po') ])) for e in os.listdir(i_dir)
if os.path.isdir(os.path.join(i_dir, e)) and (not e in IGNORE_FILES)]:
mapping.append((os.path.join(
prefix, os.path.basename(lang_dir), 'LC_MESSAGES'),
[ os.path.join(lang_dir, e)
for e in os.listdir(lang_dir)
if os.path.isfile(os.path.join(lang_dir, e)) \
and (e[-3:] == '.po') ]))
return mapping return mapping
@ -98,12 +109,17 @@ setup(
maintainer_email = 'devel@sumpfralle.de', maintainer_email = 'devel@sumpfralle.de',
license = 'GPL', license = 'GPL',
url = 'http://cryptobox.org', url = 'http://cryptobox.org',
packages = [ 'cryptobox', 'cryptobox.core', 'cryptobox.web', 'cryptobox.plugins', 'cryptobox.tests' ], packages = [ 'cryptobox', 'cryptobox.core', 'cryptobox.web',
'cryptobox.plugins', 'cryptobox.tests' ],
data_files = getdatafiles(datadir, ['templates', 'www-data', 'lang', 'plugins']) + data_files = getdatafiles(datadir, ['templates', 'www-data', 'lang', 'plugins']) +
getdatafiles(confdir, ['conf-examples/cryptobox.conf']) + getdatafiles(confdir, [os.path.join('conf-examples', 'cryptobox.conf')]) +
getdatafiles(os.path.join(confdir,'events.d'), ['event-scripts/README', 'event-scripts/_event_scripts_']) + getdatafiles(os.path.join(confdir, 'events.d'), [
os.path.join('event-scripts', 'README'),
os.path.join('event-scripts', '_event_scripts_')]) +
getdatafiles(docdir, ['doc/html']) + getdatafiles(docdir, ['doc/html']) +
getdatafiles(docdir, ['conf-examples', 'event-scripts', 'README', 'changelog', 'LICENSE', 'copyright', 'doc/html']) + getdatafiles(docdir, ['conf-examples', 'event-scripts', 'README', 'changelog',
'LICENSE', 'copyright', 'doc/html', 'README.davfs', 'README.samba',
'README.proxy', 'README.ssl' ]) +
get_language_files('share/locale'), get_language_files('share/locale'),
package_dir = { '': 'src' }, package_dir = { '': 'src' },
scripts = [ 'bin/CryptoBoxWebserver', 'bin/CryptoBoxRootActions' ], scripts = [ 'bin/CryptoBoxWebserver', 'bin/CryptoBoxRootActions' ],