[Subversion] / PEAK / setup.py  

Diff of /PEAK/setup.py

Parent Directory | Revision Log

version 572, Thu Oct 17 21:12:46 2002 UTC version 1703, Sun Feb 29 22:57:31 2004 UTC
Line 1 
Line 1 
 #!/usr/bin/env python  #!/usr/bin/env python
   
 """Distutils setup file"""  """Distutils setup file"""
   
 from distutils.core import setup, Command, Extension  execfile('src/setup/prologue.py')
 from distutils.command.install_data import install_data  
 from distutils.command.sdist import sdist as old_sdist  
 import sys  
   
 class install_data(install_data):  include_tests      = True   # edit this to stop installation of test modules
   include_metamodels = True   # edit this to stop installation of MOF, UML, etc.
   include_fcgiapp    = True   # edit this to stop installation of 'fcgiapp'
   
   # Metadata
   PACKAGE_NAME = "PEAK"
   PACKAGE_VERSION = "0.5a3"
   HAPPYDOC_IGNORE = [
       '-i','datetime', '-i','old', '-i','tests', '-i','setup', '-i','examples',
       '-i', 'kjbuckets', '-i', 'ZConfig', '-i', 'persistence', '-i', 'csv',
   ]
   
     """Variant of 'install_data' that installs data to module directories"""  # Base packages for installation
   scripts = ['scripts/peak']
   packages = [
       'peak', 'peak.api', 'peak.binding', 'peak.config', 'peak.model',
       'peak.naming', 'peak.naming.factories', 'peak.net', 'peak.running',
       'peak.tools', 'peak.tools.n2', 'peak.security', 'peak.tools.supervisor',
       'peak.storage', 'peak.util', 'peak.web', 'peak.ddt', 'protocols',
       'peak.tools.version', 'peak.query', 'peak.events',
   ]
   
   extensions = [
       Extension("kjbuckets", ["src/kjbuckets/kjbucketsmodule.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]),
       Extension("protocols._speedups", ["src/protocols/_speedups" + EXT]),
   ]
   
     def finalize_options (self):  
         self.set_undefined_options('install',  
                                    ('install_lib', 'install_dir'),  
                                    ('root', 'root'),  
                                    ('force', 'force'),  
                                   )  
   
 class sdist(old_sdist):  if include_tests:
   
     """Variant of 'sdist' that (re)builds the documentation first"""      packages += [
           'peak.tests', 'peak.binding.tests', 'peak.config.tests',
           'peak.model.tests', 'peak.naming.tests', 'peak.running.tests',
           'peak.security.tests', 'peak.web.tests', 'peak.query.tests',
           'peak.storage.tests', 'peak.util.tests', 'protocols.tests',
           'peak.events.tests', 'peak.ddt.tests',
       ]
   
     def run(self):  
   
         # Build docs before source distribution  if include_metamodels:
         self.run_command('happy')      packages += [
           'peak.metamodels',
           'peak.metamodels.UML13', 'peak.metamodels.UML14',
           'peak.metamodels.UML13.model', 'peak.metamodels.UML14.model',
           'peak.metamodels.UML13.model.Foundation',
           'peak.metamodels.UML13.model.Behavioral_Elements',
       ]
   
         # Run the standard sdist command      if include_tests:
         old_sdist.run(self)          packages += [ 'peak.metamodels.tests' ]
   
   
   
Line 39 
Line 71 
   
   
   
 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):  try:
       # Check if Zope X3 is installed; we use zope.component
       # 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
   
         # Install before testing  except ImportError:
         self.run_command('install')      zope_installed = False
   
         if not self.dry_run:  
             from unittest import main  
             main(None, None, sys.argv[:1]+self.test_args)  
   
   if not zope_installed:
   
       packages += [
           'persistence', 'ZConfig',
       ]
   
       extensions += [
           Extension("persistence._persistence", ["src/persistence/persistence.c"])
       ]
   
       if include_tests:
           packages += [
               'persistence.tests', 'ZConfig.tests', 'ZConfig.tests.library',
               'ZConfig.tests.library.thing', 'ZConfig.tests.library.widget',
           ]
   
   
   
Line 80 
Line 114 
   
   
   
 class happy(Command):  
   
     """Command to generate documentation using HappyDoc  
   
         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...  
     """  
   
     description = "Generate docs using happydoc"  
   
     user_options = []  
   
   
     def initialize_options(self):  
         self.happy_options = None  
         self.doc_output_path = None  
   
   import sys
   
     def finalize_options(self):  if sys.version_info < (2,3):
       # Install datetime and csv if we're not on 2.3
   
         if self.doc_output_path is None:      packages += ['datetime','csv']
             self.doc_output_path = 'docs/html/reference'      if include_tests:
           packages += ['datetime.tests']
   
         if self.happy_options is None:      extensions += [
             self.happy_options = [          Extension('_csv', ['src/_csv.c'])
                 '-t', 'PEAK Reference', '-d', self.doc_output_path,  
                 '-i', 'examples', '-i', 'old', '-i', 'tests',  
                 '-i', 'Interface', '.'  
             ]              ]
             if not self.verbose: self.happy_options.insert(0,'-q')  
   
     def run(self):  import os
         from distutils.dir_util import remove_tree, mkpath  
         from happydoclib import HappyDoc  
   
   
   
   
   
   
   
   
   
   
   
   
   
   
         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:  
             HappyDoc(self.happy_options).run()  
   
   
   
   
   
   
   
   
   if os.name=='posix':
   
       # install 'fcgiapp' module on posix systems
       if include_fcgiapp:
           extensions += [
               Extension("fcgiapp", [
                   "src/fcgiapp/fcgiappmodule.c", "src/fcgiapp/fcgiapp.c"
               ])
           ]
   
       uuidgen = False
       if hasattr(os, 'uname'):
           un = os.uname()
           if un[0] == 'FreeBSD' and int(un[2].split('.')[0]) >= 5:
               uuidgen = True
           elif un[0] == 'NetBSD' and int(un[2].split('.')[0]) >= 2:
               uuidgen = True
           elif un[0] == 'NetBSD' and un[2].startswith('1.6Z'):
               # XXX for development versions before 2.x where uuidgen
               # is present -- this should be removed at some point
               try:
                   if len(un[2]) > 4:
                       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:
                                   uuidgen = True
               except:
                   pass
   
       if uuidgen:
           extensions += [
               Extension("peak.util._uuidgen", ["src/peak/util/_uuidgen" + EXT]),
           ]
   
   
   
   
   execfile('src/setup/common.py')
   from setuptools import setup
   
   ALL_EXTS = [
       '*.ini', '*.html', '*.conf', '*.xml', '*.pwt', '*.dtd', '*.txt',
   ]
   
 setup(  setup(
       name=PACKAGE_NAME,
       version=PACKAGE_VERSION,
   
     name="PEAK",  
     version="0.5a1",  
     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/",
       license="PSF or ZPL",
       platforms=['UNIX','Windows'],
   
     url="http://www.telecommunity.com/PEAK/",      package_dir = {'':'src'},
       packages    = packages,
       cmdclass = SETUP_COMMANDS,
   
     packages=[      package_data = {
         'peak', 'peak.api', 'peak.binding', 'peak.model', 'peak.metamodels',          '': ALL_EXTS,
         'peak.metamodels.mof', 'peak.metamodels.uml', 'peak.metamodels.xmi',          'ZConfig.tests': ['input/*.xml', 'input/*.conf'],
         'peak.naming', 'peak.naming.factories', 'peak.util', 'peak.running',          'ZConfig.tests.library.thing': ['extras/extras.xml'],
         'peak.config', 'peak.storage',          'peak.metamodels': ['*.asdl']
       },
   
       test_module = TEST_MODULE,
       ext_modules = extensions,
       scripts = scripts,
   )
   
         'peak.binding.tests', 'peak.config.tests',  
         'peak.metamodels.tests', 'peak.util.tests', 'peak.tests',  
   
         'Interface', 'Interface.Common', 'Interface.tests', 'Persistence',  
     ],  
   
     package_dir = {'':'src'},  
   
     ext_modules = [  
         Extension("kjbuckets", ["src/kjbuckets/kjbucketsmodule.c"]),  
         Extension("Persistence.cPersistence",  
             ["src/Persistence/cPersistence.c"]  
         )  
     ],  
   
     cmdclass = {  
         'install_data': install_data, 'sdist': sdist, 'happy': happy,  
         'test': test, 'sdist_nodoc': old_sdist,  
     },  
   
     data_files = [  
         ('peak/metamodels/tests', ['src/peak/metamodels/tests/MetaMeta.xml']),  
     ],  
 )  
   
   


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

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help