from setuptools import setup, find_packages

long_description = (open('README.txt').read() + '\n\n' + open('CHANGES.txt').read())

version = '0.5dev'

# Always write version.txt to indicate which revision is used for this version.
try:
    import bzrlib.branch
    try:
        branch = bzrlib.branch.Branch.open('.')
        revision_number, revision_id = branch.last_revision_info()
        versiontxt = file('version.txt', 'w')
        versiontxt.truncate(0)
        versiontxt.write(version+'-r'+str(revision_number))
        if 'dev' in version:
            # Include revision number in eggname if this is a dev egg.
            version+='-r'+str(revision_number)
    except bzrlib.errors.NotBranchError:
        pass
except ImportError:
    # Just ignore
    pass


setup(name='ztm.structureddata',
      version=version,
      description="A Topic Maps structured data lister.",
      long_description=long_description,
      keywords='topicmaps structured data lister',
      author='ztmproject.org',
      author_email='ztm@ztmproject.org',
      url='http://ztmproject.org/',
      license='LGPL',
      classifiers=[ 'Development Status :: 4 - Beta'
                  , 'Environment :: Web Environment'
                  , 'Framework :: Zope3'
                  , 'Intended Audience :: Developers'
                  , 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)'
                  , 'Natural Language :: English'
                  , 'Operating System :: MacOS :: MacOS X'
                  , 'Operating System :: Microsoft :: Windows'
                  , 'Operating System :: POSIX'
                  , 'Operating System :: Unix'
                  , 'Programming Language :: Python'
                  , 'Topic :: Internet :: WWW/HTTP :: Dynamic Content'
                  ],
      dependency_links=["http://ztmproject.org/snapshots/"],
      packages=find_packages('src'),
      package_dir={'': 'src'},
      namespace_packages=['ztm'],
      include_package_data=True,
      zip_safe=False,
      extras_require={ 'test': [ 'zope.app.testing'
                               , 'zope.principalregistry'
                               , 'zope.password'
                               , 'zope.login'
                               ]
                     , 'i18n': ['zope.app.locales', 'zope.app.applicationcontrol']
                     , 'documentation': ['Sphinx']
                     },
      install_requires=[ 'setuptools'
                       , 'zope.component'
                       , 'zope.interface'
                       , 'zope.app.pagetemplate'
                       , 'zope.security'
                       , 'zope.publisher'
                       , 'ztm.topicmaps'
                       , 'ztm.ontology'
                       ],
      )

