1"""
2$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/durus/setup.py $
3$Id: setup.py 31598 2009-04-29 18:51:25Z dbinger $
4"""
5from __init__ import __version__
6import re, sys, os
7assert sys.version >= "2.4"
8
9try:
10    assert 'USE_DISTUTILS' not in os.environ
11    from setuptools import setup, Extension
12except (ImportError, AssertionError):
13    from distutils.core import setup
14    from distutils.extension import Extension
15
16if 'sdist' in sys.argv:
17    if sys.platform == 'darwin':
18        # Omit extended attributes from tarfile
19        os.environ['COPYFILE_DISABLE'] = 'true'
20    # Make sure that version numbers have all been updated.
21    PAT = re.compile(r'\b%s\b' % re.escape(__version__))
22    assert len(PAT.findall(open("LICENSE.txt").read())) == 14, __version__
23    assert PAT.search(open("CHANGES.txt").readline()), __version__
24    assert len(PAT.findall(open("INSTALL.txt").read())) == 2, __version__
25
26    # Make sure that copyright statements are current.
27    from datetime import datetime
28    year = datetime.now().year
29    copyright = \
30        "Copyright (c) Corporation for National Research Initiatives %s" % year
31    assert open("__init__.py").read().count(copyright) == 1
32    assert open("README.txt").read().count(copyright) == 1
33
34persistent = Extension(name="durus._persistent", sources=["_persistent.c"])
35setup(name = "Durus",
36      version = __version__,
37      description = "A Python Object Database",
38      long_description = """
39      Serves and manages changes to persistent objects being used in
40      multiple client processes.
41      """,
42      scripts = ["durus"],
43      package_dir = {'durus' : os.curdir},
44      packages = ["durus"],
45      platforms = ['Python >=2.4'],
46      author = "CNRI",
47      author_email = "webmaster@mems-exchange.org",
48      url = "http://www.mems-exchange.org/software/durus/",
49      ext_modules = [persistent],
50      license = "see LICENSE.txt",
51      )
52