from setuptools import setup, find_packages

readme = file('README.txt').read()
changes = file('CHANGES.txt').read()
long_description = (readme + '\n\n' + changes)

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.editor',
      version=version,
      description="A low-level web based user interface for editing topics in ztm.topicmaps.",
      long_description=long_description,
      keywords='TopicMaps',
      author='ztmproject.org',
      author_email='ztm-dev@ztmproject.org',
      url='http://ztmproject.org/',
      license='GPL',
      classifiers=['Programming Language :: Python',
                   'Environment :: Web Environment',
                   'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
                   'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
                   'Topic :: Internet :: WWW/HTTP :: Site Management',
                   'Framework :: Zope3',
                   'Development Status :: 3 - Beta',
                   'Intended Audience :: Developers',
                   'License :: OSI Approved :: GNU General Public License (GPL)',
                   'Operating System :: MacOS :: MacOS X',
                   'Operating System :: Microsoft :: Windows',
                   'Operating System :: POSIX',
                   ],

      packages=find_packages('src'),
      package_dir = {'': 'src'},
      namespace_packages = ['ztm'],
      include_package_data=True,
      dependency_links = ["http://ztmproject.org/snapshots/"],
      extras_require = { 'test': [ 'zope.app.testing'
                                 , 'zope.testbrowser'
                                 , 'zope.principalregistry'
                                 , 'zope.password'
                                 , 'zope.app.server'
                                 , 'zope.location'
                                 , 'zope.login'
                                 ]
                       , 'i18n': ['cc.gettext']
                       , 'buildout': ['collective.recipe.bootstrap']
                       , 'documentation': [ 'collective.recipe.sphinxbuilder'
                                          , 'repoze.sphinx.autointerface'
                                          , 'sphinxcontrib-aafig'
                                          , 'PIL'
                                          , 'docutils>=0.5'
                                          ]
                       },
      zip_safe=False,
          install_requires=['setuptools',
                            'ztm.topicmaps>0.8',
                            'simplejson',
                            'ztm.json',
                            'ztm.jquery.core>=1.4',
                            'ztm.humanmsg',
                            'zope.viewlet',
                            'zope.browserresource',
                            'z3c.pagelet',
                            'zope.contentprovider'
                           ],
      )

