#!/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, find_packages |
|
|
# Metadata |
# Metadata |
|
|
PACKAGE_NAME = "PEAK" |
PACKAGE_NAME = "PEAK" |
PACKAGE_VERSION = "0.5a0" |
PACKAGE_VERSION = "0.5a4" |
|
|
HAPPYDOC_IGNORE = [ |
HAPPYDOC_IGNORE = [ |
'-i', 'examples', '-i', 'old', '-i', 'tests', |
'-i','datetime', '-i','old', '-i','tests', '-i','setup', '-i','examples', |
'-i', 'Interface', '-i', 'Persistence', '-i', 'kjbuckets', |
'-i', 'kjbuckets', '-i', 'ZConfig', '-i', 'csv', |
] |
] |
|
|
|
|
# Base packages for installation |
scripts = ['scripts/peak'] |
|
|
packages = [ |
packages = find_packages('src') |
'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', |
extensions = [ |
'Persistence', |
Extension("kjbuckets", ["src/kjbuckets/kjbucketsmodule.c"]), |
|
Extension( |
|
"peak.binding._once", [ |
|
"src/peak/binding/_once.pyx", "src/peak/binding/getdict.c" |
|
] |
|
), |
|
Extension("peak.util.buffer_gap", ["src/peak/util/buffer_gap.pyx"]), |
|
Extension("peak.util._Code", ["src/peak/util/_Code.pyx"]), |
|
Extension("protocols._speedups", ["src/protocols/_speedups.pyx"]), |
|
Extension( |
|
"peak.persistence._persistence", ["src/peak/persistence/persistence.c"] |
|
), |
|
Extension('_csv', ['src/_csv.c']), |
] |
] |
|
|
|
|
# Base data files |
|
|
|
data_files = [ |
|
('peak', ['src/peak/peak.ini']), |
|
] |
|
|
|
|
|
|
|
|
|
|
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 include_tests: |
|
|
|
packages += [ |
have_uuidgen = False |
'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', |
if os.name=='posix' and hasattr(os, 'uname'): |
'Interface.Registry.tests', |
|
] |
|
|
|
data_files += [ |
un = os.uname() |
('peak/running/tests', ['src/peak/running/tests/test_cluster.txt']), |
|
] |
|
|
|
|
if un[0] == 'FreeBSD' and int(un[2].split('.')[0]) >= 5: |
|
have_uuidgen = True |
|
|
if include_metamodels: |
elif un[0] == 'NetBSD' and int(un[2].split('.')[0]) >= 2: |
|
have_uuidgen = True |
|
|
packages += [ |
elif un[0] == 'NetBSD' and un[2].startswith('1.6Z'): |
'peak.metamodels', |
# XXX for development versions before 2.x where uuidgen |
'peak.metamodels.UML13', |
# is present -- this should be removed at some point |
'peak.metamodels.UML13.model', |
try: |
'peak.metamodels.UML13.model.Foundation', |
if len(un[2]) > 4: |
'peak.metamodels.UML13.model.Behavioral_Elements', |
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 |
|
|
if include_tests: |
|
|
|
packages += [ |
|
'peak.metamodels.tests', |
|
] |
|
|
|
data_files += [ |
execfile('src/setup/common.py') |
('peak/metamodels/tests', |
|
['src/peak/metamodels/tests/MetaMeta.xml'] |
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'] |
|
), |
|
'legacy-support': Feature( |
|
"Python 2.2 support packages", |
|
standard = sys.version_info < (2,3), optional = False, |
|
remove = ['datetime','csv','_csv'], |
), |
), |
|
'fcgiapp': Feature( |
|
"FastCGI support", standard = (os.name=='posix'), |
|
ext_modules = [ |
|
Extension("fcgiapp", [ |
|
"src/fcgiapp/fcgiappmodule.c", "src/fcgiapp/fcgiapp.c" |
|
]) |
|
] |
|
), |
|
'ZConfig': Feature( |
|
"ZConfig 2.0", standard = not zope_installed, remove = ['ZConfig'] |
|
), |
|
'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"]), |
] |
] |
|
), |
|
} |
|
|
|
|
|
|
|
|
execfile('src/setup/common.py') |
|
|
|
|
ALL_EXTS = [ |
|
'*.ini', '*.html', '*.conf', '*.xml', '*.pwt', '*.dtd', '*.txt', |
|
] |
|
|
setup( |
setup( |
name=PACKAGE_NAME, |
name=PACKAGE_NAME, |
version=PACKAGE_VERSION, |
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://peak.telecommunity.com/", |
|
|
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 = SETUP_COMMANDS, |
|
|
data_files = data_files, |
package_data = { |
|
'': ALL_EXTS, |
|
'ZConfig': ['doc/schema.dtd'], |
|
'ZConfig.tests': ['input/*.xml', 'input/*.conf'], |
|
'ZConfig.tests.library.thing': ['extras/extras.xml'], |
|
'peak.metamodels': ['*.asdl'] |
|
}, |
|
|
|
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]), |
|
], |
|
|
|
) |
|
|
|
|
|