Synopsis - Cross-Reference

File: /setup.py
  1#!/usr/bin/env python
  2#
  3# Copyright (C) 2004 Stefan Seefeld
  4# All rights reserved.
  5# Licensed to the public under the terms of the GNU LGPL (>= 2),
  6# see the file COPYING for details.
  7#
  8# Setup script for synopsis
  9#
 10# Usage: python setup.py install
 11#
 12
 13from Synopsis.dist.distribution import Distribution
 14from distutils.core import setup
 15from distutils import sysconfig
 16import os, sys, re, glob, shutil
 17
 18module_ext = sysconfig.get_config_var('SO')
 19
 20def prefix(list, pref): return [pref + x for x in list]
 21
 22version = '0.11'
 23revision = open('revision').read()[:-1]
 24
 25py_packages = ["Synopsis",
 26               "Synopsis.Parsers",
 27               "Synopsis.Parsers.IDL", "Synopsis.Parsers.Python",
 28               "Synopsis.Parsers.Cpp",
 29               "Synopsis.Parsers.C", "Synopsis.Parsers.Cxx",
 30               "Synopsis.Processors", "Synopsis.Processors.Comments",
 31               "Synopsis.Formatters",
 32               "Synopsis.Formatters.DocBook",
 33               "Synopsis.Formatters.DocBook.Markup",
 34               "Synopsis.Formatters.HTML",
 35               "Synopsis.Formatters.HTML.Views",
 36               "Synopsis.Formatters.HTML.Parts",
 37               "Synopsis.Formatters.HTML.Markup",
 38               "Synopsis.Formatters.HTML.Fragments"]
 39
 40ext_modules = [('Synopsis/Parsers/Cpp/ucpp', 'ParserImpl' + module_ext),
 41               ('Synopsis/Parsers/IDL', '_omniidl' + module_ext),
 42               ('Synopsis/Parsers/C', 'ParserImpl' + module_ext),
 43               ('Synopsis/Parsers/Cxx', 'ParserImpl' + module_ext)]
 44
 45scripts = ['synopsis', 'sxr-server']
 46if sys.platform == "win32":
 47    for script in scripts:
 48        filename = os.path.join('scripts', script)
 49        shutil.copyfile(filename, filename + '.py')
 50    scripts = [s + '.py' for s in scripts]
 51
 52data_files = [('share/doc/synopsis-%s'%version, ('README', 'COPYING', 'NEWS'))]
 53data_files.append(('share/man/man1', glob.glob('share/man/man1/*.*')))
 54data_files.append(('share/synopsis-%s'%version, glob.glob('share/synopsis/*.*')))
 55
 56#### add documentation
 57
 58def add_documentation(all, directory, files):
 59
 60    if '.svn' in files: files.remove('.svn')
 61    dest = directory.replace('share/doc/synopsis',
 62                             'share/doc/synopsis-%s'%version)
 63    all.append((dest,
 64                [os.path.join(directory, file)
 65                 for file in files
 66                 if os.path.isfile(os.path.join(directory, file))]))
 67
 68documentation = []
 69os.path.walk('share/doc/synopsis', add_documentation, documentation)
 70data_files.extend(documentation)
 71
 72setup(distclass=Distribution,
 73      name="synopsis",
 74      version=version,
 75      revision=revision,
 76      author="Stefan Seefeld",
 77      maintainer="Stefan Seefeld",
 78      author_email="stefan@fresco.org",
 79      maintainer_email="stefan@fresco.org",
 80      description="Source-code Introspection Tool",
 81      long_description="""Synopsis is a multi-language source code introspection tool that
 82provides a variety of representations for the parsed code, to
 83enable further processing such as documentation extraction,
 84reverse engineering, and source-to-source translation.""",
 85      url="http://synopsis.fresco.org",
 86      download_url = 'http://synopsis.fresco.org/download',
 87      license = 'LGPL / GPL',
 88      classifiers = ['Development Status :: 5 - Production/Stable',
 89                     'Environment :: Console',
 90                     'Environment :: Web Environment',
 91                     'Intended Audience :: Developers',
 92                     'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
 93                     'License :: OSI Approved :: GNU General Public License (GPL)',
 94                     'Operating System :: POSIX',
 95                     'Programming Language :: Python',
 96                     'Programming Language :: C++',
 97                     'Topic :: Software Development :: Documentation'],
 98      packages=py_packages,
 99      ext_modules=ext_modules,
100      scripts=prefix(scripts, "scripts/"),
101      data_files=data_files)