View of /PEAK/setup.py
Parent Directory
| Revision Log
Revision:
576 -
(
download)
(
as text)
Mon Oct 28 17:58:01 2002 UTC (21 years, 5 months ago) by
pje
File size: 4231 byte(s)
Added a basic configuration file format, and used it to replace the
schemes dictionary in peak.naming.factories, by adding a "peak.ini"
global configuration file for PEAK builtins. This means that the
factories subpackage is pretty much useless now; the URL classes can
easily move anywhere now, like to the same modules as the implementations.
It should now be easy to add lots of address schemes to PEAK. Also,
subclasses of GlobalConfig can change the list of filenames used to load
configuration settings, and thus perhaps read a ~.peakrc or /etc/peak.ini
file, or an app-specific global configuration file.
The file format is very primitive right now: ConfigParser with eval() of
the settings done at file load time. Ultimately, this should move to a
true lazy evaluation mode, and there are some syntactic sugar features that
should be added. For right now, however, all we need are constant
expressions.
Last, but not least, fixed a bug in the fromURL() method of ParsedURLs.
#!/usr/bin/env python
"""Distutils setup file"""
from distutils.core import setup, Command, Extension
from distutils.command.install_data import install_data
from distutils.command.sdist import sdist as old_sdist
import sys
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"""
def run(self):
# Build docs before source distribution
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)
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
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', '.'
]
if not self.verbose: self.happy_options.insert(0,'-q')
def run(self):
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()
setup(
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=[
'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.metamodels.tests', 'peak.util.tests', 'peak.tests',
'Interface', 'Interface.tests',
'Interface.Common', 'Interface.Common.tests',
'Interface.Registry', 'Interface.Registry.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', ['src/peak/peak.ini']),
('peak/metamodels/tests', ['src/peak/metamodels/tests/MetaMeta.xml']),
],
)