[Subversion] / PEAK / setup.py  

Diff of /PEAK/setup.py

Parent Directory | Revision Log

version 467, Sat Jul 13 20:17:17 2002 UTC version 1001, Sat Apr 19 19:32:32 2003 UTC
Line 2 
Line 2 
   
 """Distutils setup file"""  """Distutils setup file"""
   
 from distutils.core import setup, Command  from distutils.core import Extension
 from distutils.command.install_data import install_data  from os.path import join, walk
 from distutils.command.sdist import sdist as old_sdist  from os import sep
 import sys  import fnmatch
   
 class install_data(install_data):  
   
     """Variant of 'install_data' that installs data to module directories"""  
   
     def finalize_options (self):  
         self.set_undefined_options('install',  
                                    ('install_purelib', 'install_dir'),  
                                    ('root', 'root'),  
                                    ('force', 'force'),  
                                   )  
   
 class sdist(old_sdist):  
   
     """Variant of 'sdist' that (re)builds the documentation first"""  
   
     def run(self):  
   
         # Build docs before source distribution  
         self.run_command('happy')  
   
         # Run the standard sdist command  
         old_sdist.run(self)  
   
   
   
   include_tests = True        # edit this to stop installation of test modules
   include_metamodels = True   # edit this to stop installation of MOF, UML, etc.
   
   
   try:
       import Pyrex.Distutils
       EXT = '.pyx'
   
   except ImportError:
       EXT = '.c'
   
   
   def findDataFiles(dir, skipDepth, *globs):
   
       def visit(out, dirname, names):
           n = []
           for pat in globs:
               n.extend(fnmatch.filter(names,pat))
           if n:
               instdir = sep.join(dirname.split(sep)[skipDepth:])
               out.append( (instdir, [join(dirname,f) for f in n]) )
   
 class test(Command):      out = []
       walk(dir,visit,out)
       return out
   
     """Command to run unit tests after installation"""  
   
     description = "Run unit tests after installation"  
   
     user_options = [('test-module=','m','Test module (default=peak.tests)'),]  # Metadata
   
     def initialize_options(self):  PACKAGE_NAME = "PEAK"
         self.test_module = None  PACKAGE_VERSION = "0.5a0"
   
     def finalize_options(self):  HAPPYDOC_IGNORE = [
       '-i', 'examples',  '-i', 'old', '-i', 'tests',
         if self.test_module is None:  ]
             self.test_module = 'peak.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:  # Base packages for installation
             from unittest import main  
             main(None, None, sys.argv[:1]+self.test_args)  
   
   packages = [
       'peak', 'peak.api', 'peak.binding', 'peak.config', 'peak.model',
       'peak.naming', 'peak.naming.factories', 'peak.running',
       'peak.storage', 'peak.util',
   ]
   
   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]),
   ]
   
   
   # Base data files
   
   data_files = [
       ('peak', ['src/peak/peak.ini']),
   ]
   
   
   
   
   
   
   if include_tests:
   
 class happy(Command):      packages += [
           'peak.tests', 'peak.binding.tests', 'peak.config.tests',
           'peak.model.tests', 'peak.naming.tests', 'peak.running.tests',
           'peak.storage.tests', 'peak.util.tests',
       ]
   
     """Command to generate documentation using HappyDoc      data_files += [
           ('peak/running/tests', ['src/peak/running/tests/test_cluster.txt']),
       ]
   
         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"  if include_metamodels:
   
     user_options = []      packages += [
           'peak.metamodels',
           'peak.metamodels.UML13',
           'peak.metamodels.UML13.model',
           'peak.metamodels.UML13.model.Foundation',
           'peak.metamodels.UML13.model.Behavioral_Elements',
       ]
   
       if include_tests:
   
     def initialize_options(self):          packages += [
         self.happy_options = None              'peak.metamodels.tests',
         self.doc_output_path = None          ]
   
           data_files += [
               ('peak/metamodels/tests',
                   ['src/peak/metamodels/tests/MetaMeta.xml']
               ),
           ]
   
     def finalize_options(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
   
   except ImportError:
       zope_installed = False
   
   
   if not zope_installed:
   
       packages += [
           'zope', 'zope.interface', 'zope.interface.common',
           'persistence', 'ZConfig',
       ]
   
         if self.doc_output_path is None:      extensions += [
             self.doc_output_path = 'docs/html/reference'          Extension("persistence._persistence", ["src/persistence/persistence.c"])
       ]
   
         if self.happy_options is None:      if include_tests:
             self.happy_options = [          packages += [
                 '-t', 'PEAK Reference', '-d', self.doc_output_path,              'zope.interface.tests', 'persistence.tests', 'ZConfig.tests',
                 '-i', 'examples', '-i', 'old', '-i', 'tests', '.',              'zope.interface.common.tests',
             ]              ]
             if not self.verbose: self.happy_options.insert(0,'-q')  
   
     def run(self):          data_files += findDataFiles('src/ZConfig/tests', 1, '*.xml', '*.txt', '*.conf')
         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()  
   
   execfile('src/setup/common.py')
   
 setup(  setup(
       name=PACKAGE_NAME,
       version=PACKAGE_VERSION,
   
     name="PEAK",  
     version="0.2pre1",  
     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://telecommunity.com/TransWarp/",      url="http://peak.telecommunity.com/",
   
     packages=[  
         'peak', 'peak.api', 'peak.binding', 'peak.model', 'peak.metamodels',  
         'peak.metamodels.mof', 'peak.metamodels.uml', 'peak.metamodels.xmi',  
         'peak.naming', 'peak.naming.factories', 'peak.util', 'peak.running',  
         'peak.running.config',  
   
         'peak.binding.tests',      license="PSF or ZPL",
         'peak.metamodels.tests', 'peak.util.tests', 'peak.tests',      platforms=['UNIX','Windows'],
   
         'Interface', 'Interface.Common', 'Interface.tests',  
     ],  
   
       packages    = packages,
     package_dir = {'':'src'},      package_dir = {'':'src'},
   
     cmdclass = {      cmdclass = SETUP_COMMANDS,
         'install_data': install_data, 'sdist': sdist, 'happy': happy,  
         'test': test,  
     },  
   
     data_files = [      data_files = data_files,
         ('peak/metamodels/tests', ['src/peak/metamodels/tests/MetaMeta.xml']),  
     ],      ext_modules = extensions,
 )  )
   
   


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

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help