[Subversion] / PEAK / setup.py  

Diff of /PEAK/setup.py

Parent Directory | Revision Log

version 652, Sat Nov 9 00:05:52 2002 UTC version 997, Sat Apr 19 18:35:30 2003 UTC
Line 2 
Line 2 
   
 """Distutils setup file"""  """Distutils setup file"""
   
 from distutils.core import setup, Command, Extension  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_lib', 'install_dir'),  
                                    ('root', 'root'),  
                                    ('force', 'force'),  
                                   )  
   
 class sdist(old_sdist):  
   
     """Variant of 'sdist' that (re)builds the documentation first"""  include_tests = True        # edit this to stop installation of test modules
   include_metamodels = True   # edit this to stop installation of MOF, UML, etc.
   
     def run(self):  
   
         # Build docs before source distribution  try:
         self.run_command('happy')      import Pyrex.Distutils
       EXT = '.pyx'
   
         # Run the standard sdist command  except ImportError:
         old_sdist.run(self)      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]) )
   
       out = []
       walk(dir,visit,out)
       return out
   
   
   
   # Metadata
   
   PACKAGE_NAME = "PEAK"
   PACKAGE_VERSION = "0.5a0"
   
   HAPPYDOC_IGNORE = [
       '-i', 'examples',  '-i', 'old', '-i', 'tests',
       '-i', 'Interface', '-i', 'Persistence', '-i', 'kjbuckets',
   ]
   
 class test(Command):  
   
     """Command to run unit tests after installation"""  # Base packages for installation
   
     description = "Run unit tests after installation"  packages = [
       'peak', 'peak.api', 'peak.binding', 'peak.config', 'peak.model',
       'peak.naming', 'peak.naming.factories', 'peak.running',
       'peak.storage', 'peak.util',
   
     user_options = [('test-module=','m','Test module (default=peak.tests)'),]      'Interface', 'Interface.Common', 'Interface.Registry',
       'Persistence',
   ]
   
     def initialize_options(self):  extensions = [
         self.test_module = None      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]),
   ]
   
     def finalize_options(self):  
   
         if self.test_module is None:  # Base data files
             self.test_module = 'peak.api.tests'  
   
         self.test_args = [self.test_module+'.test_suite']  data_files = [
       ('peak', ['src/peak/peak.ini']),
   ]
   
         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)  
   
   
   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 += [
           ('peak/running/tests', ['src/peak/running/tests/test_cluster.txt']),
       ]
   
   
   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']
               ),
           ]
   
 class happy(Command):  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',
       ]
   
     """Command to generate documentation using HappyDoc      extensions += [
           Extension("persistence._persistence", ["src/persistence/persistence.c"])
       ]
   
         I should probably make this more general, and contribute it to either      if include_tests:
         HappyDoc or the distutils, but this does the trick for PEAK for now...          packages += [
     """              'zope.interface.tests', 'persistence.tests', 'ZConfig.tests',
           ]
   
     description = "Generate docs using happydoc"          data_files += findDataFiles('src/ZConfig/tests', 1, '*.xml', '*.txt', '*.conf')
   
     user_options = []  
   
     def initialize_options(self):  
         self.happy_options = None  
         self.doc_output_path = None  
   
   execfile('src/setup/common.py')
   
     def finalize_options(self):  setup(
       name=PACKAGE_NAME,
       version=PACKAGE_VERSION,
   
         if self.doc_output_path is None:      description="The Python Enterprise Application Kit",
             self.doc_output_path = 'docs/html/reference'  
   
         if self.happy_options is None:      author="Phillip J. Eby",
             self.happy_options = [      author_email="transwarp@eby-sarna.com",
                 '-t', 'PEAK Reference', '-d', self.doc_output_path,  
                 '-i', 'examples', '-i', 'old', '-i', 'tests',  
                 '-i', 'metamodels', '-i', 'Interface', '-i', 'Persistence',  
                 '-i', 'kjbuckets', '.'  
             ]  
             if not self.verbose: self.happy_options.insert(0,'-q')  
   
     def run(self):      url="http://peak.telecommunity.com/",
         from distutils.dir_util import remove_tree, mkpath  
         from happydoclib import HappyDoc  
   
         mkpath(self.doc_output_path, 0755, self.verbose, self.dry_run)      license="PSF or ZPL",
         remove_tree(self.doc_output_path, self.verbose, self.dry_run)      platforms=['UNIX','Windows'],
   
         if not self.dry_run:      packages    = packages,
             HappyDoc(self.happy_options).run()      package_dir = {'':'src'},
   
 setup(      cmdclass = SETUP_COMMANDS,
     name="PEAK",  
     version="0.5a1",  
     description="The Python Enterprise Application Kit",  
     author="Phillip J. Eby",  
     author_email="transwarp@eby-sarna.com",  
     url="http://www.telecommunity.com/PEAK/",  
   
     packages=[      data_files = data_files,
         '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.config', 'peak.storage',  
   
         'peak.binding.tests', 'peak.config.tests', 'peak.storage.tests',  
         'peak.metamodels.tests', 'peak.util.tests', 'peak.naming.tests',  
         'peak.model.tests', 'peak.tests',  
   
         'Interface', 'Interface.tests',  
         'Interface.Common', 'Interface.Common.tests',  
         'Interface.Registry', 'Interface.Registry.tests',  
         'Persistence',  
     ],  
     package_dir = {'':'src'},  
   
     ext_modules = [      ext_modules = extensions,
         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', ['src/peak/peak.ini']),  
         ('peak/metamodels/tests', ['src/peak/metamodels/tests/MetaMeta.xml']),  
     ],  
 )  )
   
   


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

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help