[Subversion] / PEAK / setup.py  

Diff of /PEAK/setup.py

Parent Directory | Revision Log

version 966, Sat Apr 5 20:44:59 2003 UTC version 1713, Sun Mar 7 23:51:25 2004 UTC
Line 1 
Line 1 
 #!/usr/bin/env python  #!/usr/bin/env python
   
 """Distutils setup file"""  """Distutils setup file"""
   
 include_tests = True        # edit this to stop installation of test modules  import sys, os
 include_metamodels = True   # edit this to stop installation of MOF, UML, etc.  from setuptools import setup, Extension, Feature, findPackages
   
   
 # Base packages for installation  
   
 packages = [  
     'peak', 'peak.api', 'peak.binding', 'peak.config', 'peak.model',  
     'peak.naming', 'peak.naming.factories', 'peak.running',  
     'peak.storage', 'peak.util',  
   
     'Interface', 'Interface.Common', 'Interface.Registry',  # Metadata
     'Persistence',  PACKAGE_NAME = "PEAK"
   PACKAGE_VERSION = "0.5a4"
   HAPPYDOC_IGNORE = [
       '-i','datetime', '-i','old', '-i','tests', '-i','setup', '-i','examples',
       '-i', 'kjbuckets', '-i', 'ZConfig', '-i', 'persistence', '-i', 'csv',
 ]  ]
   
   
 # Base data files  scripts = ['scripts/peak']
   
 data_files = [  
     ('peak', ['src/peak/peak.ini']),  
 ]  
   
   
   
   
   
   
   
   
   packages = findPackages('src')
   
   extensions = [
       Extension("kjbuckets", ["src/kjbuckets/kjbucketsmodule.c"]),
       Extension(
           "peak.binding._once", [
               "src/peak/binding/_once.pyx", "src/peak/binding/getdict.c"
   
   
 if include_tests:  
   
     packages += [  
         'peak.tests', 'peak.binding.tests', 'peak.config.tests',  
         'peak.model.tests', 'peak.naming.tests', 'peak.running.tests',  
         'peak.storage.tests', 'peak.util.tests',  
   
         'Interface.tests', 'Interface.Common.tests',  
         'Interface.Registry.tests',  
     ]      ]
       ),
     data_files += [      Extension("peak.util.buffer_gap", ["src/peak/util/buffer_gap.pyx"]),
         ('peak/running/tests', ['src/peak/running/tests/test_cluster.txt']),      Extension("peak.util._Code", ["src/peak/util/_Code.pyx"]),
       Extension("protocols._speedups", ["src/protocols/_speedups.pyx"]),
       Extension("persistence._persistence", ["src/persistence/persistence.c"]),
       Extension('_csv', ['src/_csv.c']),
     ]      ]
   
   
 if include_metamodels:  
   
     packages += [  
         'peak.metamodels',  
         'peak.metamodels.UML13',  
         'peak.metamodels.UML13.model',  
         'peak.metamodels.UML13.model.Foundation',  
         'peak.metamodels.UML13.model.Behavioral_Elements',  
     ]  
   
     if include_tests:  
   
         packages += [  
             'peak.metamodels.tests',  
         ]  
   
         data_files += [  
             ('peak/metamodels/tests',  
                 ['src/peak/metamodels/tests/MetaMeta.xml']  
             ),  
         ]  
   
   
   
   
 from distutils.core import setup, Command, Extension  
 from distutils.command.install_data import install_data  
 from distutils.command.sdist import sdist as old_sdist  
 from distutils.command.build_ext import build_ext as old_build_ext  
 import sys  
   
 try:  try:
     from Pyrex.Distutils.build_ext import build_ext      # Check if Zope X3 is installed; we use zope.component
     EXT = '.pyx'      # because we don't install it ourselves; if we used something we
       # install, we'd get a false positive if PEAK was previously installed.
       import zope.component
       zope_installed = True
   
 except ImportError:  except ImportError:
     build_ext = old_build_ext      zope_installed = False
     EXT = '.c'  
   
   
 class install_data(install_data):  have_uuidgen = False
   
     """Variant of 'install_data' that installs data to module directories"""  if os.name=='posix' and hasattr(os, 'uname'):
   
     def finalize_options (self):      un = os.uname()
         self.set_undefined_options('install',  
                                    ('install_lib', 'install_dir'),  
                                    ('root', 'root'),  
                                    ('force', 'force'),  
                                   )  
   
 class sdist(old_sdist):      if un[0] == 'FreeBSD' and int(un[2].split('.')[0]) >= 5:
           have_uuidgen = True
   
     """Variant of 'sdist' that (re)builds the documentation first"""      elif un[0] == 'NetBSD' and int(un[2].split('.')[0]) >= 2:
           have_uuidgen = True
   
     def run(self):      elif un[0] == 'NetBSD' and un[2].startswith('1.6Z'):
         # Build docs before source distribution          # XXX for development versions before 2.x where uuidgen
           # is present -- this should be removed at some point
         try:          try:
             import happydoclib              if len(un[2]) > 4:
         except ImportError:                  if ord(un[2][4]) >= ord('I'):
                       if os.path.exists('/lib/libc.so.12'):
                           l = os.listdir('/lib')
                           l = [x for x in l if x.startswith('libc.so.12.')]
                           l = [int(x.split('.')[-1]) for x in l]
                           l.sort(); l.reverse()
                           if l[0] >= 111:
                               have_uuidgen = True
           except:
             pass              pass
         else:  
             self.run_command('happy')  
   
         # Run the standard sdist command  
         old_sdist.run(self)  
   
 class test(Command):  
   
     """Command to run unit tests after installation"""  
   
     description = "Run unit tests after installation"  
   
     user_options = [('test-module=','m','Test module (default=peak.tests)'),]  
   
     def initialize_options(self):  
         self.test_module = None  
   
     def finalize_options(self):  
   
         if self.test_module is None:  
             self.test_module = 'peak.api.tests'  
   
         self.test_args = [self.test_module+'.test_suite']  
   
         if self.verbose:  
             self.test_args.insert(0,'--verbose')  
   
     def run(self):  
   
         # Install before testing  
         self.run_command('install')  
   
         if not self.dry_run:  
             from unittest import main  
             main(None, None, sys.argv[:1]+self.test_args)  
   
   
   
   execfile('src/setup/common.py')
   
   features = {
       'tests': Feature(
           "test modules", standard = True,
           remove = [p for p in packages if p.endswith('.tests')]
       ),
       'metamodels': Feature(
           "MOF/UML metamodels", standard = True, remove=['peak.metamodels']
       ),
 class happy(Command):      'legacy-support': Feature(
           "Python 2.2 support packages",
     """Command to generate documentation using HappyDoc          standard = sys.version_info < (2,3), optional = False,
           remove = ['datetime','csv','_csv'],
         I should probably make this more general, and contribute it to either      ),
         HappyDoc or the distutils, but this does the trick for PEAK for now...      'fcgiapp': Feature(
     """          "FastCGI support", standard = (os.name=='posix'),
           ext_modules = [
     description = "Generate docs using happydoc"              Extension("fcgiapp", [
                   "src/fcgiapp/fcgiappmodule.c", "src/fcgiapp/fcgiapp.c"
     user_options = []              ])
   
     def initialize_options(self):  
         self.happy_options = None  
         self.doc_output_path = None  
   
   
     def finalize_options(self):  
   
         if self.doc_output_path is None:  
             self.doc_output_path = 'docs/html/reference'  
   
         if self.happy_options is None:  
             self.happy_options = [  
                 '-t', 'PEAK Reference', '-d', self.doc_output_path,  
                 '-i', 'examples', '-i', 'old', '-i', 'tests',  
                 '-i', 'Interface', '-i', 'Persistence',  
                 '-i', 'kjbuckets', '.'  
             ]              ]
             if not self.verbose: self.happy_options.insert(0,'-q')      ),
       'ZConfig': Feature(
     def run(self):          "ZConfig 2.0", standard = not zope_installed, remove = ['ZConfig']
         from distutils.dir_util import remove_tree, mkpath      ),
         from happydoclib import HappyDoc      'persistence': Feature(
           "ZODB 4 persistence", standard = not zope_installed,
           remove = ['persistence']
       ),
       'uuidgen': Feature(
           "UUID generation via BSD system libraries",
           available = have_uuidgen, standard = have_uuidgen,
           optional = have_uuidgen,
           ext_modules = [
               Extension("peak.util._uuidgen", ["src/peak/util/_uuidgen.c"]),
           ]
       ),
   }
   
         mkpath(self.doc_output_path, 0755, self.verbose, self.dry_run)  
         remove_tree(self.doc_output_path, self.verbose, self.dry_run)  
   
         if not self.dry_run:  ALL_EXTS = [
             HappyDoc(self.happy_options).run()      '*.ini', '*.html', '*.conf', '*.xml', '*.pwt', '*.dtd', '*.txt',
   ]
   
 setup(  setup(
     name="PEAK",      name=PACKAGE_NAME,
     version="0.5a0",      version=PACKAGE_VERSION,
   
     description="The Python Enterprise Application Kit",      description="The Python Enterprise Application Kit",
   
     author="Phillip J. Eby",      author="Phillip J. Eby",
     author_email="transwarp@eby-sarna.com",      author_email="transwarp@eby-sarna.com",
       url="http://peak.telecommunity.com/",
     url="http://www.telecommunity.com/PEAK/",  
   
     license="PSF or ZPL",      license="PSF or ZPL",
     platforms=['UNIX','Windows'],      platforms=['UNIX','Windows'],
   
     packages    = packages,  
     package_dir = {'':'src'},      package_dir = {'':'src'},
       packages    = packages,
       cmdclass = SETUP_COMMANDS,
   
     cmdclass = {      package_data = {
         'install_data': install_data, 'sdist': sdist, 'happy': happy,          '': ALL_EXTS,
         'test': test, 'sdist_nodoc': old_sdist, 'build_ext': build_ext,          'ZConfig.tests': ['input/*.xml', 'input/*.conf'],
           'ZConfig.tests.library.thing': ['extras/extras.xml'],
           'peak.metamodels': ['*.asdl']
     },      },
   
     data_files = data_files,      features = features,
       test_suite = 'peak.tests.test_suite',
       ext_modules = extensions,
       scripts = scripts,
   )
   
   
   
   
   
   
   
     ext_modules = [  
         Extension("kjbuckets", ["src/kjbuckets/kjbucketsmodule.c"]),  
         Extension("Persistence.cPersistence",  
             ["src/Persistence/cPersistence.c"]  
         ),  
         Extension(  
             "peak.binding._once", [  
                 "src/peak/binding/_once" + EXT,  
                 "src/peak/binding/getdict.c"  
             ]  
         ),  
         Extension("peak.util.buffer_gap", ["src/peak/util/buffer_gap" + EXT]),  
         Extension("peak.util._Code", ["src/peak/util/_Code" + EXT]),  
     ],  
   
 )  
   
   


Generate output suitable for use with a patch program
Legend:
Removed from v.966  
changed lines
  Added in v.1713

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help