Commit 5b55ca0d authored by Fred Drake's avatar Fred Drake

Merge new scripts and configuration/installation support from the

new-install-branch.
parent de577f0b
#!python
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import os
import sys
mydir = os.path.dirname(os.path.abspath(sys.argv[0]))
zopehome = os.path.dirname(mydir)
softwarehome = os.path.join(zopehome, "lib", "python")
if softwarehome not in sys.path:
sys.path.append(softwarehome)
from ZEO.mkzeoinst import ZEOInstanceBuilder
class InstanceBuilder(ZEOInstanceBuilder):
def get_params(self, *args, **kw):
params = ZEOInstanceBuilder.get_params(self, *args, **kw)
sw = os.path.join(softwarehome, "lib", "python")
params["server"] = os.path.join(sw, "ZEO", "runzeo.py")
params["zdrun"] = os.path.join(sw, "zdaemon", "zdrun.py")
params["zdctl"] = os.path.join(sw, "zdaemon", "zdctl.py")
return params
if __name__ == "__main__":
InstanceBuilder().run()
#! python
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""%(program)s: Create a Zope instance home.
usage: %(program)s [options] directory
Options:
-h/--help -- print this help text
-u/--user NAME:PASSWORD -- set the user name and password of the initial user
"""
import getopt
import os
import shutil
import sys
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hu:", ["help", "user="])
except getopt.GetoptError, msg:
usage(sys.stderr, msg)
sys.exit(2)
user = None
password = None
for opt, arg in opts:
if opt in ("-h", "--help"):
usage(sys.stdout)
sys.exit()
if opt in ("-u", "--user"):
if not ":" in arg:
usage(sys.stderr, "user must be specified as name:password")
sys.exit(2)
user, password = arg.split(":", 1)
if len(args) != 1:
usage(sys.stderr, "mkzopeinstance requires exactly one argument")
sys.exit(2)
dirname = os.path.abspath(args[0])
inituser = os.path.join(dirname, "inituser")
if not (user or os.path.exists(inituser)):
user, password = get_inituser()
makeinstance(dirname, user, password, inituser)
def usage(stream, msg=None):
if msg:
print >>stream, msg
print >>stream
program = os.path.basename(sys.argv[0])
print >>stream, __doc__ % {"program": program}
def get_inituser():
import getpass
print 'Please choose a username and password for the initial user.'
print 'These will be the credentials you use to initially manage'
print 'your new Zope instance.'
print
user = raw_input("Username: ").strip()
if user == '':
return None, None
while 1:
passwd = getpass.getpass("Password: ")
verify = getpass.getpass("Verify password: ")
if verify == passwd:
break
else:
passwd = verify = ''
print "Password mismatch, please try again..."
return user, passwd
def makeinstance(dirname, user, password, inituser):
script = os.path.abspath(sys.argv[0])
installation = os.path.dirname(os.path.dirname(script))
skel = os.path.join(installation, "skel")
# Create the top of the instance:
if not os.path.exists(dirname):
os.mkdir(dirname)
replacements = {
"PYTHON": sys.executable,
"INSTANCE_HOME": dirname,
"SOFTWARE_HOME": os.path.join(installation, "lib", "python"),
"ZOPE_HOME": installation,
}
# This is fairly ugly. The chdir() makes path manipulation in the
# walk() callback a little easier (less magical), so we'll live
# with it.
pwd = os.getcwd()
os.chdir(skel)
try:
try:
os.path.walk(os.curdir, copyskel, (dirname, replacements))
finally:
os.chdir(pwd)
except (IOError, OSError), msg:
print >>sys.stderr, msg
sys.exit(1)
if user:
write_inituser(inituser, user, password)
def write_inituser(fn, user, password):
import binascii
import sha
fp = open(fn, "w")
pw = binascii.b2a_base64(sha.new(password).digest())[:-1]
fp.write('%s:{SHA}%s\n' % (user, pw))
fp.close()
os.chmod(fn, 0644)
CVS = os.path.normcase("CVS")
def copyskel((basedir, replacements), dirname, names):
# Don't recurse into CVS directories:
for name in names[:]:
if os.path.normcase(name) == CVS:
names.remove(name)
elif os.path.isfile(os.path.join(dirname, name)):
# Copy the file:
sn, ext = os.path.splitext(name)
if os.path.normcase(ext) == ".in":
dst = os.path.join(basedir, dirname, sn)
if os.path.exists(dst):
continue
copyin(os.path.join(dirname, name), dst, replacements)
else:
src = os.path.join(dirname, name)
dst = os.path.join(basedir, src)
if os.path.exists(dst):
continue
shutil.copyfile(src, dst)
else:
# Directory:
dn = os.path.join(basedir, dirname, name)
if not os.path.exists(dn):
os.mkdir(dn)
def copyin(src, dst, replacements):
ifp = open(src)
text = ifp.read()
ifp.close()
for k in replacements:
text = text.replace("<<%s>>" % k, replacements[k])
ofp = open(dst, "w")
ofp.write(text)
ofp.close()
shutil.copymode(src, dst)
if __name__ == "__main__":
main()
#!python
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Start Zope. Now!"""
import App.config
from Zope.Startup import handlers, options, start_zope
def main():
opts = options.ZopeOptions()
opts.realize()
handlers.handleConfig(opts.configroot, opts.confighandlers)
App.config.setConfiguration(opts.configroot)
start_zope(opts.configroot)
if __name__ == "__main__":
main()
#!python
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""zopectl -- control Zope using zdaemon.
Usage: zopectl [options] [action [arguments]]
Options:
-h/--help -- print usage message and exit
-b/--backoff-limit SECONDS -- set backoff limit to SECONDS (default 10)
-d/--daemon -- run as a proper daemon; fork a subprocess, close files etc.
-f/--forever -- run forever (by default, exit when backoff limit is exceeded)
-h/--help -- print this usage message and exit
-i/--interactive -- start an interactive shell after executing commands
-l/--logfile -- log file to be read by logtail command
action [arguments] -- see below
Actions are commands like "start", "stop" and "status". If -i is
specified or no action is specified on the command line, a "shell"
interpreting actions typed interactively is started (unless the
configuration option default_to_interactive is set to false). Use the
action "help" to find out about available actions.
"""
import os
import sys
import zdaemon
import Zope.Startup
from zdaemon.zdctl import ZDCmd
from zdaemon.zdoptions import ZDOptions
from zLOG.datatypes import FileHandlerFactory
class ZopeCtlOptions(ZDOptions):
"""Zope controller options.
After initialization, this should look very much like a
zdaemon.zdctl.ZDCtlOptions instance. Many of the attributes are
initialized from different sources, however.
"""
positional_args_allowed = 1
program = "zopectl"
schemadir = os.path.dirname(Zope.Startup.__file__)
schemafile = "zopeschema.xml"
# XXX Suppress using Zope's <eventlog> section to avoid using the
# same logging for zdctl as for the Zope appserver. There still
# needs to be a way to set a logfile for zdctl.
logsectionname = None
def __init__(self):
ZDOptions.__init__(self)
self.add("backofflimit", "runner.backoff_limit",
"b:", "backoff-limit=", int, default=10)
self.add("daemon", "runner.daemon", "d", "daemon", flag=1, default=0)
self.add("forever", "runner.forever", "f", "forever",
flag=1, default=0)
self.add("hang_around", "runner.hang_around", default=0)
self.add("interactive", None, "i", "interactive", flag=1)
self.add("default_to_interactive", "runner.default_to_interactive",
default=1)
self.add("logfile", None, "l:", "logfile=")
self.add("prompt", "runner.prompt", default="zopectl>")
def realize(self, *args, **kw):
ZDOptions.realize(self, *args, **kw)
config = self.configroot
self.directory = config.instancehome
self.program = [os.path.join(self.directory, "bin", "runzope")]
self.sockname = os.path.join(config.clienthome, "zopectlsock")
self.user = None
self.python = sys.executable
self.zdrun = os.path.join(os.path.dirname(zdaemon.__file__),
"zdrun.py")
self.exitcodes = [0, 2]
if self.logfile is None and config.eventlog is not None:
for handler in config.eventlog.handler_factories:
if isinstance(handler, FileHandlerFactory):
self.logfile = handler.section.path
if self.logfile not in ("STDERR", "STDOUT"):
break
class ZopeCmd(ZDCmd):
def _get_override(self, opt, name, svalue=None, flag=0):
# Suppress the config file, and pass all configuration via the
# command line. This avoids needing to specialize the zdrun
# script.
if name == "configfile":
return []
value = getattr(self.options, name)
if value is None:
return []
if flag:
if value:
args = [opt]
else:
args = []
else:
if svalue is None:
svalue = str(value)
args = [opt, svalue]
return args
def main(args=None):
# This is exactly like zdctl.main(), but uses ZopeCtlOptions and
# ZopeCmd instead of ZDCtlOptions and ZDCmd, so the default values
# are handled properly for Zope.
options = ZopeCtlOptions()
options.realize(args)
c = ZopeCmd(options)
if options.args:
c.onecmd(" ".join(options.args))
if options.interactive:
try:
import readline
except ImportError:
pass
print "program:", " ".join(options.program)
c.do_status()
c.cmdloop()
if __name__ == "__main__":
main()
#!/bin/sh
# Zope configure script
# $Id: configure,v 1.2 2003/03/18 21:27:49 fdrake Exp $
# $Revision: 1.2 $
#####################################################################
# BEGIN EDITABLE PARAMETERS #
#####################################################################
# Place the optimal target version number for Zope (as returned by sys.version)
# below
TARGET="2.2.2"
# Order a list of "acceptable" python version numbers (as returned by
# sys.version) below in "best" to "worst" order. Up to six
# acceptable python versions are allowed. Do not include the target
# version number in this list.
ACCEPTABLE="2.3 2.3a1 2.3a0"
# provide the executable names for all the acceptable versions
# (and the target version) below
EXENAMES="python python2 python2.1 python2.2 python2.3"
#####################################################################
# END EDITABLE PARAMETERS #
#####################################################################
# where are we?
HERE=`dirname $0`
usage()
{
echo
echo "configure [--help] [--with-python=path] [--prefix=path] "
echo " [--ignore-largefile]"
echo
echo " Creates a Makefile suitable for building and installing Zope"
echo
echo " Options: "
echo " --help shows usage and quits"
echo " --with-python specify a path to a Python interpreter to use"
echo " --prefix specify an installation path for binary data"
echo " --ignore-largefile ignore large file support warnings"
echo " --ignore-zlib ignore warnings about zlib"
echo
echo " Given no options, configure will search your PATH for a suitable"
echo " Python interpreter and will use '/usr/local/zope' as a prefix."
echo
}
# bootstrap ourselves by finding a Python interpreter if necessary
get_python() {
OLDIFS="$IFS"
IFS=":"
FOUND=""
VERSION=""
echo "Testing for an acceptable Python interpreter..."
echo
for DIR in $PATH; do
IFS="$OLDIFS"
for EXECUTABLE in $EXENAMES; do
FULL="$DIR/$EXECUTABLE"
if [ -x "$FULL" ]; then
CMD="import string,sys;print string.split(sys.version)[0]"
VERSION=`$FULL -c "$CMD"`
echo " Python version $VERSION found at $FULL"
if [ "$VERSION" = "$TARGET" ]; then
FOUND="$FULL"
FOUNDVERSION=$VERSION
break 2
else
i=1;
for ACC in $ACCEPTABLE; do
let "i = i + 1"
if [ "$VERSION" = "$ACC" ]; then
eval "FOUND$i=$FULL"
eval "FOUNDVERSION$i=$VERSION"
fi
done
fi
fi
done
done
if [ "$VERSION" = "$TARGET" ]; then
echo
echo " The optimimum Python version ($TARGET) was found at $FOUND."
elif [ -z "$FOUND1" ] && [ -z "$FOUND2" ] && [ -z "$FOUND3" ] &&
[ -z "$FOUND4" ] && [ -z "$FOUND5" ] && [ -z "$FOUND6" ] ; then
echo
echo " No suitable Python version found. You should install Python"
echo " version $TARGET before continuing. Versions $ACCEPTABLE"
echo " also work, but not as optimally."
exit 1
else
if [ -n "$FOUND1" ]; then
FOUND=$FOUND1
FOUNDVERSION=$FOUNDVERSION1
elif [ -n "$FOUND2" ]; then
FOUND=$FOUND2
FOUNDVERSION=$FOUNDVERSION2
elif [ -n "$FOUND3" ]; then
FOUND=$FOUND3
FOUNDVERSION=$FOUNDVERSION3
elif [ -n "$FOUND4" ]; then
FOUND=$FOUND4
FOUNDVERSION=$FOUNDVERSION4
elif [ -n "$FOUND5" ]; then
FOUND=$FOUND5
FOUNDVERSION=$FOUNDVERSION5
elif [ -n "$FOUND6" ]; then
FOUND=$FOUND6
FOUNDVERSION=$FOUNDVERSION6
fi
echo
echo " !! WARNING !! "
echo " An acceptable, but non-optimal Python version ($FOUNDVERSION) "
echo " was found at '$FOUND'."
echo " But consider installing version '$TARGET' before running "
echo " 'make'. If this isn't the Python version or interpreter "
echo " instance you wish to use, you may specify a Python interpreter"
echo " manually by rerunning the ./configure script with the "
echo " '--with-python' option."
fi
echo
}
NEWOPTS=""
for OPT in $@; do
case "$OPT" in
--h* | -h*)
usage
exit 0
;;
--with-python=*)
# pop this argument from the arglist, it is not valid to
# pass this along to the Python configurator.
shift;
FOUND=`echo $OPT | sed -e 's/--with-python\=//'`
# use eval to do tilde expansion below
eval "FOUND='$FOUND'"
echo
echo "Using Python interpreter at $FOUND"
;;
*)
NEWOPTS="$NEWOPTS $OPT"
;;
esac
done
echo
echo "Configuring Zope installation"
echo
if [ -z "$FOUND" ]; then
get_python
fi
# run the Python configurator
"$FOUND" "$HERE/inst/configure.py" $NEWOPTS
# Zope2 build and install Makefile.
# We do as much as possible in Python in order to avoid needing to
# learn autoconf or some other awful thing. ;-)
NAME=Zope
MAJOR_VERSION=<<ZOPE_MAJOR_VERSION>>
MINOR_VERSION=<<ZOPE_MINOR_VERSION>>
RELEASE_TAG=<<VERSION_RELEASE_TAG>>
PACKAGE_NAME=${NAME}-${MAJOR_VERSION}.${MINOR_VERSION}-${RELEASE_TAG}
PYTHON="<<PYTHON>>"
TARGET_DIR=<<TARGET_DIR>>
BUILD_DIR=<<BUILD_DIR>>
RM=rm -f
RMRF=rm -rf
FIND=find
XARGS=xargs
CD=cd
LN=ln -sf
CP=cp
INSTALL_COPY=${PYTHON} inst/install.py
WRITE_INFILE=${PYTHON} inst/file_from_infile.py
.PHONY : clean install uninstall instance links hacklinks untestinst testinst
.PHONY : default
default: build
@echo
@echo Zope built. Next, do \'make install\' \(or \'make instance\'
@echo to run a Zope instance directly from the build directory\).
@echo
build:
${PYTHON} inst/setup.py <<DISTUTILS_OPTS>> build_ext -i
install: build
${PYTHON} inst/setup.py <<DISTUTILS_OPTS>> install \
--home="${TARGET_DIR}" <<OPT_FLAGS>>
@echo
@echo Zope binaries installed successfully.
@echo Now run \'${TARGET_DIR}/bin/mkzopeinstance\'
instance: build
${PYTHON} bin/mkzopeinstance .
# testinst makes an instance home in the build directory without asking
# any questions. this is useful when testing. instances made with
# this can be removed via "make untestinst"
testinst: build
${PYTHON} bin/mkzopeinstance --user=admin:admin .
# remove the instance files made with testinst (w/ prejudice)
untestinst:
${RM} bin/zopectl.py
${RM} bin/ntservice.py
${RMRF} etc
${RMRF} log
uninstall:
${RMRF} "${TARGET_DIR}"
TESTOPTS=-v1 -d lib/python
test: build
${PYTHON} utilities/testrunner.py ${TESTOPTS}
clean:
${RMRF} build lib/python/build
${FIND} . -name '*.py[co]' -o -name 'core*' | ${XARGS} ${RM}
clobber: clean untestinst
${FIND} lib/python -name '*.so' | ${XARGS} ${RM}
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Create a Makefile for building and installing Zope.
"""
import getopt
import os
import sys
import versions
if sys.platform == 'win32':
TARGET_DIR = 'c:\\Zope-' + versions.ZOPE_MAJOR_VERSION
IN_MAKEFILE = 'Makefile.win.in'
MAKE_COMMAND='the Visual C++ batch file "VCVARS32.bat" and then "nmake build"'
else:
TARGET_DIR = '/opt/Zope-' + versions.ZOPE_MAJOR_VERSION
IN_MAKEFILE = 'Makefile.in'
MAKE_COMMAND='make'
def main():
# below assumes this script is in the BUILD_DIR/inst directory
BUILD_DIR=os.path.abspath(os.path.dirname(os.path.dirname(sys.argv[0])))
PYTHON=sys.executable
MAKEFILE=open(os.path.join(BUILD_DIR, 'inst', IN_MAKEFILE)).read()
REQUIRE_LF_ENABLED = 1
REQUIRE_ZLIB=1
OPT_FLAGS = ''
zope_home = TARGET_DIR
build_dir = BUILD_DIR
python = PYTHON
try:
longopts = ["help", "ignore-largefile", "ignore-zlib", "prefix=",
"optimize"]
opts, args = getopt.getopt(sys.argv[1:], "h", longopts)
except getopt.GetoptError, v:
print v
usage()
sys.exit(1)
for o, a in opts:
if o in ('-h', '--help'):
usage()
sys.exit()
if o == '--prefix':
zope_home=os.path.abspath(os.path.expanduser(a))
if o == "--ignore-largefile":
REQUIRE_LF_ENABLED=0
if o == "--ignore-zlib":
REQUIRE_ZLIB=0
if o == "--optimize":
OPT_FLAGS = '--optimize=1 --no-compile'
if REQUIRE_LF_ENABLED:
test_largefile()
if REQUIRE_ZLIB:
test_zlib()
print " - Zope top-level binary directory will be %s." % zope_home
if OPT_FLAGS:
print " - Distutils install flags will be '%s'" % OPT_FLAGS
distutils_opts = ""
if sys.version[:3] < "2.3":
distutils_opts = "-q"
idata = {
'<<PYTHON>>':python,
'<<TARGET_DIR>>':zope_home,
'<<BUILD_DIR>>':build_dir,
'<<OPT_FLAGS>>':OPT_FLAGS,
'<<ZOPE_MAJOR_VERSION>>':versions.ZOPE_MAJOR_VERSION,
'<<ZOPE_MINOR_VERSION>>':versions.ZOPE_MINOR_VERSION,
'<<VERSION_RELEASE_TAG>>':versions.VERSION_RELEASE_TAG,
'<<DISTUTILS_OPTS>>':distutils_opts,
}
for k,v in idata.items():
MAKEFILE = MAKEFILE.replace(k, v)
f = open(os.path.join(BUILD_DIR, 'makefile'), 'w')
f.write(MAKEFILE)
print " - Makefile written."
print
print " Next, run %s." % MAKE_COMMAND
print
def usage():
usage = ("""
%(program)s configures and writes a Makefile for Zope.
Defaults for options are specified in brackets.
Configuration:
-h, --help display this help and exit
Options:
--ignore-zlib allow configuration to proceeed if
Python zlib module is not found.
--ignore-largefile allow configuration to proceed without
Python large file support.
--optimize compile Python files as .pyo files
instead of as .pyc files
Installation directories:
--prefix=DIR install Zope files in DIR [%(zope_home)s]
By default, 'make install' will install Zope software files in
'%(target_dir)s' You can specify an alternate location for these
files by using '--prefix', for example: '--prefix=$HOME/zope'.
""" % ({'program':sys.argv[0], 'target_dir':TARGET_DIR})
)
print usage
def test_zlib():
try:
import zlib
except ImportError:
print (
"""
The Python interpreter you are using does not appear to have the 'zlib'
library module installed. For Zope to be able to run, you must install a
Python interpreter which includes the zlib module, or install the zlib library
into your Python interpreter manually. The file which represents the library
is named 'zlib.so' (UNIX) or 'zlib.dll' (Windows) and is typically located in
the 'lib-dynload' directory of your Python's library directory. Some
Python packagers ship the zlib module as a separate installable binary. If you
are using a system-provided Python installation, you may want to look for
a 'python-zlib' package (or something like it) and install it to make the
Python zlib module available to Zope.
Run the configure script with the --ignore-zlib option to prevent this
warning with the understanding that Zope will not start properly until
you've installed the zlib module.
"""
)
sys.exit(1)
except:
print 'An error occurred while trying to import zlib!'
import traceback; traceback.print_exc()
sys.exit(1)
def test_largefile():
OK=0
f = open(sys.argv[0], 'r')
try:
# 2**31 == 2147483648
f.seek(2147483649L)
f.close()
OK=1
except (IOError, OverflowError):
f.close()
if OK:
return
print (
"""
This Python interpreter does not have 'large file support' enabled. Large
file support is required to allow the default Zope ZODB database to grow
larger than 2GB on most platforms. Either install a Python interpreter with
large file support (see
http://www.python.org/doc/current/lib/posix-large-files.html) or run this
program again with the --ignore-largefile option to prevent this warning,
with the understanding that your Zope may fail if the ZODB database
size ever exceeds 2GB.
"""
)
sys.exit(1)
if __name__ == '__main__':
main()
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Reads a file named by 'src', performs textual replacements on the
file based on sed-style markup, and writes the result to the file named
by 'dst' unless 'dst' already exists.
"""
import getopt, os, sys
from os.path import abspath, split, dirname
import shutil
import versions
default_map = {
'PYTHON' : sys.executable,
'BASE_DIR' : abspath(split(dirname(sys.argv[0]))[0]),
'ZOPE_MAJOR_VERSION' : versions.ZOPE_MAJOR_VERSION,
'ZOPE_MINOR_VERSION' : versions.ZOPE_MINOR_VERSION,
'ZOPE_BRANCH_NAME' : versions.ZOPE_BRANCH_NAME,
'VERSION_RELEASE_TAG' : versions.VERSION_RELEASE_TAG,
}
def main(source, dest, map, force):
if not force and os.path.exists(dest):
print '%s exists, so I left it alone' % dest
else:
txt = open(source, 'rb').read()
for k, v in map.items():
txt = txt.replace('<<%s>>' % k, v)
outfile = open(dest, 'wb')
outfile.write(txt)
outfile.close()
shutil.copystat(source, dest)
print "Wrote %s from %s" % (dest, source)
def usage():
print "%s [opts] src dst" % sys.argv[0]
print
print "Reads a file named by 'src', performs textual replacements on "
print "the file based on sed-style markup embedded in the infile, and "
print "and writes the result to the file named by 'dst' unless 'dst'."
print "already exists. The generated file will have the same permissions"
print "and other mode bit settings as the source file."
print
print "Options:"
print
print " --force Force replacement of dst even if it already exists."
for name, value in default_map.items():
print (" --%s=value controls text replacement, default '%s'"
% (name, value))
if __name__ == '__main__':
if len(sys.argv) < 3:
usage()
sys.exit(127)
map = default_map.copy()
force = 0
try:
longopts = ['help', 'force']
for name in default_map.keys():
longopts.append('%s=' % name)
opts, args = getopt.getopt(sys.argv[1:], 'h', longopts)
except getopt.GetoptError, v:
print v
usage()
sys.exit(1)
try:
source, dest = args
except:
usage()
sys.exit(1)
for o, a in opts:
if o in ('-h', '--help'):
usage()
sys.exit()
if o == '--force':
force = 1
if o in map.keys():
map[o] = a
main(source, dest, map, force)
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Generic file and directory installer.
Typically called when installing Zope via the Makefile written by
'configure.py' in the 'make install' step.
"""
import getopt
import os
import re
import shutil
import stat
import sys
# RE that, if a pathname's base name matches, causes it to be ignored
# when copying that file or directory.
default_omitpattern = r'(\..*|CVS|.*~)$'
def main(src, dst, dirmode=0755, fmode=0644,
omitpattern=default_omitpattern, retain_xbit=1):
"""
Copy a file or directory named by src to a file or directory named by
dst, normalizing mode bit settings as necessary. Recursively copies
directory trees using shutil.copy2().
Errors are reported to standard output.
- 'dirmode' is the directory creation mode. All directories
are created with this mode.
- 'fmode' is the default file creation mode. This mode
is modified by the status of the source file. If the source
file is executable, mod the fmode to be +wgo executable.
- omitpattern is a Python-style regex pattern. If a file
or directory name matches this pattern, it will never be copied.
- if the dst directory already exists, don't raise an error.
"""
try:
if os.path.isdir(src):
copydir(src, dst, dirmode, fmode, omitpattern,
retain_xbit)
else:
names = omit([src], omitpattern)
names and copyfile(names[0], dst, fmode, retain_xbit)
except (IOError, os.error), why:
print "Can't copy %s to %s: %s" % (`src`, `dst`, str(why))
def copydir(src, dst, dirmode, fmode, omitpattern, retain_xbit):
names = omit(os.listdir(src), omitpattern)
try:
# always create directories with dirmode
os.makedirs(dst, dirmode)
except os.error, why:
if why[0] == 17:
# directory already exists
pass
else:
raise
for name in omit(names, omitpattern):
srcname = os.path.join(src, name)
dstname = os.path.join(dst, name)
if os.path.isdir(srcname):
copydir(srcname, dstname, dirmode,fmode,omitpattern,
retain_xbit)
else:
copyfile(srcname, dstname, fmode, retain_xbit)
def copylink(src, dst):
linkto = os.readlink(src)
os.symlink(linkto, dst)
def copyfile(src, dst, mode, retain_xbit):
shutil.copy2(src, dst)
# change dest file mode to fmode but
# make +wgo executable if source file is executable
dstmode = mode
st = os.stat(src)
srcmode = st[stat.ST_MODE]
if retain_xbit and (srcmode & stat.S_IEXEC):
dstmode = (mode | 0111)
if os.path.isdir(dst):
# if dst is a directory, copy the file in to it
os.chmod(os.path.join(dst, os.path.split(src)[-1]), dstmode)
else:
os.chmod(dst, dstmode)
omitcache = {}
def omit(names, omitpattern):
return [ n for n in names
if not re.match(omitpattern, os.path.basename(n)) ]
def usage():
print "%s [opts] source dest" % sys.argv[0]
print
print "Copies a file or directory specified by 'source' to 'dest'"
print "normalizing mode bit settings as necessary."
print
print "If src is a file and dst is a directory, the file will be"
print "copied into the dst directory. However, if src is a directory"
print "and dst is a directory, the contents of src will be copied into"
print "dst."
print
print "opts: --dirmode=mode --fmode=mode --omitpattern=patt"
print
print " --dontcopyxbit when copying a file marked as executable,"
print " don't make the copy executable."
print " --dirmode mode bit settings of dest dirs (e.g. '755')"
print " --fmode mode bit settings of dest files (e.g. '644')"
print " (modified wgo+x when dontcopyxbit is not"
print " specified)"
print " --omitpattern a Python-style regex pattern. File and"
print " directory names which match this pattern will "
print " not be copied. The default omitpattern is"
print " '%s'" % default_omitpattern
if __name__ == '__main__':
if len(sys.argv) < 3:
print "too few arguments"
usage()
sys.exit(2)
dirmode = 0755
fmode = 0644
omitpattern = default_omitpattern
retain_xbit = 1
longopts = ['dirmode=', 'fmode=', 'omitpattern=', 'help',
'copyxmode' ]
try:
opts, args = getopt.getopt(sys.argv[1:], 'h', longopts)
except getopt.GetoptError, v:
print v
usage()
sys.exit(2)
try:
source, dest = args
except:
print "wrong number of arguments"
usage()
sys.exit(2)
for o, a in opts:
if o in ('-h', '--help'):
usage()
sys.exit()
if o == '--dirmode':
if not a.startswith('0'):
a = '0%s' % a
dirmode = eval(a)
if o == '--fmode':
if not a.startswith('0'):
a = '0%s' % a
fmode = eval(a)
if o == '--omitpattern':
omitpattern = a
if o == '--dontcopyxbit':
retain_xbit = 0
main(source, dest, dirmode, fmode, omitpattern, retain_xbit)
#! /usr/bin/env python
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Distutils setup for Zope
In-place building
This builds extension modules in-place, much like build_extensions.py
does. Use 'setup.py' like this::
python setup.py build_ext -i
Installation
This builds extension modules, compiles python modules, and installs
everything needed to support Zope instances in the directory of
your choosing. For example, to use '/usr/local/lib/zope'::
python setup.py install \
--home=/usr/local/lib/zope \
--install-platlib=/usr/local/lib/zope \
--install-purelib=/usr/local/lib/zope
Note that with this method, all packages and scripts (including
ZServer and z2.py) go in the same directory as Zope modules, which
are distributed in lib/python. You will need to set both ZOPE_HOME
and SOFTWARE_HOME to point to your destination directory in order
for Zope to work in this configuration.
"""
import glob
import os
import sys
import distutils.core
from distutils.core import Extension
# This function collects setup information for one massive distutils
# run to be done at the end of the script. If you're making a setup.py
# to use modules from Zope separately, you should be able to cut-and-paste
# the individual setup calls out into your own setup.py and it should
# Just Work(tm).
setup_info = {}
def setup(name=None, author=None, cmdclass=None, **kwargs):
for keyword in kwargs.keys():
if not setup_info.has_key(keyword):
setup_info[keyword] = []
setup_info[keyword] += kwargs[keyword]
# Override install_data to install into module directories, and to support
# globbing on data_files.
from distutils.command.install import install
from distutils.command.install_data import install_data
from distutils.util import convert_path
class ZopeInstallData(install_data):
def finalize_options(self):
self.set_undefined_options('install',
('install_purelib', 'install_dir'),
('root', 'root'),
('force', 'force'),
)
def run(self):
self.mkpath(self.install_dir)
for f in self.data_files:
if isinstance(f, str):
# it's a simple file, so copy it
f = convert_path(f)
gl = glob.glob(f)
if len(gl) == 0:
raise distutils.core.DistutilsFileError, \
"can't copy '%s': no matching files" % f
for g in gl:
if os.path.isfile(g):
if self.warn_dir:
self.warn("setup script did not provide a "
"directory for '%s' -- installing "
"right in '%s'" %
(g, self.install_dir))
(out, _) = self.copy_file(g, self.install_dir)
self.outfiles.append(out)
else:
# it's a tuple with path to install to and a list of files
dir = convert_path(f[0])
if not os.path.isabs(dir):
dir = os.path.join(self.install_dir, dir)
elif self.root:
dir = change_root(self.root, dir)
self.mkpath(dir)
for data in f[1]:
data = convert_path(data)
gl = glob.glob(data)
if len(gl) == 0:
raise distutils.core.DistutilsFileError, \
"can't copy '%s': no matching files" % data
for g in gl:
if os.path.isfile(g):
(out, _) = self.copy_file(g, dir)
self.outfiles.append(out)
# We create a custom "install scheme" that works the same way on all
# platforms. We do this in order to prevent distutils from trying to
# guess where to put our files on a per-platform basis.
ZOPE_INSTALL_SCHEME = {
'purelib': '$base/lib/python',
'platlib': '$base/lib/python',
'headers': '$base/lib/python',
'scripts': '$base/bin',
'data' : '$base/lib/python',
}
class ZopeInstall(install):
def select_scheme(self, name):
"""
Override the default platform installation schemes, ignoring whatever
'name' is passed in. For our purposes, we want to put all library,
header, and data into [install_base]/lib/python. Comment
this method out to achieve distutils-standard platform-specific
behavior for 'setup.py install'. This is most useful if you set the
[install-base] by using the '--prefix' or '--home' flags on the
setup.py install command line. Otherwise, all Zope software
will probably be installed to your Python's 'lib/python' directory.
"""
scheme = ZOPE_INSTALL_SCHEME
import distutils.command.install
for key in distutils.command.install.SCHEME_KEYS:
attrname = 'install_' + key
if getattr(self, attrname) is None:
setattr(self, attrname, scheme[key])
class ZopeDistribution(distutils.core.Distribution):
def __init__(self, attrs):
distutils.core.Distribution.__init__(self, attrs)
self.cmdclass["install"] = ZopeInstall
self.cmdclass["install_data"] = ZopeInstallData
# presumes we're currently cd'ed to the build root directory
ZOPE_ROOT = os.path.abspath(os.getcwd())
AUTHOR = 'Zope Corporation and Contributors'
EXTENSIONCLASS_ROOT = os.path.join(ZOPE_ROOT, 'lib', 'Components', 'ExtensionClass')
EXTENSIONCLASS_SRCDIR = os.path.join(EXTENSIONCLASS_ROOT, 'src')
PACKAGES_ROOT = os.path.join(ZOPE_ROOT, 'lib', 'python')
EXTENSIONCLASS_INCLUDEDIRS = [EXTENSIONCLASS_SRCDIR]
# Most modules are in lib/python in the source distribution
os.chdir(PACKAGES_ROOT)
# AccessControl
setup(
name='AccessControl',
author=AUTHOR,
packages=['AccessControl',
'AccessControl.tests', 'AccessControl.tests.mixed_module',
'AccessControl.tests.mixed_module.submodule',
'AccessControl.tests.private_module',
'AccessControl.tests.private_module.submodule',
'AccessControl.tests.public_module',
'AccessControl.tests.public_module.submodule'],
data_files=[['AccessControl', ['AccessControl/*.txt']],
['AccessControl/dtml', ['AccessControl/dtml/*']],
['AccessControl/securitySuite',
['AccessControl/securitySuite/README',
'AccessControl/securitySuite/*.py']],
['AccessControl/www', ['AccessControl/www/*']]],
ext_modules=[
Extension(name='AccessControl.cAccessControl',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=['AccessControl/cAccessControl.c'])]
)
# App
setup(
name='App',
author=AUTHOR,
packages=['App'],
data_files=[['App/dtml', ['App/dtml/*']],
['App/www', ['App/www/*']]],
)
# BTrees
setup(
name='BTrees',
author=AUTHOR,
packages=['BTrees', 'BTrees.tests'],
ext_modules=[
Extension(name='BTrees._OOBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
sources=['BTrees/_OOBTree.c']),
Extension(name='BTrees._OIBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
sources=['BTrees/_OIBTree.c']),
Extension(name='BTrees._IIBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
sources=['BTrees/_IIBTree.c']),
Extension(name='BTrees._IOBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
sources=['BTrees/_IOBTree.c']),
Extension(name='BTrees._fsBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
sources=['BTrees/_fsBTree.c'])],
data_files=[['BTrees', ['BTrees/Maintainer.txt']]],
)
# BTrees compatibility package
setup(
name='BTree',
author=AUTHOR,
#headers=['../Components/BTree/intSet.h'],
ext_modules=[
Extension(name='BTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
sources=['../Components/BTree/BTree.c']),
Extension(name='IIBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
sources=['../Components/BTree/IIBTree.c']),
Extension(name='IOBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
sources=['../Components/BTree/IOBTree.c']),
Extension(name='OIBTree',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
sources=['../Components/BTree/OIBTree.c']),
Extension(name='intSet',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS + ['ZODB'],
sources=['../Components/BTree/intSet.c'])]
)
# DateTime
setup(
name='DateTime',
author=AUTHOR,
packages=['DateTime', 'DateTime.tests'],
data_files=[['DateTime', ['DateTime/DateTime.txt']],
['DateTime/tests', ['DateTime/tests/julian_testdata.txt.gz']]],
)
# DocumentTemplate
setup(
name='DocumentTemplate',
author=AUTHOR,
packages=['DocumentTemplate', 'DocumentTemplate.sequence',
'DocumentTemplate.sequence.tests', 'DocumentTemplate.tests'],
data_files=[['DocumentTemplate', ['DocumentTemplate/Let.stx']],
['DocumentTemplate/tests',
['DocumentTemplate/tests/dealers.*']]],
ext_modules=[
Extension(name='DocumentTemplate.cDocumentTemplate',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=['DocumentTemplate/cDocumentTemplate.c'])]
)
# docutils
setup(
name='docutils',
author='David Goodger and contributors',
packages=['docutils', 'docutils.languages', 'docutils.parsers',
'docutils.parsers.rst', 'docutils.parsers.rst.directives',
'docutils.parsers.rst.languages', 'docutils.readers',
'docutils.transforms', 'docutils.writers'],
)
# ExtensionClass
setup(
name='ExtensionClass',
author=AUTHOR,
ext_modules=[
Extension(name='ExtensionClass',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/ExtensionClass.c"]),
Extension(name='Acquisition',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/Acquisition.c"]),
Extension(name='MethodObject',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/MethodObject.c"]),
Extension(name='MultiMapping',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/MultiMapping.c"]),
Extension(name='ThreadLock',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/ThreadLock.c"]),
Extension(name='Missing',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/Missing.c"]),
Extension(name='Record',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/Record.c"]),
Extension(name='ComputedAttribute',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=[EXTENSIONCLASS_SRCDIR + "/ComputedAttribute.c"]),
]
)
# HelpSys
setup(
name='HelpSys',
author=AUTHOR,
packages=['HelpSys'],
data_files=[['HelpSys/dtml', ['HelpSys/dtml/*']],
['HelpSys/images', ['HelpSys/images/*']]],
)
# Interface
setup(
name='Interface',
author=AUTHOR,
packages=['Interface', 'Interface.tests',
'Interface.Common', 'Interface.Common.tests'],
)
# logging
setup(
name='logging',
author='Vinay Sajip',
packages=['logging'],
)
# OFS
setup(
name='OFS',
author=AUTHOR,
packages=['OFS', 'OFS.tests'],
data_files=[['OFS/dtml', ['OFS/dtml/*']],
['OFS/standard', ['OFS/standard/*']],
['OFS/www', ['OFS/www/*']]],
)
# RestrictedPython
setup(
name='RestrictedPython',
author=AUTHOR,
packages=['RestrictedPython', 'RestrictedPython.compiler_2_1',
'RestrictedPython.tests'],
data_files=[['RestrictedPython/compiler_2_1',
['RestrictedPython/compiler_2_1/ast.txt']]],
)
# SearchIndex
setup(
name='SearchIndex',
author=AUTHOR,
packages=['SearchIndex', 'SearchIndex.tests'],
data_files=[['SearchIndex', ['SearchIndex/*.txt']]],
ext_modules=[
Extension(name='SearchIndex.Splitter',
sources=['SearchIndex/Splitter.c'])]
)
# Shared.DC bases
setup(
name='Shared.DC',
author=AUTHOR,
packages=['Shared', 'Shared.DC']
)
# Scripts
setup(
name='Scripts',
author=AUTHOR,
packages=['Shared.DC.Scripts'],
data_files=[['Shared/DC/Scripts/dtml', ['Shared/DC/Scripts/dtml/*']]],
)
# StructuredText
setup(
name='StructuredText',
author=AUTHOR,
packages=['StructuredText', 'StructuredText.tests'],
data_files=[['StructuredText', ['StructuredText/*.txt']],
['StructuredText/regressions',
['StructuredText/regressions/*.py',
'StructuredText/regressions/*.ref',
'StructuredText/regressions/*.stx']]],
)
# Signals
setup(
name='Signals',
author=AUTHOR,
packages=['Signals'],
)
# ZRDB
setup(
name='ZRDB',
author=AUTHOR,
packages=['Shared.DC.ZRDB'],
data_files=[['Shared/DC/ZRDB/dtml', ['Shared/DC/ZRDB/dtml/*']],
['Shared/DC/ZRDB/www', ['Shared/DC/ZRDB/www/*']]],
)
# dcpyexpat
PYEXPAT_DIR=os.path.join(PACKAGES_ROOT, 'Shared', 'DC', 'xml', 'pyexpat')
DCPYEXPAT_INCLUDEDIRS=[os.path.join(PYEXPAT_DIR, 'expat', 'xmlparse'),
os.path.join(PYEXPAT_DIR, 'expat', 'xmltok')]
setup(
name='dcpyexpat',
author=AUTHOR,
packages=['Shared.DC.xml', 'Shared.DC.xml.pyexpat'],
data_files=[['Shared/DC/xml/pyexpat', ['Shared/DC/xml/pyexpat/README']]],
ext_modules=[
Extension(name='Shared.DC.xml.pyexpat.dcpyexpat',
include_dirs=DCPYEXPAT_INCLUDEDIRS,
define_macros=[('XML_NS', None)],
sources=[PYEXPAT_DIR + '/expat/xmlparse/xmlparse.c',
PYEXPAT_DIR + '/expat/xmlparse/hashtable.c',
PYEXPAT_DIR + '/expat/xmltok/xmlrole.c',
PYEXPAT_DIR + '/expat/xmltok/xmltok.c',
PYEXPAT_DIR + '/dcpyexpat.c'])]
)
# TAL
setup(
name='TAL',
author=AUTHOR,
packages=['TAL', 'TAL.tests'],
data_files=[['TAL', ['TAL/*.txt']],
['TAL/benchmark', ['TAL/benchmark/*']],
['TAL/tests/input', ['TAL/tests/input/*']],
['TAL/tests/output', ['TAL/tests/output/*']]],
)
# Testing
setup(
name='Testing',
author=AUTHOR,
packages=['Testing'],
data_files=[['Testing', ['Testing/README.txt']],
['Testing/var', ['Testing/var/README.txt']]],
)
# ThreadedAsync
setup(
name='ThreadedAsync',
author=AUTHOR,
packages=['ThreadedAsync'],
)
# TreeDisplay
setup(
name='TreeDisplay',
author=AUTHOR,
packages=['TreeDisplay'],
data_files=[['TreeDisplay/www', ['TreeDisplay/www/*']]],
)
# ZClasses
setup(
name='ZClasses',
author=AUTHOR,
packages=['ZClasses'],
data_files=[['ZClasses', ['ZClasses/*.gif']],
['ZClasses/dtml', ['ZClasses/dtml/*']]],
)
# ZODB
setup(
name='ZODB',
author=AUTHOR,
packages=['Persistence', 'ZODB', 'ZODB.tests'],
data_files=[['ZODB', ['ZODB/component.xml']]],
ext_modules=[
Extension(name='ZODB.cPersistence',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=['ZODB/cPersistence.c']),
Extension(name='ZODB.cPickleCache',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=['ZODB/cPickleCache.c']),
Extension(name='ZODB.TimeStamp',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
define_macros=[('USE_EXTENSION_CLASS', 1)],
sources=['ZODB/TimeStamp.c']),
Extension(name='ZODB.coptimizations',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=['ZODB/coptimizations.c']),
Extension(name='ZODB.winlock',
include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
sources=['ZODB/winlock.c'])],
)
# ZPublisher
setup(
name='ZPublisher',
author=AUTHOR,
packages=['ZPublisher', 'ZPublisher.tests'],
)
# ZTUtils
setup(
name='ZTUtils',
author=AUTHOR,
packages=['ZTUtils', 'ZTUtils.tests'],
data_files=[['ZTUtils', ['ZTUtils/*.txt']]],
)
# Zope
setup(
name='Zope',
author=AUTHOR,
packages=['Zope', 'Zope.App', 'Zope.Startup', 'Zope.Startup.misc',
'Zope.Startup.nt'],
data_files=[ ['Zope/Startup', ['Zope/Startup/*.xml']] ],
)
# webdav
setup(
name='webdav',
author=AUTHOR,
packages=['webdav'],
data_files=[['webdav/dtml', ['webdav/dtml/*']],
['webdav/www', ['webdav/www/*']]],
)
# zExceptions
setup(
name='zExceptions',
author=AUTHOR,
packages=['zExceptions', 'zExceptions.tests'],
)
# zLOG
setup(
name='zLOG',
author=AUTHOR,
packages=['zLOG', 'zLOG.tests'],
data_files=[['zLOG', ['zLOG/*.xml']]],
)
# zdaemon
setup(
name='zdaemon',
author=AUTHOR,
packages=['zdaemon', 'zdaemon.tests'],
data_files=[['zdaemon', ['zdaemon/sample.conf', 'zdaemon/schema.xml']]],
)
# initgroups
setup(
name='initgroups',
author=AUTHOR,
ext_modules=[
Extension(name='initgroups',
sources=['../Components/initgroups/initgroups.c'])]
)
# ZopeUndo
setup(
name='ZopeUndo',
author=AUTHOR,
packages=['ZopeUndo', 'ZopeUndo.tests'],
)
# ZEO
setup(
name='ZEO',
author=AUTHOR,
packages=['ZEO', 'ZEO.tests', 'ZEO.zrpc'],
data_files=[['ZEO', ['ZEO/*.txt', 'ZEO/component.xml']]],
)
# ZConfig
setup(
name='ZConfig',
author=AUTHOR,
packages=['ZConfig', 'ZConfig.tests'],
data_files=[
['../../doc/zconfig', ['ZConfig/doc/zconfig.pdf',
'ZConfig/doc/schema.dtd']],
['ZConfig/tests/input', ['ZConfig/tests/input/*']],
['ZConfig/tests/library/thing', ['ZConfig/tests/library/thing/*']],
['ZConfig/tests/library/widget', ['ZConfig/tests/library/widget/*']],
],
scripts=["ZConfig/scripts/zconfig"],
)
# Other top-level packages (XXX should these be broken out at all?)
setup(
name='Top-level',
author=AUTHOR,
py_modules=['Globals', 'ImageFile', 'xmlrpclib', 'Lifetime']
)
# Products base directory
setup(
name='Products',
author=AUTHOR,
packages=['Products']
)
# ExternalMethod product
setup(
name='ExternalMethod',
author=AUTHOR,
packages=['Products.ExternalMethod', 'Products.ExternalMethod.tests'],
data_files=[['Products/ExternalMethod',
['Products/ExternalMethod/*.gif',
'Products/ExternalMethod/*.txt']],
['Products/ExternalMethod/dtml',
['Products/ExternalMethod/dtml/*']],
['Products/ExternalMethod/help',
['Products/ExternalMethod/help/*']],
['Products/ExternalMethod/tests/Extensions',
['Products/ExternalMethod/tests/Extensions/*.py']],
['Products/ExternalMethod/www',
['Products/ExternalMethod/www/*']]],
)
# MIMETools product
setup(
name='MIMETools',
author=AUTHOR,
packages=['Products.MIMETools'],
data_files=[['Products/MIMETools', ['Products/MIMETools/*.txt']]],
)
# MailHost product
setup(
name='MailHost',
author=AUTHOR,
packages=['Products.MailHost', 'Products.MailHost.tests'],
data_files=[['Products/MailHost', ['Products/MailHost/*.txt']],
['Products/MailHost/dtml', ['Products/MailHost/dtml/*']],
['Products/MailHost/help', ['Products/MailHost/help/*.py',
'Products/MailHost/help/*.stx']],
['Products/MailHost/www', ['Products/MailHost/www/*']]],
)
# OFSP product
setup(
name='OFSP',
author=AUTHOR,
packages=['Products.OFSP'],
data_files=[['Products/OFSP', ['Products/OFSP/*.txt']],
['Products/OFSP/dtml', ['Products/OFSP/dtml/*']],
['Products/OFSP/help', ['Products/OFSP/help/*.py',
'Products/OFSP/help/*.stx']],
['Products/OFSP/images', ['Products/OFSP/images/*']]],
)
# PageTemplates product
setup(
name='PageTemplates',
author=AUTHOR,
packages=['Products.PageTemplates', 'Products.PageTemplates.tests'],
data_files=[['Products/PageTemplates', ['Products/PageTemplates/*.txt']],
['Products/PageTemplates/examples',
['Products/PageTemplates/examples/*']],
['Products/PageTemplates/help',
['Products/PageTemplates/help/*.py',
'Products/PageTemplates/help/*.stx']],
['Products/PageTemplates/tests/input',
['Products/PageTemplates/tests/input/*']],
['Products/PageTemplates/tests/output',
['Products/PageTemplates/tests/output/*']],
['Products/PageTemplates/www',
['Products/PageTemplates/www/*']]],
)
# PluginIndexes product
setup(
name='PluginIndexes',
author=AUTHOR,
packages=['Products.PluginIndexes',
'Products.PluginIndexes.DateIndex',
'Products.PluginIndexes.DateIndex.tests',
'Products.PluginIndexes.DateRangeIndex',
'Products.PluginIndexes.DateRangeIndex.tests',
'Products.PluginIndexes.FieldIndex',
'Products.PluginIndexes.FieldIndex.tests',
'Products.PluginIndexes.KeywordIndex',
'Products.PluginIndexes.KeywordIndex.tests',
'Products.PluginIndexes.PathIndex',
'Products.PluginIndexes.PathIndex.tests',
'Products.PluginIndexes.TextIndex',
'Products.PluginIndexes.TextIndex.Splitter',
'Products.PluginIndexes.TextIndex.Splitter.ISO_8859_1_Splitter',
'Products.PluginIndexes.TextIndex.Splitter.UnicodeSplitter',
'Products.PluginIndexes.TextIndex.Splitter.UnicodeSplitter.tests',
'Products.PluginIndexes.TextIndex.Splitter.ZopeSplitter',
'Products.PluginIndexes.TextIndex.tests',
'Products.PluginIndexes.TopicIndex',
'Products.PluginIndexes.TopicIndex.tests',
'Products.PluginIndexes.common'],
data_files=[['Products/PluginIndexes', ['Products/PluginIndexes/*.txt']],
['Products/PluginIndexes/DateIndex',
['Products/PluginIndexes/DateIndex/README.txt']],
['Products/PluginIndexes/DateIndex/dtml',
['Products/PluginIndexes/DateIndex/dtml/*']],
['Products/PluginIndexes/DateRangeIndex',
['Products/PluginIndexes/DateRangeIndex/README.txt']],
['Products/PluginIndexes/DateRangeIndex/dtml',
['Products/PluginIndexes/DateRangeIndex/dtml/*']],
['Products/PluginIndexes/FieldIndex/dtml',
['Products/PluginIndexes/FieldIndex/dtml/*']],
['Products/PluginIndexes/FieldIndex/help',
['Products/PluginIndexes/FieldIndex/help/*']],
['Products/PluginIndexes/KeywordIndex/dtml',
['Products/PluginIndexes/KeywordIndex/dtml/*']],
['Products/PluginIndexes/KeywordIndex/help',
['Products/PluginIndexes/KeywordIndex/help/*']],
['Products/PluginIndexes/PathIndex',
['Products/PluginIndexes/PathIndex/*.txt']],
['Products/PluginIndexes/PathIndex/dtml',
['Products/PluginIndexes/PathIndex/dtml/*']],
['Products/PluginIndexes/PathIndex/help',
['Products/PluginIndexes/PathIndex/help/*']],
['Products/PluginIndexes/TextIndex/dtml',
['Products/PluginIndexes/TextIndex/dtml/*']],
['Products/PluginIndexes/TextIndex/help',
['Products/PluginIndexes/TextIndex/help/*']],
['Products/PluginIndexes/TopicIndex',
['Products/PluginIndexes/TopicIndex/*.txt']],
['Products/PluginIndexes/TopicIndex/dtml',
['Products/PluginIndexes/TopicIndex/dtml/*']],
['Products/PluginIndexes/TopicIndex/help',
['Products/PluginIndexes/TopicIndex/help/*']],
['Products/PluginIndexes/help',
['Products/PluginIndexes/help/*']],
['Products/PluginIndexes/www',
['Products/PluginIndexes/www/*']]],
ext_modules=[
Extension(name='Products.PluginIndexes.TextIndex.Splitter.ZopeSplitter.ZopeSplitter',
sources=['Products/PluginIndexes/TextIndex/Splitter/ZopeSplitter/src/ZopeSplitter.c']),
Extension(name='Products.PluginIndexes.TextIndex.Splitter.ISO_8859_1_Splitter.ISO_8859_1_Splitter',
sources=['Products/PluginIndexes/TextIndex/Splitter/ISO_8859_1_Splitter/src/ISO_8859_1_Splitter.c']),
Extension(name='Products.PluginIndexes.TextIndex.Splitter.UnicodeSplitter.UnicodeSplitter',
sources=['Products/PluginIndexes/TextIndex/Splitter/UnicodeSplitter/src/UnicodeSplitter.c'])],
)
# PythonScripts product
setup(
name='PythonScripts',
author=AUTHOR,
packages=['Products.PythonScripts', 'Products.PythonScripts.tests'],
data_files=[['Products/PythonScripts', ['Products/PythonScripts/*.txt']],
['Products/PythonScripts/Extensions',
['Products/PythonScripts/Extensions/*.py']],
['Products/PythonScripts/help',
['Products/PythonScripts/help/*.py',
'Products/PythonScripts/help/*.stx']],
['Products/PythonScripts/tests/tscripts',
['Products/PythonScripts/tests/tscripts/*']],
['Products/PythonScripts/www',
['Products/PythonScripts/www/*']]],
)
# Sessions product
setup(
name='Sessions',
author=AUTHOR,
packages=['Products.Sessions', 'Products.Sessions.tests'],
data_files=[['Products/Sessions/help', ['Products/Sessions/help/*.py',
'Products/Sessions/help/*.stx']],
['Products/Sessions/dtml', ['Products/Sessions/dtml/*']],
['Products/Sessions/stresstests',
['Products/Sessions/stresstests/*.py']],
['Products/Sessions/www', ['Products/Sessions/www/*']]],
)
# SiteAccess product
setup(
name='SiteAccess',
author=AUTHOR,
packages=['Products.SiteAccess'],
data_files=[['Products/SiteAccess', ['Products/SiteAccess/*.txt']],
['Products/SiteAccess/doc', ['Products/SiteAccess/doc/*']],
['Products/SiteAccess/Extensions',
['Products/SiteAccess/Extensions/*.py']],
['Products/SiteAccess/help', ['Products/SiteAccess/help/*']],
['Products/SiteAccess/www', ['Products/SiteAccess/www/*']]],
)
# SiteErrorLog product
setup(
name='SiteErrorLog',
author=AUTHOR,
packages=['Products.SiteErrorLog'],
data_files=[['Products/SiteErrorLog/www',
['Products/SiteErrorLog/www/*']]],
)
# StandardCacheManagers product
setup(
name='StandardCacheManagers',
author=AUTHOR,
packages=['Products.StandardCacheManagers'],
data_files=[['Products/StandardCacheManagers',
['Products/StandardCacheManagers/*.txt',
'Products/StandardCacheManagers/*.gif']],
['Products/StandardCacheManagers/dtml',
['Products/StandardCacheManagers/dtml/*']],
['Products/StandardCacheManagers/help',
['Products/StandardCacheManagers/help/*']]],
)
# TemporaryFolder product
setup(
name='TemporaryFolder',
author=AUTHOR,
packages=['Products.TemporaryFolder', 'Products.TemporaryFolder.tests'],
data_files=[['Products/TemporaryFolder/dtml',
['Products/TemporaryFolder/dtml/*']],
['Products/TemporaryFolder/help',
['Products/TemporaryFolder/help/*']],
['Products/TemporaryFolder/www',
['Products/TemporaryFolder/www/*']]],
)
# Transience product
setup(
name='Transience',
author=AUTHOR,
packages=['Products.Transience', 'Products.Transience.tests'],
data_files=[['Products/Transience', ['Products/Transience/*.stx']],
['Products/Transience/dtml', ['Products/Transience/dtml/*']],
['Products/Transience/help',
['Products/Transience/help/*.py',
'Products/Transience/help/*.stx']],
['Products/Transience/www', ['Products/Transience/www/*']]],
)
# ZCatalog product
setup(
name='ZCatalog',
author=AUTHOR,
packages=['Products.ZCatalog', 'Products.ZCatalog.tests'],
data_files=[['Products/ZCatalog',
['Products/ZCatalog/*.gif', 'Products/ZCatalog/*.txt']],
['Products/ZCatalog/regressiontests',
['Products/ZCatalog/regressiontests/*.py']],
['Products/ZCatalog/dtml', ['Products/ZCatalog/dtml/*']],
['Products/ZCatalog/help', ['Products/ZCatalog/help/*.stx',
'Products/ZCatalog/help/*.py']],
['Products/ZCatalog/www', ['Products/ZCatalog/www/*']]],
)
# ZCTextIndex product
setup(
name='ZCTextIndex',
author=AUTHOR,
ext_modules=[
Extension(name='Products.ZCTextIndex.stopper',
sources=['Products/ZCTextIndex/stopper.c']),
Extension(name='Products.ZCTextIndex.okascore',
sources=['Products/ZCTextIndex/okascore.c'])],
packages=['Products.ZCTextIndex', 'Products.ZCTextIndex.tests'],
data_files=[['Products/ZCTextIndex', ['Products/ZCTextIndex/README.txt']],
['Products/ZCTextIndex/dtml', ['Products/ZCTextIndex/dtml/*']],
['Products/ZCTextIndex/help', ['Products/ZCTextIndex/help/*']],
['Products/ZCTextIndex/tests',
['Products/ZCTextIndex/tests/python.txt']],
['Products/ZCTextIndex/www', ['Products/ZCTextIndex/www/*']]],
)
# ZGadflyDA product
setup(
name='ZGadflyDA',
author=AUTHOR,
packages=['Products.ZGadflyDA', 'Products.ZGadflyDA.gadfly'],
data_files=[['Products/ZGadflyDA', ['Products/ZGadflyDA/*.txt']],
['Products/ZGadflyDA/dtml', ['Products/ZGadflyDA/dtml/*']],
['Products/ZGadflyDA/icons', ['Products/ZGadflyDA/icons/*']],
['Products/ZGadflyDA/gadfly',
['Products/ZGadflyDA/gadfly/COPYRIGHT',
'Products/ZGadflyDA/gadfly/sql.mar',
'Products/ZGadflyDA/gadfly/*.html']]],
)
# ZSQLMethods product
setup(
name='ZSQLMethods',
author=AUTHOR,
packages=['Products.ZSQLMethods'],
data_files=[['Products/ZSQLMethods', ['Products/ZSQLMethods/*.txt',
'Products/ZSQLMethods/*.gif']],
['Products/ZSQLMethods/dtml', ['Products/ZSQLMethods/dtml/*']],
['Products/ZSQLMethods/help',
['Products/ZSQLMethods/help/*.stx',
'Products/ZSQLMethods/help/*.py']]],
)
# ZopeTutorial product
setup(
name='ZopeTutorial',
author=AUTHOR,
packages=['Products.ZopeTutorial'],
data_files=[['Products/ZopeTutorial', ['Products/ZopeTutorial/*.txt',
'Products/ZopeTutorial/*.stx']],
['Products/ZopeTutorial/dtml',
['Products/ZopeTutorial/dtml/*']]],
)
# ZServer
setup(
name='ZServer',
author=AUTHOR,
packages=['ZServer', 'ZServer.PubCore', 'ZServer.tests', 'ZServer.medusa',
'ZServer.medusa.test',
'ZServer.medusa.thread'],
data_files=[['ZServer', ['ZServer/*.txt', 'ZServer/*.xml']],
['ZServer/medusa/dist', ['ZServer/medusa/dist/*']],
['ZServer/medusa/docs', ['ZServer/medusa/docs/*']],
['ZServer/medusa/test', ['ZServer/medusa/test/*.txt']]],
)
# Call distutils setup with all lib/python packages and modules, and
# flush setup_info. Wondering why we run py_modules separately? So am I.
# Distutils won't let us specify packages and py_modules in the same call.
distutils.core.setup(
name='Zope',
author=AUTHOR,
packages=setup_info.get('packages', []),
data_files=setup_info.get('data_files', []),
headers=setup_info.get('headers', []),
ext_modules=setup_info.get('ext_modules', []),
distclass=ZopeDistribution,
)
distutils.core.setup(
name='Zope',
author=AUTHOR,
py_modules=setup_info.get('py_modules', []),
scripts=setup_info.get('scripts', []),
distclass=ZopeDistribution,
)
# The rest of these modules live in the root of the source tree
os.chdir(ZOPE_ROOT)
def skel_visit(skel, dirname, names):
if "CVS" in names:
names.remove("CVS")
L = []
for name in names:
if os.path.isfile(os.path.join(dirname, name)):
L.append("%s/%s" % (dirname, name))
skel.append(("../../" + dirname, L))
installed_data_files = [
["../../doc", ['doc/*.txt']],
["../../doc/changenotes", ['doc/changenotes/*.stx']],
["../../import", ['import/*.zexp']],
# These may change in the future:
["../../utilities", ['utilities/README.txt',
'utilities/check_catalog.py',
'utilities/load_site.py',
'utilities/requestprofiler.py']],
]
os.path.walk("skel", skel_visit, installed_data_files)
distutils.core.setup(
name='Zope',
author=AUTHOR,
data_files=installed_data_files,
scripts=["bin/runzope.py", "bin/zopectl.py",
"bin/mkzeoinstance", "bin/mkzopeinstance"],
distclass=ZopeDistribution,
)
ZOPE_MAJOR_VERSION = '2.7'
ZOPE_MINOR_VERSION = '0'
ZOPE_BRANCH_NAME = '$Name$'[6:] or 'no-branch'
# always start prerelease branches with '0' to avoid upgrade
# issues in RPMs
VERSION_RELEASE_TAG = '0test'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment