1from distutils.core import setup, Command
2import glob
3import sys
4import os
5sys.path.insert(0, 'src')
6
7# store old content of version file here
8# if we have git available, temporarily overwrite the file
9# so we can report the git commit id in fuglu --version
10OLD_VERSFILE_CONTENT = None
11VERSFILE = 'src/fuglu/__init__.py'
12
13
14def git_version():
15    from fuglu import FUGLU_VERSION
16    global VERSFILE, OLD_VERSFILE_CONTENT
17    try:
18        import subprocess
19        x = subprocess.Popen(
20            ['git', 'describe'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
21        ret = x.wait()
22        if ret == 0:
23            stdout, stderr = x.communicate()
24            vers = stdout.strip()
25            # replace fuglu version in file
26            if os.path.isfile(VERSFILE):
27                OLD_VERSFILE_CONTENT = open(VERSFILE, 'r').read()
28                buff = OLD_VERSFILE_CONTENT.replace(FUGLU_VERSION, vers)
29                open(VERSFILE, 'w').write(buff)
30            return vers
31        else:
32            return FUGLU_VERSION
33    except Exception as e:
34        return FUGLU_VERSION
35
36
37setup(name="fuglu",
38#      version=git_version(),
39      version='0.8.0',
40      description="Fuglu Mail Content Scanner",
41      author="O. Schacher",
42      url='http://www.fuglu.org',
43      download_url='http://github.com/fumail/fuglu/tarball/master',
44      author_email="oli@fuglu.org",
45      package_dir={'': 'src'},
46      packages=['fuglu', 'fuglu.plugins', 'fuglu.extensions',
47                'fuglu.lib', 'fuglu.connectors'],
48      scripts=["src/startscript/fuglu", "src/tools/fuglu_debug",
49               "src/tools/fuglu_control", "src/tools/fuglu_conf",
50               "src/tools/fuglu_suspectfilter", "src/tools/fuglu_client"],
51      long_description="""Fuglu is  a modular pre/after queue content filter written in python. It can be used to filter spam, viruses, unwanted attachments etc..
52
53see http://fumail.github.com/fuglu/ for more details.""",
54      data_files=[
55          ('etc/fuglu', glob.glob('conf/*.dist')),
56          ('etc/fuglu/templates', glob.glob('conf/templates/*.dist')),
57          ('etc/fuglu/rules', glob.glob('conf/rules/*.dist')),
58      ],
59
60      classifiers=[
61          'Development Status :: 4 - Beta',
62          'Environment :: No Input/Output (Daemon)',
63          'Intended Audience :: Developers',
64          'Intended Audience :: System Administrators',
65          'License :: OSI Approved :: Apache Software License',
66          'Operating System :: POSIX',
67          'Programming Language :: Python',
68          'Topic :: Communications :: Email',
69          'Topic :: Communications :: Email :: Filters',
70          'Topic :: Communications :: Email :: Mail Transport Agents',
71      ],
72      )
73
74# cleanup
75if OLD_VERSFILE_CONTENT != None:
76    open(VERSFILE, 'w').write(OLD_VERSFILE_CONTENT)
77