Browse Source

improved code style of setup script

added new README files
master
lars 16 years ago
parent
commit
2aed13ae18
  1. 44
      setup.py

44
setup.py

@ -44,7 +44,7 @@ docdir = os.path.join(pydir, 'doc')
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
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
src_dir, src_base = os.path.split(src)
## 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
for d in os.listdir(src):
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
def getdatafiles(prefix,dirs):
def getdatafiles(prefix, dirs):
filelist = []
for d in dirs:
if os.path.isdir(d):
filelist.extend(listfiles(prefix,d))
filelist.extend(listfiles(prefix, d))
else:
filelist.append((prefix, [d]))
return filelist
@ -78,12 +82,19 @@ def get_language_files(prefix):
mapping = []
## find all language directories
intl_dirs = []
for root,dirs,files in os.walk(os.getcwd()):
if 'intl' in dirs: intl_dirs.append(os.path.join(root,'intl'))
print intl_dirs
for (root, dirs, files) in os.walk(os.getcwd()):
if 'intl' in dirs:
intl_dirs.append(os.path.join(root, 'intl'))
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) ]:
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 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)]:
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
@ -98,12 +109,17 @@ setup(
maintainer_email = 'devel@sumpfralle.de',
license = 'GPL',
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']) +
getdatafiles(confdir, ['conf-examples/cryptobox.conf']) +
getdatafiles(os.path.join(confdir,'events.d'), ['event-scripts/README', 'event-scripts/_event_scripts_']) +
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, ['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'),
package_dir = { '': 'src' },
scripts = [ 'bin/CryptoBoxWebserver', 'bin/CryptoBoxRootActions' ],

Loading…
Cancel
Save