Commit 8bca3154 authored by Hanno Schlichting's avatar Hanno Schlichting

Removed unmaintained build scripts for full Windows installers and ``configure...

Removed unmaintained build scripts for full Windows installers and ``configure / make`` type builds.
parent 4b2d9d7e
......@@ -11,6 +11,9 @@ Zope 2.12.4 (Unreleased)
Restructuring
+++++++++++++
- Removed unmaintained build scripts for full Windows installers and
``configure / make`` type builds.
- Updated copyright and license information to conform with repository policy.
- Factored out ZopeUndo package into a separate distribution.
......
# 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>>"
TMPDIR=/tmp
PREFIX=<<PREFIX>>
BASE_DIR=<<BASE_DIR>>
BUILD_BASE=<<BUILD_BASE>>
DISTUTILS_OPTS=<<DISTUTILS_OPTS>>
INSTALL_FLAGS=<<INSTALL_FLAGS>>
TESTOPTS=-v
BUILD_FLAGS=--build-base="${BUILD_BASE}" \
--build-lib="${BUILD_BASE}/build-lib" \
--build-scripts="${BUILD_BASE}/build-scripts"\
--build-temp="${BUILD_BASE}/build-temp"
RM=rm -f
RMRF=rm -rf
FIND=find
GREP=grep
XARGS=xargs
CD=cd
LN=ln -sfn
CP=cp
TAR=tar
MKDIR=mkdir -p
.PHONY : clean install instance untestinst testinst build unbuild
.PHONY : default
# default: The default step (invoked when make is called without a target)
default: build
@echo
@echo Zope built. Next, do \'make install\' \(or \'make inplace\',
@echo followed by \'make instance\' to run a Zope instance directly
@echo from the build directory\).
# build: Do whatever 'setup.py build' implies
build:
${PYTHON} "${BASE_DIR}/setup.py" \
${DISTUTILS_OPTS} build ${BUILD_FLAGS}
# unbuild: Remove the build directory (undo the make build step)
unbuild:
${RMRF} ${BUILD_BASE}
# install: Install a software home.
install: build version_txt
${PYTHON} "${BASE_DIR}/setup.py" ${DISTUTILS_OPTS} install \
--home="${PREFIX}" ${BUILD_FLAGS} ${INSTALL_FLAGS}
[ -f ${PREFIX}/bin/python ] || ${LN} ${PYTHON} ${PREFIX}/bin/python
@echo
@echo Zope binaries installed successfully.
@echo Now run \'${PREFIX}/bin/mkzopeinstance.py\'
# inplace: Install a software home into to the source directory.
#
# Note: We used to run 'build_ext -i' for 'inplace', but that was
# suboptimal because it had a tendency to try to rebuild all of the
# (possibly already-built) extensions that might be built during a
# previous 'make' step. built_ext doesn't understand '--build-base'
# and friends so we can't stop it from doing this easily. So instead,
# we rely on the stock install step and name the prefix as the current
# directory. This is a little less efficient than just building the
# extensions because it also compiles bytecode, but it's more intuitive and
# less expensive in the common case than letting distutils
# potentially rebuild the binaries when we've done that already.
inplace: PREFIX=${BASE_DIR}
inplace: install
# test: Do an inplace build and run the Zope test suite.
test: inplace
${PYTHON} "${BASE_DIR}/test.py" ${TESTOPTS}
# instance: Do an inplace build and create an instance home in the resulting
# software home.
instance: build
${PYTHON} "${BASE_DIR}/utilities/mkzopeinstance.py" ${MKZ_FLAGS}
# testinst: Perform an inplace build and create an instance home in the
# resulting software home without asking questions. Useful when
# performing automated testing.
testinst: MKZ_FLAGS=--user=admin:admin --dir="${BASE_DIR}"
testinst: instance
# uninstance: Remove the instance files made by testinstance (w/ prejudice)
uninstance:
${RMRF} "${BASE_DIR}/etc"
${RMRF} "${BASE_DIR}/import"
${RMRF} "${BASE_DIR}/log"
${RMRF} "${BASE_DIR}/var"
${RMRF} "${BASE_DIR}/Products"
# clean: Delete the build files and any binaries/bytecode files in
# the source directory for good measure.
clean: unbuild
${FIND} "${BASE_DIR}" \
-name '*.py[co]' -o -name '*.so' -o -name '*.o' | \
grep -vE "${BASE_DIR}/src|${BASE_DIR}/parts|${BASE_DIR}/eggs|${BASE_DIR}/develop" | \
${XARGS} ${RM}
${RM} "$(BASE_DIR)/lib/python/Zope2/version.txt"
${RMRF} build
# version_txt: create a version file in lib/python/version.txt
version_txt:
printf "Zope ${MAJOR_VERSION}.${MINOR_VERSION}-${RELEASE_TAG}" >\
"${BASE_DIR}/lib/python/Zope2/version.txt"
sdist: clean sdist_tgz
# sdist_tgz: Create a tgz archive file as a source distribution.
#
sdist_tgz: version_txt
${FIND} . -type f -exec chmod a+r {} \;
${FIND} . -type d -exec chmod a+rx {} \;
${MKDIR} ${TMPDIR}
${CD} ${TMPDIR} && ${LN} ${BASE_DIR} ${PACKAGE_NAME} && \
${TAR} czfh ${BASE_DIR}/${PACKAGE_NAME}.tgz \
--exclude=${PACKAGE_NAME}.tgz\
--exclude=.svn\
--exclude=${PACKAGE_NAME}/.installed.cfg \
--exclude=.DS_Store \
--exclude=${PACKAGE_NAME}/bin \
--exclude=${PACKAGE_NAME}/etc \
--exclude=${PACKAGE_NAME}/import \
--exclude=${PACKAGE_NAME}/log \
--exclude=${PACKAGE_NAME}/var \
--exclude=${PACKAGE_NAME}/Products \
--exclude=${PACKAGE_NAME}/makefile \
--exclude=${PACKAGE_NAME}/build-base \
--exclude=${PACKAGE_NAME}/bootstrap \
--exclude=${PACKAGE_NAME}/develop-eggs \
--exclude=${PACKAGE_NAME}/develop \
--exclude=${PACKAGE_NAME}/eggs \
--exclude=${PACKAGE_NAME}/include \
--exclude=${PACKAGE_NAME}/parts \
--exclude=${PACKAGE_NAME}/src \
--exclude=${PACKAGE_NAME}/*.cfg \
--exclude=*~ \
--exclude=.#* ${PACKAGE_NAME}
${RMRF} ${TMPDIR}/${PACKAGE_NAME}
# clobber: Make the source tree 'pristine' again.
clobber: clean uninstance
# distclean: Make the source tree *really* 'pristine' again.
distclean: clobber
${RM} makefile Makefile
${RMRF} build-base
# Zope2 build and install Makefile for win32 (nmake-style).
# 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>>
ZOPEVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG)
PACKAGE_NAME=$(NAME)-$(ZOPEVERSION)
PYTHON="<<PYTHON>>"
TMPDIR="<<TMP_DIR>>"
PREFIX="<<PREFIX>>"
BASE_DIR=<<BASE_DIR>>
BUILD_BASE=<<BUILD_BASE>>
DISTUTILS_OPTS=<<DISTUTILS_OPTS>>
INSTALL_FLAGS=<<INSTALL_FLAGS>>
TESTOPTS=-v
BUILD_FLAGS=--build-base="$(BUILD_BASE)" \
--build-lib="$(BUILD_BASE)\build-lib" \
--build-scripts="$(BUILD_BASE)\build-scripts" \
--build-temp="$(BUILD_BASE)\build-temp"
RM=del /f /q
!IF ("$(OS)" == "Windows_NT")
RMRF=rmdir /s /q
!ELSE
RMRF=deltree /y
!ENDIF
CD=cd
XCOPY=xcopy /i /s /e /y
COPY=copy
MOVE=move
EXISTS=IF EXIST
NOT_EXISTS=IF NOT EXIST
default: build
# default: The default step (invoked when make is called without a target)
@ echo.
@ echo Zope built. Next, do 'nmake install'.
@ echo.
.PHONY : clean install instance untestinst testinst build unbuild
.PHONY : default
# build: Do whatever 'setup.py build' implies
build:
$(PYTHON) "$(BASE_DIR)\setup.py" \
$(DISTUTILS_OPTS) build $(BUILD_FLAGS)
# unbuild: Remove the build directory (undo the make build step)
unbuild:
-$(EXISTS) $(BUILD_BASE) $(RMRF) $(BUILD_BASE)
# install: Install a software home.
install: build version_txt
$(PYTHON) "$(BASE_DIR)\setup.py" $(DISTUTILS_OPTS) install \
--prefix="$(PREFIX)" $(BUILD_FLAGS) $(INSTALL_FLAGS)
@ echo.
@ echo Zope binaries installed successfully.
@ echo Now run '$(PYTHON) $(PREFIX)\bin\mkzopeinstance.py'
$(BASE_DIR)/inst/tmp/$(PACKAGE_NAME).tgz:
$(MAKE) sdist
$(NOT_EXISTS) inst\tmp $(MKDIR) inst\tmp
$(MOVE) $(PACKAGE_NAME).tgz inst\tmp
# installer: Create the Zope Installer.
installer: $(BASE_DIR)/inst/tmp/$(PACKAGE_NAME).tgz
$(CD) inst && sh Winbuilders/buildout zope ZOPEVERSION=$(ZOPEVERSION)
# inplace: Do an in-place build
inplace:
$(MAKE) install PREFIX="$(BASE_DIR)"
# test: Do an inplace build and run the Zope test suite.
test: inplace
$(PYTHON) "$(BASE_DIR)\test.py" $(TESTOPTS)
# instance: Do an inplace build and create an instance home in the resulting
# software home.
instance: build
$(PYTHON) "$(BASE_DIR)\utilities\mkzopeinstance.py" $(MKZ_FLAGS)
# testinst: Perform an inplace build and create an instance home in the
# resulting software home without asking questions. Useful when
# performing automated testing.
testinst:
$(MAKE) instance MKZ_FLAGS=--user=admin:admin --dir="$(BASE_DIR)"
# uninstance: Remove the instance files made by testinstance (w/ prejudice)
uninstance:
$(EXISTS) "$(BASE_DIR)/bin" $(RMRF) "$(BASE_DIR)/bin"
$(EXISTS) "$(BASE_DIR)/etc" $(RMRF) "$(BASE_DIR)/etc"
$(EXISTS) "$(BASE_DIR)/import" $(RMRF) "$(BASE_DIR)/import"
$(EXISTS) "$(BASE_DIR)/log" $(RMRF) "$(BASE_DIR)/log"
$(EXISTS) "$(BASE_DIR)/var" $(RMRF) "$(BASE_DIR)/var"
$(EXISTS) "$(BASE_DIR)/Products" $(RMRF) "$(BASE_DIR)/Products"
# clean: Delete the build files and any binaries/bytecode files in
# the source directory for good measure.
clean:
$(CD) "$(BASE_DIR)"
-$(RM) /s *.pyc *.pyo *.dll *.o *.obj *.pyd
-$(EXISTS) "$(BASE_DIR)\lib\python\Zope2\version.txt" $(RM) "$(BASE_DIR)\lib\python\Zope2\version.txt"
-$(EXISTS) build $(RMRF) build
# version_txt: create a version file in lib/python/Zope2/version.txt
version_txt:
echo Zope $(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG) > \
"$(BASE_DIR)/lib/python/Zope2/version.txt"
# sdist: Create a source distribution file (implies clobber).
#
sdist: clobber sdist_tgz
# sdist_tgz: Create a tgz archive file as a source distribution.
#
sdist_tgz: version_txt
$(PYTHON) $(BASE_DIR)\inst\tar.py $(BASE_DIR)\$(PACKAGE_NAME).tgz $(BASE_DIR)
# clobber: Make the source tree 'pristine' again.
clobber: clean uninstance
# distclean: Make the source tree *really* 'pristine' again.
distclean: clobber
$(EXISTS) makefile $(RM) makefile
$(EXISTS) Makefile $(RM) Makefile
$(EXISTS) build-base $(RMRF) build-base
Manifest and description of included files
|-- Makefile.python: the Makefile used to create a Python binary from source
|-- Makefile.zeo: the Makefile used to create a ZEO installer package
|-- Makefile.zope: the Makefile used to create a Zope installer package
|-- README.txt
|-- bin
| |-- compilezpy.py: compiles a tree of Python scripts into .pyc bytecode
| |-- decompilezpy.py: deletes a tree full of .pyc bytecode files
| |-- escape.sh: utility script that converts backslashes between unix & win
| |-- fixreg.py: utility to manage Zope Corporation Win registry entries
| |-- makezope.bat: utility script to build Zope, getting around NMAKE "bug"
| `-- runzeo.bat: script which starts a ZEO instance
|-- buildout: the main script used to build Zope and/or ZEO installers
|-- doc
| `-- ZC_PY_DIST_README.txt: readme for the Zope Corp. Python distro
|-- etc
| |-- README.html: custom template used for Zope Quick Start page.
| |-- sitecustomize.py: adds Zope dirs to sys.path automagically in distro
| |-- zeo.iss.in: the Innosetup file to create a ZEO installer
| |-- zlogo_left.bmp: used by Innosetup
| |-- zlogo_top.bmp: used by Innosetup
| `-- zope.iss.in: the Innosetup file to create a Zope installer
|-- mk
| |-- common.mk: common make routines
| |-- python.mk: routines for creating a Python distro
| |-- zeo.mk: routines for creating a ZEO server distro
| `-- zope.mk: routines for creating a Zope distro
`-- zeo_addons: a custom INSTANCE_HOME for ZEO
|-- skel
| |-- README.txt
| |-- bin
| | |-- runzeo.bat.in
| | `-- zeoservice.py.in
| |-- etc
| | |-- zeo.conf.in
| | `-- zeoctl.conf.in
| |-- log
| | `-- README.txt
| `-- var
| `-- README.txt
`-- utilities
|-- compilezpy.py
|-- copyskel.py
|-- decompilezpy.py
`-- mkzeoinstance.py
# Zope/ZEO build and install Makefile for Python (gnumake-style).
# Puts binaries into build/bin
# See README.txt for system requirements.
# See python.mk for the input files required in tmp/.
# do "make -f <makefile_name> build"
# then "make -f <makefile_name" install
default: install
build: build_python
unbuild:
$(RMRF) "$(BUILD_DIR)"
install: build install_python
# XXX test_python doesn't exist: there's not enough stuff in the
# build/ directory to run the Python tests successfully.
test: test_python
clean: clean_python clean_libs unbuild
clobber: clean
$(RMRF) src
include mk/common.mk
include mk/python.mk
# Justs repackages the Spread binaries.
# Puts binaries into build/bin.
# See README.txt for system requirements.
# See spread.mk for the input files required in tmp/.
default: install_spread
build: build_spread
install: install_spread
include mk/common.mk
include mk/spread.mk
# Zope2 build and install Makefile for win32 (gnumake-style).
# Creates an installable executable for the Python Spread wrapper module.
# See README.txt for system requirements.
# See spreadwrapper.mk for the input files required in tmp/.
default: install
build: build_spreadwrapper
install: install_spreadwrapper
include mk/common.mk
include mk/spreadwrapper.mk
# Zope2 build and install Makefile for win32 (gnumake-style).
# Creates an installable executable of ZEO/ZODB3.
# Use a Win2k/XP machine with Cygwin, VC++, and InnoSetup4
# Install Inno Setup 4 into Program Files\Inno Setup 4
# also obtain and situate the following supporting files before
# attempting to run the makefile:
#
# obtain the source distribution of ZODB 3.X.X and put the tar.gz file
# in tmp\ZODB3-3.2.tar.gz
# see python.mk for files needed to build Python
# To produce the executable:
# do "make -f <makefile_name> build"
# then "make -f <makefile_name" install
# The resulting executable will show up in the "build" subdirectory
# as "ZEO-3.X.X-win32.exe".
# include common subroutines
default: install
build: build_python
unbuild:
$(RMRF) "$(BUILD_DIR)"
install: build install_python install_zeo
test: test_python test_zeo
clean: clean_python clean_zeo clean_libs unbuild
clobber: clean
$(RMRF) src
include mk/common.mk
include mk/python.mk
include mk/zeo.mk
# Zope2 build and install Makefile for win32 (gnumake-style).
# Creates an installable executable of Zope 2.
# Use a Win2k/XP machine with Cygwin, VC++, and InnoSetup4
# Install Inno Setup 4 into Program Files\Inno Setup 4
# also obtain and situate the following supporting files before
# attempting to run the makefile:
#
# obtain the source distribution of Zope 2.7.X and put the tar.gz file
# in tmp\Zope-2.7.X.tar.gz
# see python.mk for files needed to build Python
# To produce the executable:
# do "make -f <makefile_name> build"
# then "make -f <makefile_name" install
# The resulting executable will show up in the "build" subdirectory
# as "Zope-2.X.X-X-win32.exe".
# include common subroutines
default: install
build: build_python
unbuild:
$(RMRF) "$(BUILD_DIR)"
install: build install_python install_zope
test: test_python test_zope
clean: clean_python clean_zope clean_libs unbuild
clobber: clean
$(RMRF) src
include mk/common.mk
include mk/python.mk
include mk/zope.mk
Quick instructions:
The buildout has been tested under Windows 2K and XP Pro SP2.
Setup Environment
------------------
Install Python 2.4.3 (or whatever is most current) by running its native
Windows installer from python.org.
Note: Python 2.4 switched from using a Wise installer to using a
Microsoft .msi installer, and the latter is harder to work with. The
buildout used to extract Python source and binaries (.exe, .pyd, .dll)
from the Wise installer (which could be treated much like a zip file).
Now the Python installer isn't used at all. Instead, the Python
source is taken from the Python tarball release, and the binaries are
copied from your installed Python.
Install Cygwin from cygwin.org (the default installation should give
you everything you need).
Install Microsoft Visual C++ 7.1 (aka Visual Studio .NET 2003). This is
needed to compile Zope's Python C extensions compatible with Python 2.4
(and 2.5, when that's released).
Install InnoSetup 5.1.5 (or later) from www.jrsoftware.org, into its
default location. Inno 4.x (or earlier) cannot work: Inno 5 introduced a
vastly simpler way to create the custom dialog pages we want.
'svn switch' to, or check out, the Zope tag for which an installer is to be
built.
Within a Zope checkout, the parent directory of this package is inst. Make
a "tmp" directory, inst/tmp. Place the necessary pre-requisites in the tmp
directory. At the time of this writing, these are:
- Python-2.4.3.tgz
- pywin32-208.win32-py2.4.exe
- Zope-2.9.3.tgz
As time marches on, these version numbers will obviously change. See/edit
mk/python.mk and mk/zope.mk for the exact versions required.
You also need to install the same Windows Python that Zope will repackage.
There doesn't appear to be a sane way to extract binaries (.exe, .pyd,
.dll, .lib) from an .msi installer, and building Python from source is a long
& messy process on Windows. So python.mk just copies them from an installed
Python instead. Cautions:
- If you didn't accept the Python installer's default directory, or if
you did but it's on a different drive, you'll need to change
WIN_PYINSTALLEDDIR in python.mk.
- The main Python DLL must live in WIN_PYINSTALLEDDIR too. Depending on
how you installed Python, that may be sitting in some Windows system
directory instead; if so, make a copy in the root of your Python
installation.
Places you may want to hunt for python24.dll:
C:\Program Files
C:\Windows\System32
Place you most likely want to copy it to:
C:\Python24
Building
--------
Launch a Cygwin bash shell, and from the parent directory (inst/) type:
WinBuilders/buildout <type>
where type is one of "zope", "python", or "zeo". Alternatively, you can
avoid the bash shell completely, and from a Windows command prompt type:
bash WinBuilders/buildout <type>
Everything should work!
* For 'zope', the buildout populates the "build" directory with a Windows
executable installer.
* For python, the buildout populates the "build" directory with a Python
laid out for Zope and/or ZEO. [Tim isn't sure this target has ever
been tested/used.]
* For 'zeo', the buildout populates the "build" directory with a Windows
executable installer. [Tim isn't sure this target has ever been
tested/used.]
An 'inst\src' directory is also created. The makefiles don't even pretend to
do a good job of keeping track of dependencies; best practice is to blow away
the 'build' and 'src' directories between runs. Note that the 'tmp'
directory should _not_ be deleted -- it's purely an input to this process.
If the build fails:
If the Windows drive you are working on is not C: (or Inno isn't installed
there!), try executing the following:
WinBuilders/buildout <type> CYGROOT=/cygdrive/{your_drive_letter}
If you see errors relating to MSVC not being installed, or the build process
failing to find MSVC, it may be necessary to bring up the MSVC gui
at least once (MSDev doesn't finish writing all the registry keys it should
until the GUI is first launched). If may also be necessary to run VCVARS.bat
to set up the VC++ environment (but generally is not.) See below for Win98SE.
If you see any make errors with references to any of the files required
in tmp/ (see 'Setup Environment' above), it's because a later version is
now required, or the files you've downloaded are not in 'tmp'.
Testing Zope
------------
XXX This doesn't work right starting with Zope 2.9: it's clumsier than it
XXX should be, and the functional tests don't even try to run (just the
XXX unit tests).
XXX Someone who understands how Zope3 testing from a zpkgtools-tarball build
XXX was made to work again may be able to help here.
The test suite can be run from inst\build\, after building the installer.
- Open a native (not Cygwin) DOS box. We want to test with the Python the
Zope installer includes, in an all-native environment, to match what
the installer-installed code will do as closely as possible.
- cd inst\build
- Copy log.ini from the root of the Zope _checkout_ -- it's not included
in the tarball::
copy ..\..\log.ini .
Copying log.ini isn't necessary for the tests to pass, but if you don't
do it a great many spurious log messages will be displayed on the
console, some of which "look like" errors (some of the tests deliberately
provoke errors).
- Copy test.py from the unpacked tarball::
copy ..\src\$(ZOPE_VERSION)\test.py .
- Enter::
bin\python test.py -vv -m "!^zope[.]app[.]" --all
or whatever variation you like best. All tests should pass.
Note that zope.app tests should be excluded because not all of them _can_
pass (this isn't "a Windows thing", it's a temporary all-platform wart
due to missing bits from Zope3).
Also run the Windows installer, and play with the Zope it installs.
All platform notes
------------------
- Depending on your MSVC installation options, you have to run vcvars32.bat
to set up envars for MSVC. Running that from a bash shell doesn't have any
effect on the Cygwin PATH. This works:
+ Open a native DOS box.
+ Run vcvars32.bat.
+ Start a bash shell from the same box (== run cygwin.bat, found in the
root of your Cygwin installation -- the same thing the Cygwin shell
desktop shortcut resolves to, so you can get the exact path by looking
at the icon's Properties).
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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 compileall, os, sys
class Shutup:
def write(*args): pass # :)
class NoteErr:
wrote = 0
def write(self, *args):
self.wrote = 1
apply(stderr.write, args)
def compile_non_test(dir):
"""Byte-compile all modules except those in test directories."""
success = compileall.compile_dir(dir, maxlevels=0)
try:
names = os.listdir(dir)
except os.error:
print "Can't list", dir
names = []
names.sort()
for name in names:
fullname = os.path.join(dir, name)
if (name != os.curdir and name != os.pardir and
os.path.isdir(fullname) and not os.path.islink(fullname) and
name != 'test' and name != 'tests' and name != 'skins'):
success = success and compile_non_test(fullname)
return success
print
print '-'*78
print 'Compiling python modules'
stdout = sys.stdout
stderr = sys.stderr
try:
try:
success = 0
sys.stdout = Shutup()
sys.stderr = NoteErr()
success = compile_non_test(os.getcwd())
finally:
success = success and not sys.stderr.wrote
sys.stdout = stdout
sys.stderr = stderr
except:
success = 0
import traceback
traceback.print_exc()
if not success:
print
print '!' * 78
print 'There were errors during Python module compilation.'
print '!' * 78
print
sys.exit(1)
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
def main(dirname):
os.path.walk(dirname, rmpycs, None)
def rmpycs(arg, dirname, names):
for name in names:
path = os.path.join(dirname, name)
if ( name.endswith('.pyc') or name.endswith('.pyo') and
os.path.isfile(path) ):
os.unlink(path)
if __name__ == '__main__':
main(sys.argv[1])
echo $1 | sed 's@\\@\\\\\\\\@g'
""" Fix up registry entries on Zope uninstall """
from _winreg import *
import sys
def manageZopeRegEntries(uninstalling):
""" Called at uninstall time from innosetup installer to
manage the 'current' and 'previous' Zope versions. This is
just a convenience to make the Pascal coding in innosetup a little
less baroque """
prefix = 'Software\\Zope Corporation'
try:
zope = openKeyAllAccess(HKEY_LOCAL_MACHINE, '%s\\Zope\\' % prefix)
except EnvironmentError:
# this should never happen (the key is created by ISS)
return
try:
current = QueryValueEx(zope, 'CurrentVersion')[0]
except WindowsError:
current = uninstalling
try:
previous = QueryValueEx(zope, 'PreviousVersion')[0]
except WindowsError:
previous = uninstalling
if current != uninstalling:
# someone installed on top of us, punt
CloseKey(zope)
return
# make the previous known version into the current version if it still
# exists
try:
old = openKeyAllAccess(zope, previous)
except (WindowsError, EnvironmentError):
pass
else:
CloseKey(old)
SetValueEx(zope, 'CurrentVersion', None, REG_SZ, previous)
recurseDelete(HKEY_LOCAL_MACHINE, '%s\\Zope\\%s' % (prefix, uninstalling))
recurseDelete(HKEY_LOCAL_MACHINE, '%s\\Zope\\' % prefix)
recurseDelete(HKEY_LOCAL_MACHINE, prefix)
def openKeyAllAccess(key, subkey):
return OpenKey(key, subkey, 0, KEY_ALL_ACCESS)
def recurseDelete(key, subkey):
""" Delete all keys in subkey that are empty, recursively """
names = filter(None, subkey.split('\\'))
done = []
keys = []
while names:
name = names.pop(0)
done.append(name)
keyname = '\\'.join(done)
thiskey = openKeyAllAccess(key, keyname)
keys.append(thiskey)
try:
EnumKey(thiskey, 0)
except:
# no subkeys, ok to delete
DeleteKey(key, keyname)
for openkey in keys:
CloseKey(openkey)
if __name__ == '__main__':
manageZopeRegEntries(sys.argv[1])
cd %1%
set MAKEFLAGS=
nmake build
nmake install
@set PYTHON=C:\Program Files\Zope-2.7.0-b1+\bin\python.exe
@set ZOPE_HOME=C:\Program Files\Zope-2.7.0-b1+\lib\python
@set INSTANCE_HOME=C:\ZEO-Instance
@set CONFIG_FILE=%INSTANCE_HOME%\etc\zeo.conf
@set PYTHONPATH=%ZOPE_HOME%
@set ZEO_RUN=%ZOPE_HOME%\ZEO\runzeo.py
"%PYTHON%" "%ZEO_RUN%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5
#! /bin/sh
#
# buildout <server_type> [<make_args>]*
#
# <server_type> should be one of 'squid', 'zope', or 'zeo' (or some
# other server instance for whom we have a specific makefile)
#
# <makefile_args> are additional arguments to pass to make, e.g.
# 'compile', 'install', etc.
#
reldir=`dirname $0`
reldir=`realpath $reldir`
server_type=$1
shift
if [ -n "$PYTHONHOME" -o -n "$PYTHONPATH" ]; then
echo "** Python build is likely to malfunction if either of" 1>&2
echo "** PYTHONHOME ('$PYTHONHOME') or PYTHONPATH ('$PYTHONPATH')" 1>&2
echo "** is set - please unset them before doing the buildout." 1>&2
exit 1
fi
if [ -f $reldir/Makefile.$server_type ]; then
/usr/bin/make -f $reldir/Makefile.$server_type \
-I $reldir MAKEFILEDIR=$reldir $@
else
echo "buildout <server_type> [make_args]*"
fi
The version of Python shipped in this package has been compiled for
win32 using Microsoft's Visual C++ 6.0. There are differences between
the Win32 Python version shipped with Zope and ZEO (the "ZC" version)
and the version available from the Python.org website:
- The ZC version does not write the same registry entries as the
Python.org distribution.
- The ZC version includes Mark Hammond's win32all package, although the
package structure is lost, and whenever there's more than one file
with the same name in win32all only one of them gets included here.
This ought to be fixed, but the uses Zope makes of win32all appear
not to care about the ways in which the win32all installation is
flawed.
- The Doc, Tools and Script directories aren't installed.
- Tcl/Tk is not included.
- Python's Lib/test directory doesn't contain enough to run the Python
tests successfully (the expected-output subdirectory isn't installed,
and various test-input data files aren't installed -- only .py files
are installed).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Zope Windows Binary Post-Installation QuickStart</title>
</head>
<body bgcolor="#ffffff" link="#000099" alink="#000099" vlink="#000099"
style="font-family: Arial, Helvetica">
<p>
Welcome to <strong>Zope</strong>, a high-performance object-oriented
platform for building dynamic Web applications. Here are some quick
pointers to get you started:
</p>
<ul>
<li>
<p>
If you've launched your Zope instance, and you'd like to get started right
away, you can go directly to the <a href="http://localhost:8080/manage"
target="_new">Zope Management Interface</a>. Use the username
"admin" and the password you specified during installation process
to log in. Please be patient as it may take a few moments for your Zope
instance to start before you can connect to it successfully.
</p>
<li>
<p>
If you've not started your Zope instance, you can do so by choosing the
"Run Zope" command from the Zope program group in your Start Menu. If you
installed Zope as a Windows 'service' (NT/2000/XP only), you may use the
Control Panel --> Administrative Tools --> Services applet to start
your Zope instance as well. The service will be named "Zope instance at
&lt;instance home directory name&gt;".
</p>
</li>
<li>
<p>
If you've not yet created a Zope instance, perform the following steps to
do so:
</p>
<ol>
<li>
Visit a console window (type "cmd" (NT/2000/XP) or "command" (95/98/ME) in the Run box from the Start Menu).
</li>
<li>
Change to the "bin" directory directory of your Zope software home using
the "cd" command, e.g. "cd c:\Program Files\Zope-2.7\bin".
</li>
<li>
Type "python.exe mkzopeinstance.py"
</li>
<li>
Follow the instructions provided by 'mkzopeinstance.py'.
</li>
</ol>
<p>
To start the resulting instance, visit the directory you specified during your interaction with 'mkzopeinstance.py' and type "bin\runzope.bat".
</p>
</li>
<li>
<p>
For the most complete "starter" documentation,
<a href="http://www.zope.org/Documentation/ZopeBook/" target="_new">Read The
Fine Manual</a>. This document guides you through the whole process of
learning Zope, from logging in for the first time to creating your own
web applications.
</p>
</li>
<li>
<p>
For further documentation, go to the main <a href="http://www.zope.org/Documentation/" target="_new">
Documentation Overview</a> on Zope.org. Here you will find pointers to
official and community contributed documentation.
</p>
</li>
<li>
<p>
To get personal assistance with Zope, look at the various <a
href="http://www.zope.org/Resources/MailingLists" target="_new">Mailing
Lists</a> about Zope. The Mailing Lists are where you can get
quick, accurate, friendly help from a large community of Zope
users from around the world.
</p>
</li>
<li>
<p>
If you wish, you can find out about <a href="http://www.zope.com/" target="_new">Zope
Corporation</a>, the publishers of Zope.
</p>
</li>
</ul>
</body>
</html>
""" Add Zope packages in Windows binary distro to sys.path automagically """
import sys
import os
try:
sp = __file__
except:
sp = None
if sp:
dn = os.path.dirname
swhome = os.path.join(dn(dn(dn(dn(sp)))), 'lib', 'python')
if os.path.exists(swhome):
sys.path.insert(0, swhome)
[Setup]
AppName=ZEO <<VERSION>>
AppVerName=ZEO <<VERSION>>
AppPublisher=Zope Corporation
AppPublisherURL=http://www.zope.org
AppSupportURL=http://www.zope.org
AppUpdatesURL=http://www.zope.org
DefaultDirName={pf}\ZEO-<<VERSION>>
DefaultGroupName=ZEO <<VERSION>>
OutputBaseFilename=ZEO-<<VERSION>>-win32
WizardImageFile=<<MAKEFILEDIR>>\etc\zlogo_left.bmp
WizardSmallImageFile=<<MAKEFILEDIR>>\etc\zlogo_top.bmp
SourceDir=.
OutputDir=.
[Components]
Name: main; Description: "Main ZEO files"; Types: full compact custom; Flags: fixed
Name: instance; Description: "ZEO 'instance home' files (required to run ZEO immediately)"; Types: full compact custom; ExtraDiskSpaceRequired: 1453056
[Tasks]
Name: service; Description: "Run your ZEO instance as a Windows service (start ZEO automatically at system startup)"; MinVersion: 4.0,4.0; Components: instance; Check: IsAdministrator
[Files]
; Main ZEO files
Source:"bin\*.*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs
Source:"doc\*.*"; DestDir: "{app}\doc"; Flags: ignoreversion recursesubdirs
Source:"lib\*.*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs
Source:"skel\*.*"; DestDir: "{app}\skel"; Flags: ignoreversion recursesubdirs
; these are required to be put into the bin directory for proper function of NT services
Source:"bin\Lib\site-packages\PythonService.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
Source:"bin\Lib\site-packages\PyWinTypes23.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
[Icons]
Name: "{group}\Run ZEO In Console"; Filename: "{code:GetDataDir}\bin\runzeo.bat"; Check: DoInstanceHome
Name: "{group}\Uninstall ZEO"; Filename: "{uninstallexe}";
Name: "{group}\Make ZEO Instance"; Filename: "{app}\bin\python.exe"; Parameters: """{app}\bin\mkzeoinstance.py"""
[Run]
Filename: "{app}\bin\pythonw.exe"; Parameters: """{app}\bin\compilezpy.py"" ""{app}"" "; Description: "Byte-compiling Python files"; StatusMsg: "Byte-compiling Python files..."
Filename:"{app}\bin\pythonw.exe"; Parameters: """{app}\bin\mkzeoinstance.py"" ""--dir={code:GetDataDir}"" "; Description: "Creating default instance"; StatusMsg: "Creating default instance..."; Check: DoInstanceHome
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zeoservice.py"" --startup auto install"; Check: DoService
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zeoservice.py"" start"; Description: "Launch ZEO"; Flags: nowait postinstall skipifsilent; Check: DoService
Filename: "{code:GetDataDir}\bin\runzeo.bat"; Description: "Launch ZEO"; Flags: nowait postinstall skipifsilent; Check: DontDoService
[UninstallRun]
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zeoservice.py"" stop"; Check: DoService
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zeoservice.py"" remove"; Check: DoService
Filename: "{app}\bin\pythonw.exe"; Parameters: """{app}\bin\decompilezpy.py"" ""{app}"""
[Code]
var
PasswordPrompts, PasswordValues : array of String;
PasswordChars : array of char;
DataDirValues: array of String;
Password : string;
DataDir : String;
function InitializeSetup(): Boolean;
begin
{ set up password data structures }
SetArrayLength(PasswordPrompts, 1);
PasswordPrompts[0] := 'Password:';
SetArrayLength(PasswordValues, 1);
PasswordValues[0] := '';
SetArrayLength(PasswordChars, 1);
PasswordChars[0] := '*';
Password := '';
{ set up data dir data structures }
SetArrayLength(DataDirValues, 1);
DataDir := '';
Result := True;
end;
function CollectInstanceDir(): Boolean;
var
Next: Boolean;
DirOk: Boolean;
begin
DirOk := True;
ScriptDlgPageSetSubCaption1('Select where ZEO instance files should be installed');
ScriptDlgPageSetSubCaption2('Select the folder to which you would like Setup to install ZEO "instance" files, then click Next.');
if DataDir = '' then DataDir:= 'C:\ZEO-Instance';
if DataDirValues[0] <> '' then DataDirValues[0]:= '';
{ Ask for a dir until the user has approved one or clicked Back or Cancel }
Next:= InputDir(DataDirValues[0], DataDir);
if Next and FileOrDirExists(DataDir) then DirOk := False;
while Next and not DirOk do begin
if DataDir = '' then begin
DirOk := False;
MsgBox(SetupMessage(msgInvalidPath), mbError, MB_OK);
end;
if FileOrDirExists(DataDir) then begin
DirOk := MsgBox('Directory Exists' #13#13 'The directory ' + DataDir + ' already exists. Would you like to create instance files in that directory anyway?', mbConfirmation, MB_YESNO) = idYes;
end;
if not DirOk then Next := InputDir(DataDirValues[0], DataDir);
end;
Result:=Next;
end;
function DoInstanceHome():Boolean;
var
S : String;
begin
S := WizardSelectedComponents(False);
Result := Pos('instance', S) <> 0;
end;
function DoService(): Boolean;
var
S : String;
begin
S := WizardSelectedTasks(False);
Result := Pos('service', S) <> 0;
end;
function DontDoService(): Boolean;
begin
Result := not DoService();
end;
function ScriptDlgPages(CurPage: Integer; BackClicked: Boolean): Boolean;
var
Next : Boolean;
CurSubPage : Integer;
begin
Next:=True;
if ( (not BackClicked and (CurPage = wpSelectTasks)) or (BackClicked and (CurPage = wpReady)) )
and DoInstanceHome() then begin
ScriptDlgPageOpen();
ScriptDlgPageSetCaption('Instance Setup');
Next:=CollectInstanceDir();
if not BackClicked then
Result := Next
else
Result := not Next;
ScriptDlgPageClose(not Result);
end;
Result:=Next;
end;
function NextButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, False);
end;
function BackButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, True);
end;
function GetPassword(Default: String): String;
begin
Result := Password;
end;
function GetDataDir(Default : String):String;
begin
Result := DataDir;
end; { GetInstanceDir }
function IsAdministrator(): Boolean;
begin
Result := IsAdminLoggedOn();
end;
[Setup]
AppName=Zope <<VERSION>>
AppVerName=Zope <<VERSION>>
AppPublisher=Zope Corporation
AppPublisherURL=http://www.zope.org
AppSupportURL=http://www.zope.org
AppUpdatesURL=http://www.zope.org
DefaultDirName={pf}\Zope-<<VERSION>>
DefaultGroupName=Zope <<VERSION>>
OutputBaseFilename=Zope-<<VERSION>>-win32
SolidCompression=yes
WizardImageFile=<<MAKEFILEDIR>>\etc\zlogo_left.bmp
WizardSmallImageFile=<<MAKEFILEDIR>>\etc\zlogo_top.bmp
; Starting w/ Inno 4.1.3, Inno decided to stretch the .bmp files in various
; ways. Hard to know why, but it looks terrible on my vanilla boxes.
; Luckily, 4.1.3 also added WizardImageStretch to turn that off.
WizardImageStretch=no
SourceDir=.
OutputDir=.
[Components]
Name: main; Description: "Main Zope files"; Types: full compact custom; Flags: fixed
Name: instance; Description: "Zope 'instance home' files (required to run Zope immediately)"; Types: full compact custom; ExtraDiskSpaceRequired: 1453056
[Tasks]
Name: service; Description: "Run your Zope instance as a Windows service (start Zope automatically at system startup)"; MinVersion: 4.0,4.0; Components: instance; Check: IsAdministrator
[Files]
; Main Zope files
Source: "<<MAKEFILEDIR>>\etc\README.html"; DestDir: "{app}"; Flags: ignoreversion
Source:"bin\*.*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs
Source:"doc\*.*"; DestDir: "{app}\doc"; Flags: ignoreversion recursesubdirs
Source:"lib\*.*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs
Source:"skel\*.*"; DestDir: "{app}\skel"; Flags: ignoreversion recursesubdirs
; these are required to be put into the bin directory for proper function of NT services
Source:"bin\Lib\site-packages\win32\PythonService.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
Source:"bin\Lib\site-packages\pywin32_system32\PyWinTypes24.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
Source:"bin\Lib\site-packages\pywin32_system32\PythonCOM24.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
; This is a helper module for manging registry entries at uninstall time
Source: "<<MAKEFILEDIR>>\bin\fixreg.py"; DestDir: "{app}\bin"; Flags: ignoreversion
[Icons]
Name: "{group}\Run Zope In Console"; Filename: "{code:GetDataDir}\bin\runzope.bat"; Check: DoInstanceHome
Name: "{group}\Uninstall Zope"; Filename: "{uninstallexe}";
Name: "{group}\Make Zope Instance"; Filename: "{app}\bin\python.exe"; Parameters: """{app}\bin\mkzopeinstance.py"""
[Run]
Filename: "{app}\bin\pythonw.exe"; Parameters: """{app}\bin\compilezpy.py"" ""{app}"" "; Description: "Byte-compiling Python files"; StatusMsg: "Byte-compiling Python files..."
Filename:"{app}\bin\pythonw.exe"; Parameters: """{app}\bin\mkzopeinstance.py"" --user=""admin:{code:GetPassword}"" --dir=""{code:GetDataDir}"" "; Description: "Creating default instance"; StatusMsg: "Creating default instance..."; Check: DoInstanceHome
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zopeservice.py"" --startup auto install"; Check: DoService
Filename: "{app}\README.html"; Flags: shellexec skipifdoesntexist postinstall skipifsilent; Description: "View 'QuickStart' document in a web browser"
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zopeservice.py"" start"; Description: "Launch Zope"; Flags: nowait postinstall skipifsilent; Check: DoService
Filename: "{code:GetDataDir}\bin\runzope.bat"; Description: "Launch Zope"; Flags: nowait postinstall skipifsilent; Check: DontDoService
[UninstallRun]
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zopeservice.py"" --wait=30 stop"; Check: DoService
Filename: "{app}\bin\pythonw.exe"; Parameters: """{code:GetDataDir}\bin\zopeservice.py"" remove"; Check: DoService
Filename: "{app}\bin\pythonw.exe"; Parameters: """{app}\bin\decompilezpy.py"" ""{app}"""
Filename: "{app}\bin\pythonw.exe"; Parameters: """{app}\bin\fixreg.py"" ""<<VERSION>>"""
[Registry]
Root: HKLM; Subkey: "Software\Zope Corporation\Zope"; ValueType: string; ValueName: "PreviousVersion"; ValueData: "{reg:HKLM\Software\Zope Corporation\Zope,CurrentVersion|}"
Root: HKLM; Subkey: "Software\Zope Corporation\Zope"; Flags: uninsdeletekeyifempty; ValueType: string; ValueName: "CurrentVersion"; ValueData: "<<VERSION>>"
Root: HKLM; Subkey: "Software\Zope Corporation\Zope\<<VERSION>>"; Flags: uninsdeletekey; ValueType: string; ValueName: "Home"; ValueData: "{app}"
Root: HKLM; Subkey: "Software\Zope Corporation\Zope\<<VERSION>>"; Flags: uninsdeletekey; ValueType: string; ValueName: "Python"; ValueData: "{app}\bin\python.exe"
Root: HKLM; Subkey: "Software\Zope Corporation\Zope\<<VERSION>>"; Flags: uninsdeletekey; ValueType: string; ValueName: "Pythonw"; ValueData: "{app}\bin\pythonw.exe"
[Code]
var
{ custom dialog pages }
{ for selecting an instance home directory }
InstanceDirPage: TInputDirWizardPage;
{ for specifying the password for the "admin" account }
AdminPwdPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin
{ The instance directory page follows the standard "select additional
tasks" page. }
InstanceDirPage := CreateInputDirPage(wpSelectTasks,
'Instance Setup',
'Select where Zope instance files should be installed',
'Select the folder to which you would like Setup to install ' +
'Zope "instance" files, then click Next.',
False,
'');
InstanceDirPage.Add('');
{ The admin password page follows our instance directory page. }
AdminPwdPage := CreateInputQueryPage(InstanceDirPage.ID,
'Instance Setup',
'Specify administrator password',
'The login name for your Zope administrator ' +
'account is "admin". When you first connect to the Zope ' +
'management interface, you will need to login using the ' +
'"admin" username and the password you specify below.');
AdminPwdPage.Add('Password:', True);
AdminPwdPage.Add('Confirm password:', True);
{ Set default values; use settings from last time when possible. }
InstanceDirPage.Values[0] := GetPreviousData('InstanceDir',
'C:\Zope-Instance');
AdminPwdPage.Values[0] := '';
AdminPwdPage.Values[1] := '';
end;
procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
{ Store settings so we can restore them next time. }
{ Note that we deliberately don't store the admin password across
runs! We want that to vanish when the installer finishes. }
SetPreviousData(PreviousDataKey, 'InstanceDir', InstanceDirPage.Values[0]);
end;
function DoInstanceHome(): Boolean;
var
S: String;
begin
S := WizardSelectedComponents(False);
Result := Pos('instance', S) <> 0;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
{ Skip pages that shouldn't be shown. }
if (PageID = InstanceDirPage.ID) or (PageID = AdminPwdPage.ID) then
Result := not DoInstanceHome()
else
Result := False;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
temp: String;
begin
{ Validate pages before allowing the user to proceed. }
Result := True; // innocent until proven guilty
if CurPageID = InstanceDirPage.ID then begin
temp := InstanceDirPage.Values[0];
if temp = '' then begin
Result := False;
MsgBox(SetupMessage(msgInvalidPath), mbError, MB_OK);
end
else if FileOrDirExists(temp) then begin
Result := MsgBox('Directory Exists' #13#13 'The directory ' +
temp + ' already exists. Would you like to create ' +
'instance files in that directory anyway?',
mbConfirmation, MB_YESNO) = idYes;
end
end
else if CurPageID = AdminPwdPage.ID then begin
temp := AdminPwdPage.Values[0];
if temp = '' then begin
Result := False;
MsgBox('You must enter an administrator password',
mbError, MB_OK);
end
else if temp <> AdminPwdPage.Values[1] then begin
Result := False;
MsgBox('Please try again -- the passwords don''t match',
mbError, MB_OK)
end
end
end;
function DoService(): Boolean;
var
S: String;
begin
S := WizardSelectedTasks(False);
Result := Pos('service', S) <> 0;
end;
function DontDoService(): Boolean;
begin
Result := not DoService();
end;
function GetPassword(Default: String): String;
begin
Result := AdminPwdPage.Values[0];
end;
function GetDataDir(Default: String):String;
begin
Result := InstanceDirPage.Values[0];
end;
function IsAdministrator(): Boolean;
begin
Result := IsAdminLoggedOn();
end;
# Use immediate assignment to avoid calling out to the shell a zillion times.
BASE_DIR := $(shell pwd)
WIN_BASE_DIR := $(shell cygpath -w $(BASE_DIR))
BUILD_DIR := $(BASE_DIR)/build
WIN_BUILD_DIR := $(shell cygpath -w $(BUILD_DIR))
SRC_DIR := $(BASE_DIR)/src
WIN_SRC_DIR := $(shell cygpath -w $(SRC_DIR))
TMP_DIR := $(BASE_DIR)/tmp
WIN_TMP_DIR := $(shell cygpath -w $(TMP_DIR))
WIN_MAKEFILEDIR := $(shell cygpath -w $(MAKEFILEDIR))
# Root of the Windows drive you're working on. The setting here is for
# the C: drive and using a default out-of-the-box Cygwin.
CYGROOT=/cygdrive/c
RM=rm -f
RMRF=rm -rf
CD=cd
# xcopy args:
# /i = if dest doesn't exist and source has more than one file, assume
# dest shoud be a directory
# /y = don't prompt about overwriting dest if it exists -- just do it
# /s = recurse, copying non-empty subdirectories too
# CAUTION: don't use /e unless you have to! /e copies empty subdirectories
# too, but has another truly bizarre behavior: if you use xcopy to copy
# a single file, and use /e, it creates empty subdirectories in the target's
# directory with the same names as the subdirectories in the source's
# directory. This is worse than useless.
XCOPY=xcopy /i /s /y
CPR=cp -r
CP=cp
MKDIR=mkdir -p
CVS="$(MAKEFILEDIR)/bin/cvs.exe"
TAR=tar
SED=sed
TOUCH=touch
NMAKE=nmake
CSCRIPT=cscript
ECHO=echo
ISS_DIR=$(PROGRAMFILES)\\Inno Setup 5
ISS_COMPILER=$(ISS_DIR)\\Compil32.exe
# We need a version that understands cygwin paths, so /bin/
UNZIP=/bin/unzip
$(REQUIRED_FILES):
if [ -z "$(BASE_DIR)/$@" ]; then echo. &echo. & echo \
You must download $(@F) and place it in "$(BASE_DIR)/tmp" &\
error 1; fi
PRODUCTS_DIR=build/instance/Products
PYLIBDIR=build/instance/lib/python
ZOPE_CVS_REPOSITORY=:pserver:anonymous@cvs.zope.org:/cvs-repository
CVS=/usr/bin/cvs -z7 -q
CVS_UPDATE=${CVS} update -dP
CVSROOT=:ext:korak.zope.com:/cvs-turbointranet
# Use COPY_AND_WINDOWIZE_LINEENDS like so:
#
# destination_path: source_path
# $(COPY_AND_WINDOWIZE_LINEENDS)
#
# Any directories needed to hold destination_path are created. The file
# is copied from source_path to there, and unix2dos is run on it in its
# new home. The paths must give file names, not directories; this reflects
# that renaming of files is often needed in these makefiles.
define COPY_AND_WINDOWIZE_LINEENDS
$(MKDIR) $(@D)
$(CP) $< $@
unix2dos $@
$(TOUCH) $@
endef
# The Python and pywin32 versions.
#
# For Python, the source tarball must be in tmp/. You must also install the
# appropriate Python on Windows, and set WIN_PYINSTALLEDDIR here to its root
# directory. A copy of the main Python DLL must also be in the root (you
# may need to copy it from your Windows system directory). Earlier versions
# of this extracted .dll, .exe, and .pyd files from Python's Wise installer,
# but Python 2.4 uses an .msi installer, and there doesn't appear to be a
# way to _just_ extract files from one of those.
#
# For pywin32 (previously known as win32all), the Windows installer must be
# in tmp/.
#
# Nothing beyond those is required to build Python, and you don't even need
# a compiler.
PYVERSION_MAJOR := 2
PYVERSION_MINOR := 4
PYVERSION_PATCH := 3
W32ALLVERSION := 208
PYVERSION := $(PYVERSION_MAJOR).$(PYVERSION_MINOR).$(PYVERSION_PATCH)
PYMAJORMINOR := python$(PYVERSION_MAJOR)$(PYVERSION_MINOR)
# This is the default directory into which a Python installs.
WIN_PYINSTALLEDDIR := \$(PYMAJORMINOR)
# pywin32 now uses a standard distutils 'bdist_wininst' installation .exe.
# These executables are valid .zip files with a "PLATLIB" directory being
# the complete directory structure as installed into "site-packages". These
# recent pywin32 builds have no dependencies on registry settings etc so
# will work directly as copied out of the .exe. The only concerns are the
# pywintypes/pythoncom dlls, which are handled by the Inno installer.
PYDIRNAME := Python-$(PYVERSION)
# Standard bdist_wininst name - eg: pywin32-203.win32-py2.3
W32ALLDIRNAME := pywin32-$(W32ALLVERSION).win32-py$(PYVERSION_MAJOR).$(PYVERSION_MINOR)
W32EXCLUDE := *.chm
# The Python tarball is extracted to PYSRCDIR.
# pywin32 is extracted to W32EXTRACTDIR.
PYSRCDIR := $(BASE_DIR)/src/$(PYDIRNAME)
W32EXTRACTDIR := $(BASE_DIR)/src/$(W32ALLDIRNAME)
WIN_PYSRCDIR := $(shell cygpath -w $(PYSRCDIR))
WIN_W32EXTRACTDIR := $(shell cygpath -w $(W32EXTRACTDIR))
PYTHON_REQUIRED_FILES := tmp/$(W32ALLDIRNAME).exe \
tmp/$(PYDIRNAME).tgz
# Arbitrary files from each of the installers and tarballs, to use as
# targets to force them to get unpacked.
ARB_PYSRCDIR := $(PYSRCDIR)/PCbuild/pcbuild.dsw
ARB_W32EXTRACTDIR := $(W32EXTRACTDIR)/PLATLIB
# Building Python just consists of extracting files.
build_python: $(ARB_PYSRCDIR) $(ARB_W32EXTRACTDIR)
# Installing Python consists of copying oodles of files into
# $(BUILD_DIR).
install_python: $(BUILD_DIR)/bin/python.exe
clean_python:
$(RMRF) $(PYSRCDIR)
clean_libs:
$(RMRF) $(W32EXTRACTDIR)
# Fetch dependencies
tmp:
$(MKDIR) tmp
$(ARB_PYSRCDIR): tmp/$(PYDIRNAME).tgz
$(MKDIR) "$(SRC_DIR)"
$(CD) "$(SRC_DIR)" && $(TAR) xzf ../tmp/$(PYDIRNAME).tgz
$(TOUCH) "$(ARB_PYSRCDIR)"
# unzip warns about .exe not being exactly a .zip, then succeeds in
# extracting the files, then returns with exit != 0 - ignore exit code
$(ARB_W32EXTRACTDIR): tmp/$(W32ALLDIRNAME).exe
-$(UNZIP) -o "-d$(W32EXTRACTDIR)" "tmp/$(W32ALLDIRNAME).exe"
cd "$(WIN_W32EXTRACTDIR)\PLATLIB" ; $(RMRF) $(W32EXCLUDE)
$(TOUCH) "$(ARB_W32EXTRACTDIR)"
$(BUILD_DIR)/bin/python.exe:
$(MKDIR) "$(BUILD_DIR)"
$(MKDIR) "$(BUILD_DIR)/doc"
$(CP) "$(MAKEFILEDIR)/doc/ZC_PY_DIST_README.txt" "$(BUILD_DIR)/doc"
$(CP) "$(PYSRCDIR)/LICENSE" "$(BUILD_DIR)/doc/PYTHON_LICENSE.txt"
unix2dos "$(BUILD_DIR)/doc/PYTHON_LICENSE.txt"
$(CP) "$(SRC_DIR)/$(W32ALLDIRNAME)/PLATLIB/pythonwin/License.txt" \
"$(BUILD_DIR)/doc/PYWIN32_LICENSE.txt"
$(MKDIR) "$(BUILD_DIR)/bin/Lib"
$(XCOPY) "$(WIN_PYSRCDIR)\Lib\*.py" "$(WIN_BUILD_DIR)\bin\Lib"
$(MKDIR) "$(BUILD_DIR)/bin/Lib/site-packages"
$(CP) "$(PYSRCDIR)/Lib/site-packages/README" \
"$(BUILD_DIR)/bin/Lib/site-packages"
$(XCOPY) "$(WIN_W32EXTRACTDIR)\PLATLIB" \
"$(WIN_BUILD_DIR)\bin\Lib\site-packages"
$(CP) "$(MAKEFILEDIR)/etc/sitecustomize.py" \
"$(BUILD_DIR)/bin/Lib/site-packages"
$(MKDIR) "$(BUILD_DIR)/bin/Include"
$(XCOPY) "$(WIN_PYSRCDIR)\Include\*.h" "$(WIN_BUILD_DIR)\bin\Include"
$(XCOPY) "$(WIN_PYSRCDIR)\PC\*.h" "$(WIN_BUILD_DIR)\bin\Include"
$(MKDIR) "$(BUILD_DIR)/bin"
$(MKDIR) "$(BUILD_DIR)/bin/libs"
$(MKDIR) "$(BUILD_DIR)/bin/DLLs"
$(XCOPY) "$(WIN_PYINSTALLEDDIR)\python.exe" "$(WIN_BUILD_DIR)\bin"
$(XCOPY) "$(WIN_PYINSTALLEDDIR)\pythonw.exe" "$(WIN_BUILD_DIR)\bin"
$(XCOPY) "$(WIN_PYINSTALLEDDIR)\w9xpopen.exe" "$(WIN_BUILD_DIR)\bin"
$(XCOPY) "$(WIN_PYINSTALLEDDIR)\$(PYMAJORMINOR).dll" \
"$(WIN_BUILD_DIR)\bin"
$(XCOPY) "$(WIN_MAKEFILEDIR)\bin\msvcr71.dll" "$(WIN_BUILD_DIR)\bin"
$(XCOPY) "$(WIN_PYINSTALLEDDIR)\libs" "$(WIN_BUILD_DIR)\bin\libs"
$(XCOPY) "$(WIN_PYINSTALLEDDIR)\DLLs\*.pyd" \
"$(WIN_BUILD_DIR)\bin\DLLs"
$(TOUCH) "$(BUILD_DIR)/bin/python.exe"
# Justs repackages the Spread binaries.
# Puts binaries into build/bin, and some docs into build/doc.
# See README.txt for system requirements.
# Download the binary distribution of Spread, from http://www.spread.org/.
# Store it in tmp/. NOTE: May need to rename it to .tgz (depends on how
# it's downloaded). The name is of the form spread-bin-n.nn.n.tgz
SPREAD_VERSION=3.17.1
SPREAD_DIR=spread-bin-$(SPREAD_VERSION)
SPREAD_ARCHIVE=$(SPREAD_DIR).tgz
SPREAD_REQUIRED_FILES=tmp/$(SPREAD_ARCHIVE)
REQUIRED_FILES=$(SPREAD_REQUIRED_FILES)
# Unpack the tarball into src/.
build_spread: $(SRC_DIR)/$(SPREAD_DIR)/win/spread.exe
$(SRC_DIR)/$(SPREAD_DIR)/win/spread.exe : tmp/$(SPREAD_ARCHIVE)
$(MKDIR) "$(SRC_DIR)"
$(TAR) -C "$(SRC_DIR)" -xvzf tmp/$(SPREAD_ARCHIVE)
$(TOUCH) $@
# A dumb trick so we don't unpack the tarball multiple times.
$(SRC_DIR)/$(SPREAD_DIR)/license.txt \
$(SRC_DIR)/$(SPREAD_DIR)/Readme.txt \
$(SRC_DIR)/$(SPREAD_DIR)/sample.spread.conf \
: $(SRC_DIR)/$(SPREAD_DIR)/win/spread.exe
$(TOUCH) $@
# Copy the Windows stuff from src/ into build/bin/ and build/doc
install_spread: $(BUILD_DIR)/bin/spread.exe \
$(BUILD_DIR)/bin/sprecv.exe \
$(BUILD_DIR)/bin/spsend.exe \
$(BUILD_DIR)/bin/sptuser.exe \
$(BUILD_DIR)/bin/spflooder.exe \
$(BUILD_DIR)/doc/SPREAD_LICENSE.txt \
$(BUILD_DIR)/doc/SPREAD_README.txt \
$(BUILD_DIR)/doc/sample.spread.conf
$(BUILD_DIR)/bin/spread.exe \
$(BUILD_DIR)/bin/sprecv.exe \
$(BUILD_DIR)/bin/spsend.exe \
$(BUILD_DIR)/bin/sptuser.exe \
$(BUILD_DIR)/bin/spflooder.exe : $(BUILD_DIR)/bin/% : \
$(SRC_DIR)/$(SPREAD_DIR)/win/%
$(MKDIR) $(@D)
$(CP) $< $@
$(TOUCH) $@
$(BUILD_DIR)/doc/SPREAD_LICENSE.txt: $(SRC_DIR)/$(SPREAD_DIR)/license.txt
$(COPY_AND_WINDOWIZE_LINEENDS)
$(BUILD_DIR)/doc/SPREAD_README.txt: $(SRC_DIR)/$(SPREAD_DIR)/Readme.txt
$(COPY_AND_WINDOWIZE_LINEENDS)
$(BUILD_DIR)/doc/sample.spread.conf: $(SRC_DIR)/$(SPREAD_DIR)/sample.spread.conf
$(COPY_AND_WINDOWIZE_LINEENDS)
# Builds the Python Spread wrapper module.
# Puts:
# spread.pyd into build/lib/python/
# testspread.py into build/lib/python/SpreadTest/
# various text files (Windowsized and renamed) into build/doc
# Download the wrapper module tarball, from
# http://www.python.org/other/spread/.
# Store it in tmp/. NOTE: May need to rename it to .tgz (depends on how
# it's downloaded). The name is of the form SpreadModule-n.n.tgz
# XXX There's no natural way to clean up SPREADWRAPPER_TMPDIR here.
SPREADWRAPPER_VERSION=1.4
SPREADWRAPPER_DIR=SpreadModule-$(SPREADWRAPPER_VERSION)
SPREADWRAPPER_ARCHIVE=$(SPREADWRAPPER_DIR).tgz
SPREADWRAPPER_REQUIRED_FILES=tmp/$(SPREADWRAPPER_ARCHIVE)
REQUIRED_FILES=$(SPREADWRAPPER_REQUIRED_FILES)
SPREADWRAPPER_TMPDIR=src/tmp/spreadwrapper-install
# Unpack the tarball into src/.
build_spreadwrapper: $(SRC_DIR)/$(SPREADWRAPPER_DIR)/spreadmodule.c
# Copy the Windows stuff into the build tree.
install_spreadwrapper: $(BUILD_DIR)/lib/python/spread.pyd \
$(BUILD_DIR)/lib/python/SpreadTest/testspread.py \
$(BUILD_DIR)/doc/spreadwrapper_doc.txt \
$(BUILD_DIR)/doc/SPREADWRAPPER_LICENSE.txt \
$(BUILD_DIR)/doc/SPREADWRAPPER_README.txt
$(SRC_DIR)/$(SPREADWRAPPER_DIR)/spreadmodule.c: tmp/$(SPREADWRAPPER_ARCHIVE)
$(MKDIR) "$(SRC_DIR)"
$(TAR) -C "$(SRC_DIR)" -xvzf $<
$(TOUCH) $@
# A dumb trick so we don't unpack the tarball multiple times.
$(SRC_DIR)/$(SPREADWRAPPER_DIR)/doc.txt \
$(SRC_DIR)/$(SPREADWRAPPER_DIR)/LICENSE \
$(SRC_DIR)/$(SPREADWRAPPER_DIR)/README \
$(SRC_DIR)/$(SPREADWRAPPER_DIR)/testspread.py \
: $(SRC_DIR)/$(SPREADWRAPPER_DIR)/spreadmodule.c
$(TOUCH) $@
$(SPREADWRAPPER_TMPDIR)/Lib/site-packages/spread.pyd: $(SRC_DIR)/$(SPREADWRAPPER_DIR)/spreadmodule.c
$(CD) $(SRC_DIR)/$(SPREADWRAPPER_DIR); \
$(BUILD_DIR)/bin/python.exe setup.py install \
--prefix=../../$(SPREADWRAPPER_TMPDIR)
$(BUILD_DIR)/lib/python/spread.pyd: $(SPREADWRAPPER_TMPDIR)/Lib/site-packages/spread.pyd
$(MKDIR) $(@D)
$(CP) $< $@
$(TOUCH) $@
$(BUILD_DIR)/doc/spreadwrapper_doc.txt: $(SRC_DIR)/$(SPREADWRAPPER_DIR)/doc.txt
$(COPY_AND_WINDOWIZE_LINEENDS)
$(BUILD_DIR)/doc/SPREADWRAPPER_LICENSE.txt: $(SRC_DIR)/$(SPREADWRAPPER_DIR)/LICENSE
$(COPY_AND_WINDOWIZE_LINEENDS)
$(BUILD_DIR)/doc/SPREADWRAPPER_README.txt: $(SRC_DIR)/$(SPREADWRAPPER_DIR)/README
$(COPY_AND_WINDOWIZE_LINEENDS)
$(BUILD_DIR)/lib/python/SpreadTest/testspread.py: $(SRC_DIR)/$(SPREADWRAPPER_DIR)/testspread.py
$(COPY_AND_WINDOWIZE_LINEENDS)
ZODBVERSION=3.2
ZODBDIRNAME=ZODB3-$(ZODBVERSION)
ZEO_REQUIRED_FILES=tmp/$(ZODBDIRNAME).tar.gz
REQUIRED_FILES=$(ZEO_REQUIRED_FILES)\
$(PYTHON_REQUIRED_FILES)
# run the Zope tests
clean_zope:
$(RMRF) src/$(ZODBDIRNAME)
install_zeo: src/$(ZODBDIRNAME)/setup.py install_python \
$(BUILD_DIR)/lib/python/version.txt \
$(BUILD_DIR)/ZEO-$(ZODBDIRNAME)-win32.exe
ESCAPED=$(shell sh $(MAKEFILEDIR)/bin/escape.sh '$(WIN_MAKEFILEDIR)')
SEDSCRIPT="s@<<VERSION>>@$(ZODBVERSION)@g;s@<<MAKEFILEDIR>>@$(ESCAPED)@g"
$(BUILD_DIR)/ZEO-$(ZODBDIRNAME)-win32.exe: $(BUILD_DIR)/lib/python/version.txt
$(SED) $(SEDSCRIPT) < "$(MAKEFILEDIR)/etc/zeo.iss.in" | unix2dos > "$(BUILD_DIR)/zeo.iss"
# Remove CVS directories from the build tree.
find $(BUILD_DIR) -name CVS -type d -exec $(RMRF) {} \; -prune
# Convert text files to Windows line ends. unix2dos has the nice
# property that it leaves lines with \r\n alone, so it doesn't hurt
# to do this on files already converted to Windows convention.
find $(BUILD_DIR) -name "*.py" -o -name "*.txt" -o -name "*.bat" | \
xargs unix2dos
# Build the Inno installer.
$(CD) "$(BUILD_DIR)";"$(ISS_COMPILER)" /cc "$(WIN_BUILD_DIR)\zeo.iss"
$(BUILD_DIR)/lib/python/ExtensionClass.pyd: WIN_TMPDIR=tmp\zeotmp
$(BUILD_DIR)/lib/python/ExtensionClass.pyd: install_python
$(MKDIR) $(WIN_TMPDIR)
$(CD) $(SRC_DIR)/$(ZODBDIRNAME); \
$(BUILD_DIR)/bin/python.exe setup.py install \
--prefix="$(WIN_BASE_DIR)\$(WIN_TMPDIR)" --no-compile
$(MKDIR) $(@D)
$(XCOPY) "$(WIN_TMPDIR)\Lib\site-packages\*.py" "$(shell cygpath -w $(@D))"
$(XCOPY) "$(WIN_TMPDIR)\Lib\site-packages\*.pyd" "$(shell cygpath -w $(@D))"
$(XCOPY) "$(WIN_TMPDIR)\Lib\site-packages\*.txt" "$(shell cygpath -w $(@D))"
$(XCOPY) "$(WIN_TMPDIR)\Lib\site-packages\*.xml" "$(shell cygpath -w $(@D))"
$(XCOPY) "$(WIN_TMPDIR)\Lib\site-packages\*.conf" "$(shell cygpath -w $(@D))"
$(XCOPY) "$(WIN_TMPDIR)\Include\*.h" "$(WIN_BUILD_DIR)\bin\Include"
$(XCOPY) "$(WIN_TMPDIR)\Scripts\*.py" "$(WIN_BUILD_DIR)\bin"
$(RMRF) $(shell cygpath -u $(WIN_TMPDIR))
$(BUILD_DIR)/lib/python/nt_svcutils/__init__.py: CVS_REPOSITORY=$(ZOPE_CVS_REPOSITORY)
$(BUILD_DIR)/lib/python/nt_svcutils/__init__.py: CVS_MODULE=Zope/lib/python/nt_svcutils
$(BUILD_DIR)/lib/python/nt_svcutils/__init__.py: CVS_TAG=-r HEAD
$(BUILD_DIR)/lib/python/nt_svcutils/__init__.py:
${CD} ${BUILD_DIR}/lib/python && \
${CVS} -d ${CVS_REPOSITORY} export ${CVS_TAG} -d \
$(shell basename $(@D)) ${CVS_MODULE}
$(BUILD_DIR)/skel/README.txt:
$(MKDIR) "$(@D)"
$(CPR) $(MAKEFILEDIR)/zeo_addons/skel/* $(@D)
$(TOUCH) "$@"
$(BUILD_DIR)/bin/mkzeoinstance.py:
$(MKDIR) "$(@D)"
$(CPR) $(MAKEFILEDIR)/zeo_addons/utilities/* $(@D)
$(TOUCH) "$(@)"
$(BUILD_DIR)/lib/python/version.txt: $(BUILD_DIR)/lib/python/ExtensionClass.pyd $(BUILD_DIR)/lib/python/nt_svcutils/__init__.py $(BUILD_DIR)/skel/README.txt $(BUILD_DIR)/bin/mkzeoinstance.py
@echo ZEO $(ZODBVERSION) > "$(BUILD_DIR)/lib/python/version.txt"
$(TOUCH) $@
src/$(ZODBDIRNAME)/setup.py:
$(MKDIR) "$(SRC_DIR)"
$(CD) "$(SRC_DIR)" && $(TAR) xvzf ../tmp/$(ZODBDIRNAME).tar.gz
$(TOUCH) $@
ZOPEVERSION = 2.12.3-final
ZOPEDIRNAME := Zope-$(ZOPEVERSION)
ZOPE_REQUIRED_FILES=tmp/$(ZOPEDIRNAME).tgz
REQUIRED_FILES=$(PYTHON_REQUIRED_FILES) \
$(ZOPE_REQUIRED_FILES)
clean_zope:
$(RMRF) src/$(ZOPEDIRNAME)
install_zope: src/$(ZOPEDIRNAME)/inst/configure.py \
install_python \
$(BUILD_DIR)/lib/python/Zope2/version.txt \
$(BUILD_DIR)/Zope-$(ZOPEVERSION)-win32.exe
ESCAPED=$(shell sh $(MAKEFILEDIR)/bin/escape.sh '$(WIN_MAKEFILEDIR)')
SEDSCRIPT="s@<<VERSION>>@$(ZOPEVERSION)@g;s@<<MAKEFILEDIR>>@$(ESCAPED)@g"
$(BUILD_DIR)/Zope-$(ZOPEVERSION)-win32.exe: $(BUILD_DIR)/lib/python/Zope2/version.txt
$(SED) $(SEDSCRIPT) < "$(MAKEFILEDIR)/etc/zope.iss.in" | unix2dos > "$(BUILD_DIR)/zope.iss"
# Remove CVS directories and compiled Python files from the build tree.
find $(BUILD_DIR) -name CVS -type d -exec $(RMRF) {} \; -prune
find $(BUILD_DIR) -name "*.pyc" -o -name "*.pyo" | xargs $(RM)
# Convert text files to Windows line ends. unix2dos has the nice
# property that it leaves lines with \r\n alone, so it doesn't hurt
# to do this on files already converted to Windows convention.
find $(BUILD_DIR) -name "*.bat" | xargs unix2dos
find $(BUILD_DIR) -name "*.conf" | xargs unix2dos
find $(BUILD_DIR) -name "*.html" | xargs unix2dos
find $(BUILD_DIR) -name "*.in" | xargs unix2dos
find $(BUILD_DIR) -name "*.py" | xargs unix2dos
find $(BUILD_DIR) -name "*.stx" | xargs unix2dos
find $(BUILD_DIR) -name "*.txt" | xargs unix2dos
find $(BUILD_DIR) -name "*.xml" | xargs unix2dos
find $(BUILD_DIR) -name "*.zcml" | xargs unix2dos
# Build the Inno installer.
$(CD) "$(BUILD_DIR)";"$(ISS_COMPILER)" /cc "$(WIN_BUILD_DIR)\zope.iss"
MAKEZOPE="$(MAKEFILEDIR)/bin/makezope.bat" "$(WIN_SRC_DIR)\\$(ZOPEDIRNAME)"
# This builds Zope, then installs it into the build directory, then
# creates lib/python/Zope2/version.txt in the build directory.
$(BUILD_DIR)/lib/python/Zope2/version.txt: $(BUILD_DIR)/bin/python.exe
cd "$(SRC_DIR)/$(ZOPEDIRNAME)" && \
"$<" inst/configure.py \
--prefix="$(WIN_BUILD_DIR)" \
--no-compile
$(MAKEZOPE)
echo Zope $(ZOPEVERSION) > $@
$(TOUCH) $@
tmp/$(ZOPEDIRNAME).tgz:
$(TOUCH) tmp/$(ZOPEDIRNAME).tgz
# This merely unpacks the Zope tarball.
src/$(ZOPEDIRNAME)/inst/configure.py: tmp/$(ZOPEDIRNAME).tgz
$(MKDIR) "$(SRC_DIR)"
$(CD) "$(SRC_DIR)" && $(TAR) xzf ../tmp/$(ZOPEDIRNAME).tgz
$(TOUCH) $@
This is an instance home for a ZEO server.
@set PYTHON=<<PYTHON>>
@set ZEO_HOME=<<ZEO_HOME>>
@set SOFTWARE_HOME=%ZEO_HOME%\lib\python
@set INSTANCE_HOME=<<INSTANCE_HOME>>
@set CONFIG_FILE=%INSTANCE_HOME%\etc\zeo.conf
@set PYTHONPATH=<<SOFTWARE_HOME>>
@set ZEO_RUN=%SOFTWARE_HOME%\ZEO\runzeo.py
"%PYTHON%" "%ZEO_RUN%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
#
##############################################################################
"""
A Windows NT service frontend.
Usage:
Installation
The service should be installed by the Windows installer. You can
manually install, uninstall the service from the commandline.
ntservice.py [options] install|update|remove|start [...]
|stop|restart [...]|debug [...]
Options for 'install' and 'update' commands only:
--username domain\username : The Username the service is to run
under
--password password : The password for the username
--startup [manual|auto|disabled] : How the service starts,
default = manual
Commands
install : Installs the service
update : Updates the service, use this when you change
the service class implementation
remove : Removes the service
start : Starts the service, this can also be done from the
services control panel
stop : Stops the service, this can also be done from the
services control panel
restart : Restarts the service
debug : Runs the service in debug mode
You can view the usage options by running ntservice.py without any
arguments.
Note: you may have to register the Python service program first,
win32\PythonService.exe /register
Starting
Start the service by clicking the 'start' button in the services
control panel. You can set the service to automatically start at boot
time by choosing 'Auto' startup by clicking the 'statup' button.
Stopping
Stop the service by clicking the 'stop' button in the services
control panel.
Event logging
Events are logged to the NT application event log. Use the event
viewer to keep track of events.
Note: to successfully run this script, the software home needs to be
on the PYTHONPATH.
"""
import os.path
from os.path import dirname as dn
import sys
# these are replacements from mkzeoinstance
PYTHON = r'<<PYTHON>>'
SOFTWARE_HOME=r'<<SOFTWARE_HOME>>'
INSTANCE_HOME = r'<<INSTANCE_HOME>>'
ZEO_HOME = r'<<ZEO_HOME>>'
ZEO_RUN = r'%s\ZEO\runzeo.py' % SOFTWARE_HOME
CONFIG_FILE= os.path.join(INSTANCE_HOME, 'etc', 'zeo.conf')
PYTHONSERVICE_EXE=r'%s\bin\PythonService.exe' % ZEO_HOME
sys.path.insert(0, SOFTWARE_HOME)
# Setup the environment, so sub-processes see these variables
os.environ["PYTHONPATH"] = os.environ.get("PYTHONPATH", "") + ";" + SOFTWARE_HOME
os.environ["INSTANCE_HOME"] = INSTANCE_HOME
from nt_svcutils import service
servicename = 'ZEO_%s' % str(hash(INSTANCE_HOME.lower()))
class InstanceService(service.Service):
start_cmd = '"%s" "%s" -C "%s"' % (PYTHON, ZEO_RUN, CONFIG_FILE)
_svc_name_ = servicename
_svc_display_name_ = 'ZEO instance at %s' % INSTANCE_HOME
# If the exe we expect is not there, let the service framework search
# for it. This will be true for people running from source builds and
# relying on pre-installed pythonservice.exe.
# Note this is only used at install time, not runtime.
if os.path.isfile(PYTHONSERVICE_EXE):
_exe_name_ = PYTHONSERVICE_EXE
process_runner = PYTHON
process_args = '"%s" -C "%s"' % (ZOPE_RUN, CONFIG_FILE)
evtlog_name = 'ZEO'
if __name__ == '__main__':
import win32serviceutil
win32serviceutil.HandleCommandLine(InstanceService)
# ZEO configuration file
%define INSTANCE_HOME <<INSTANCE_HOME>>
<zeo>
address 8100
read-only false
invalidation-queue-size 100
# monitor-address PORT
# transaction-timeout SECONDS
</zeo>
<filestorage 1>
path $INSTANCE_HOME\var\Data.fs
</filestorage>
<eventlog>
level info
<logfile>
path $INSTANCE_HOME\log\zeo.log
</logfile>
</eventlog>
# zeoctl configuration file
%define INSTANCE_HOME <<INSTANCE_HOME>>
%define SOFTWARE_HOME <<SOFTWARE_HOME>>
<runner>
program $INSTANCE_HOME/bin/runzeo
socket-name $INSTANCE_HOME/etc/zeo.zdsock
daemon true
forever false
backoff-limit 10
exit-codes 0, 2
directory $INSTANCE_HOME
default-to-interactive true
# user zope
python <<PYTHON>>
zdrun $SOFTWARE_HOME\ZEO\runzeo.py
# This logfile should match the one in the zeo.conf file.
# It is used by zdctl's logtail command, zdrun/zdctl doesn't write it.
logfile $INSTANCE_HOME\log\zeo.log
</runner>
<eventlog>
level info
<logfile>
path $INSTANCE_HOME\log\zeoctl.log
</logfile>
</eventlog>
This directory contains logfiles generated by a ZEO server.
This directory contains files related to a ZEO server instance such as database
files, lock files, and pid files.
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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 compileall, os, sys
class Shutup:
def write(*args): pass # :)
class NoteErr:
wrote = 0
def write(self, *args):
self.wrote = 1
apply(stderr.write, args)
def compile_non_test(dir):
"""Byte-compile all modules except those in test directories."""
success = compileall.compile_dir(dir, maxlevels=0)
try:
names = os.listdir(dir)
except os.error:
print "Can't list", dir
names = []
names.sort()
for name in names:
fullname = os.path.join(dir, name)
if (name != os.curdir and name != os.pardir and
os.path.isdir(fullname) and not os.path.islink(fullname) and
name != 'test' and name != 'tests' and name != 'skins'):
success = success and compile_non_test(fullname)
return success
print
print '-'*78
print 'Compiling python modules'
stdout = sys.stdout
stderr = sys.stderr
try:
try:
success = 0
sys.stdout = Shutup()
sys.stderr = NoteErr()
success = compile_non_test(os.getcwd())
finally:
success = success and not sys.stderr.wrote
sys.stdout = stdout
sys.stderr = stderr
except:
success = 0
import traceback
traceback.print_exc()
if not success:
print
print '!' * 78
print 'There were errors during Python module compilation.'
print '!' * 78
print
sys.exit(1)
#! python
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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 target directory from a skeleton directory.
usage: %(program)s [options]
Options:
-h/--help -- print this help text
-s/--sourcedir -- the skeleton source directory
-t/--targetdir -- the directory to which the skeleton files will be copied
-u/--uid -- the username/uid of the user who will own the target files
-g/--gid -- the groupname/gid of the group who will own the target files
-r/--replace -- specify replacement value for .in file
This script may be used to install a custom Zope instance home
skeleton directory. It is most useful when used to install a skeleton
which does not follow the standard 'one-directory-as-instance-home'
paradigm used by the stock Zope source install.
The value of --targetdir should be the directory where you would like to copy
the skeleton hierarchy. For many packagers, this will be "/" or "/usr"
or "/usr/local".
The value of --sourcedir should be a directory which contains a custom skeleton
hierarchy. For many packagers, the skeleton source directory may contain
directories like "usr" and "bin" and these directories will contain files
and other directories, comprising an installation hierarchy suitable for your
platform.
The skeleton source hierarchy may contain any kind of file. Files
in the skeleton hierarchy that end with a ".in" extension will go through
textual substitution before they are placed in the target directory. When
they are placed in the target directory, the ".in" extension is removed.
Specify textual replacement values by passing one or more --replace= options
to the script. The value of each replace option needs to be
in the following format: --replace=key:value. 'key' is the value that
will be replaced (minus the "<<" and ">>" values expected by the
replacement). 'value' is the value that should be used for replacement.
Files which do not have an ".in" extension are copied without substitution.
All file mode bits from files/dirs in the skeleton source directory are copied
along with the file/directory itself. If the --uid and/or --gid flags are
used, all directories and files created by this script will be provided with
this owner and/or group. Otherwise, the uid and group owner of the files will
be the executing user's. Existing directory structures and files are left
unchanged. If a file already exists in the target directory, it is left
unchanged and the source file is not copied. If a directory already exists in
the target directory, its ownership information and mode bit settings are left
unchanged.
"""
import os
import shutil
import sys
import getopt
def main():
try:
opts, args = getopt.getopt(sys.argv[1:],
"hs:t:u:g:r:",
["help", "sourcedir=", "targetdir=", "uid=", "gid=",
"replace="]
)
except getopt.GetoptError, msg:
usage(sys.stderr, msg)
sys.exit(2)
script = os.path.abspath(sys.argv[0])
sourcedir = None
targetdir = None
uid = None
gid = None
replacements = {}
for opt, arg in opts:
if opt in ("-h", "--help"):
usage(sys.stdout)
sys.exit()
if opt in ("-s", "--sourcedir"):
sourcedir = os.path.abspath(os.path.expanduser(arg))
if not sourcedir:
usage(sys.stderr, "sourcedir must not be empty")
sys.exit(2)
if opt in ("-t", "--targetdir"):
targetdir = os.path.abspath(os.path.expanduser(arg))
if not targetdir:
usage(sys.stderr, "targetdir must not be empty")
sys.exit(2)
if opt in ("-u", "--uid"):
if not arg:
usage(sys.stderr, "uid must not be empty")
sys.exit(2)
try:
if os.getuid() != 0:
usage(sys.stderr, "You must be root to specify a uid")
sys.exit(2)
try:
uid = int(arg)
except:
try:
import pwd
uid = pwd.getpwnam(arg)[2]
if not gid:
gid = pwd.getpwnam(arg)[3]
except KeyError:
usage(sys.stderr,
"The user indicated by uid does not exist on "
"your system")
sys.exit(2)
except (ImportError, AttributeError):
usage(sys.stderr,
"Your system does not support the gid or uid options")
sys.exit(2)
if opt in ("-g", "--gid"):
if not arg:
usage(sys.stderr, "gid must not be empty")
sys.exit(2)
try:
if os.getuid() != 0:
usage(sys.stderr, "You must be root to specify a gid")
sys.exit(2)
try:
gid = int(arg)
except:
try:
import pwd
gid = pwd.getpwnam(arg)[3]
except KeyError:
usage(sys.stderr,
"The user indicated by gid does not exist on "
"your system")
sys.exit(2)
except (ImportError, AttributeError):
usage(sys.stderr,
"Your system does not support the gid or uid options")
sys.exit(2)
if opt in ("-r", "--replace"):
if not arg:
continue
k, v = arg.split(':', 1)
replacements[k] = v
if not sourcedir:
usage(sys.stderr, "Must specify sourcedir")
sys.exit(2)
if not targetdir:
usage(sys.stderr, "Must specify targetdir")
sys.exit(2)
copyskel(sourcedir, targetdir, uid, gid, **replacements)
def copyskel(sourcedir, targetdir, uid, gid, **replacements):
""" This is an independent function because we'd like to
import and call it from mkzopeinstance """
# Create the top of the instance:
if not os.path.exists(targetdir):
os.makedirs(targetdir)
# 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(sourcedir)
try:
try:
os.path.walk(os.curdir, copydir,
(targetdir, replacements, uid, gid))
finally:
os.chdir(pwd)
except (IOError, OSError), msg:
print >>sys.stderr, msg
sys.exit(1)
CVS = os.path.normcase("CVS")
def copydir((targetdir, replacements, uid, gid), sourcedir, 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(sourcedir, name)):
# Copy the file:
sn, ext = os.path.splitext(name)
if os.path.normcase(ext) == ".in":
dst = os.path.join(targetdir, sourcedir, sn)
if os.path.exists(dst):
continue
copyin(os.path.join(sourcedir, name), dst, replacements, uid,
gid)
if uid is not None:
os.chown(dst, uid, gid)
else:
src = os.path.join(sourcedir, name)
dst = os.path.join(targetdir, src)
if os.path.exists(dst):
continue
shutil.copyfile(src, dst)
shutil.copymode(src, dst)
if uid is not None:
os.chown(dst, uid, gid)
else:
# Directory:
dn = os.path.join(targetdir, sourcedir, name)
if not os.path.exists(dn):
os.mkdir(dn)
shutil.copymode(os.path.join(sourcedir, name), dn)
if uid is not None:
os.chown(dn, uid, gid)
def copyin(src, dst, replacements, uid, gid):
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 uid is not None:
os.chown(dst, uid, gid)
def usage(stream, msg=None):
if msg:
print >>stream, msg
print >>stream
program = os.path.basename(sys.argv[0])
print >>stream, __doc__ % {"program": program}
if __name__ == '__main__':
main()
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
def main(dirname):
os.path.walk(dirname, rmpycs, None)
def rmpycs(arg, dirname, names):
for name in names:
path = os.path.join(dirname, name)
if ( name.endswith('.pyc') or name.endswith('.pyo') and
os.path.isfile(path) ):
os.unlink(path)
if __name__ == '__main__':
main(sys.argv[1])
#! python
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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 ZEO instance home.
usage: %(program)s [options]
Options:
-h/--help -- print this help text
-d/--dir -- the dir in which the instance home should be created
-u/--user NAME:PASSWORD -- set the user name and password of the initial user
-s/--skelsrc -- the dir from which skeleton files should be copied
When run without arguments, this script will ask for the information necessary
to create a ZEO instance home.
"""
import getopt
import os
import shutil
import sys
import copyskel
def main():
try:
opts, args = getopt.getopt(sys.argv[1:],
"hu:d:s:",
["help", "user=", "dir=", "skelsrc="]
)
except getopt.GetoptError, msg:
usage(sys.stderr, msg)
sys.exit(2)
script = os.path.abspath(sys.argv[0])
user = None
password = None
skeltarget = None
skelsrc = None
for opt, arg in opts:
if opt in ("-d", "--dir"):
skeltarget = os.path.abspath(os.path.expanduser(arg))
if not skeltarget:
usage(sys.stderr, "dir must not be empty")
sys.exit(2)
if opt in ("-s", "--skelsrc"):
skelsrc = os.path.abspath(os.path.expanduser(arg))
if not skelsrc:
usage(sys.stderr, "skelsrc must not be empty")
sys.exit(2)
if opt in ("-h", "--help"):
usage(sys.stdout)
sys.exit()
if not skeltarget:
# interactively ask for skeltarget and initial user name/passwd.
# cant set custom instancehome in interactive mode, we default
# to skeltarget.
skeltarget = instancehome = os.path.abspath(
os.path.expanduser(get_skeltarget())
)
instancehome = skeltarget
zeohome = os.path.dirname(os.path.dirname(script))
softwarehome = os.path.join(zeohome, "lib", "python")
if skelsrc is None:
# default to using stock ZEO skeleton source
skelsrc = os.path.join(zeohome, "skel")
inituser = os.path.join(instancehome, "inituser")
kw = {
"PYTHON": sys.executable,
"INSTANCE_HOME": instancehome,
"SOFTWARE_HOME": softwarehome,
"ZEO_HOME": zeohome,
}
copyskel.copyskel(skelsrc, skeltarget, None, None, **kw)
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_skeltarget():
print 'Please choose a directory in which you\'d like to install'
print 'ZEO "instance home" files such as database files, configuration'
print 'files, etc.'
print
while 1:
skeltarget = raw_input("Directory: ").strip()
if skeltarget == '':
print 'You must specify a directory'
continue
else:
break
return skeltarget
if __name__ == "__main__":
main()
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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 compileall, os, sys
class Shutup:
def write(*args): pass # :)
class NoteErr:
wrote = 0
def write(self, *args):
self.wrote = 1
apply(stderr.write, args)
def compile_non_test(dir):
"""Byte-compile all modules except those in test directories."""
success = compileall.compile_dir(dir, maxlevels=0)
try:
names = os.listdir(dir)
except os.error:
print "Can't list", dir
names = []
names.sort()
for name in names:
fullname = os.path.join(dir, name)
if (name != os.curdir and name != os.pardir and
os.path.isdir(fullname) and not os.path.islink(fullname) and
name != 'test' and name != 'tests' and name != 'skins'):
success = success and compile_non_test(fullname)
return success
print
print '-'*78
print 'Compiling python modules'
stdout = sys.stdout
stderr = sys.stderr
try:
try:
success = 0
sys.stdout = Shutup()
sys.stderr = NoteErr()
success = compile_non_test(os.getcwd())
finally:
success = success and not sys.stderr.wrote
sys.stdout = stdout
sys.stderr = stderr
except:
success = 0
import traceback
traceback.print_exc()
if not success:
print
print '!' * 78
print 'There were errors during Python module compilation.'
print '!' * 78
print
sys.exit(1)
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
import tempfile
QUIET=0
if sys.platform == 'win32':
PREFIX = 'c:\\Zope-' + versions.ZOPE_MAJOR_VERSION
IN_MAKEFILE = 'Makefile.win.in'
MAKE_COMMAND='the Visual C++ batch file "VCVARS32.bat" and then "nmake"'
else:
PREFIX = '/opt/Zope-' + versions.ZOPE_MAJOR_VERSION
IN_MAKEFILE = 'Makefile.in'
MAKE_COMMAND='make'
def main():
# below assumes this script is in the BASE_DIR/inst directory
global PREFIX
BASE_DIR=os.path.abspath(os.path.dirname(os.path.dirname(sys.argv[0])))
BUILD_BASE=os.path.join(os.getcwd(), 'build-base',
'python-%s.%s' % sys.version_info[:2])
PYTHON=sys.executable
TMP_DIR = tempfile.gettempdir()
MAKEFILE=open(os.path.join(BASE_DIR, 'inst', IN_MAKEFILE)).read()
REQUIRE_LF_ENABLED = 1
REQUIRE_ZLIB = 1
REQUIRE_EXPAT = 1
INSTALL_FLAGS = ''
DISTUTILS_OPTS = ''
try:
longopts = ['help', 'ignore-largefile', 'ignore-zlib',
'ignore-expat', 'prefix=',
'build-base=', 'optimize', 'no-compile', 'quiet']
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':
PREFIX=os.path.abspath(os.path.expanduser(a))
if o == '--ignore-largefile':
REQUIRE_LF_ENABLED=0
if o == '--ignore-zlib':
REQUIRE_ZLIB=0
if o == '--ignore-expat':
REQUIRE_EXPAT=0
if o == '--optimize':
INSTALL_FLAGS = '--optimize=1 --no-compile'
if o == '--no-compile':
INSTALL_FLAGS = '--no-compile'
if o == '--build-base':
BUILD_BASE = a
if o == '--quiet':
DISTUTILS_OPTS = '-q'
global QUIET
QUIET = 1
if REQUIRE_LF_ENABLED:
test_largefile()
if REQUIRE_ZLIB:
test_zlib()
if REQUIRE_EXPAT:
test_expat()
out(' - Zope top-level binary directory will be %s.' % PREFIX)
if INSTALL_FLAGS:
out(' - Distutils install flags will be "%s"' % INSTALL_FLAGS)
idata = {
'<<PYTHON>>':PYTHON,
'<<PREFIX>>':PREFIX,
'<<BASE_DIR>>':BASE_DIR,
'<<BUILD_BASE>>':BUILD_BASE,
'<<TMP_DIR>>':TMP_DIR,
'<<INSTALL_FLAGS>>':INSTALL_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(os.getcwd(), 'makefile'), 'w')
f.write(MAKEFILE)
out(' - Makefile written.')
out('')
out(' Next, run %s.' % MAKE_COMMAND)
out('')
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:
--quiet suppress nonessential output
--ignore-zlib allow configuration to proceeed if
Python zlib module is not found.
--ignore-largefile allow configuration to proceed without
Python large file support.
--ignore-expat allow configuration to proceed if the expat
XML parsing module is not found.
--optimize compile Python files as .pyo files
instead of as .pyc files
--no-compile don't compile Python files
Directories:
--build-base=DIR use DIR to store temporary build files
--prefix=DIR install Zope files in DIR [%(PREFIX)s]
By default, 'make install' will install Zope software files in
'%(PREFIX)s' You can specify an alternate location for these
files by using '--prefix', for example: '--prefix=$HOME/zope'.
""" % ({'program':sys.argv[0], 'PREFIX':PREFIX})
)
print usage
def test_expat():
try:
import xml.parsers.expat
except ImportError:
print (
"""
The Python interpreter you are using does not appear to have the 'pyexpat'
library module installed. For many Zope features to work properly, including
Zope Page Templates, you must install a Python interpreter which includes the
pyexpat module, or install the pyexpat library into your Python interpreter
manually. The file which represents the library is named 'pyexpat.so' (UNIX)
or 'pyexpat.dll' (Windows) and is typically located in the 'lib-dynload'
directory of your Python's library directory. Some Python packagers ship the
pyexpat module as a separate installable binary. If you are using a
system-provided Python installation, you may want to look for a 'python-xml'
or 'python-pyexpat' package (or something like it) and install it to make the
pyexpat module available to Zope. If you've compiled your Python interpreter
from source, you may need to recompile and reinstall it after installing James
Clark's expat libraries and development packages (look for libexpat.so and
expat.h). Typically, these come as part of your operating system's libexpat
and libexpat-dev packages, respectively.
Run the configure script with the --ignore-expat option to prevent this
warning with the understanding that some Zope features may not work properly
until you've installed the pyexpat module.
"""
)
sys.exit(1)
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)
def out(s):
if not QUIET:
print s
if __name__ == '__main__':
main()
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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)
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
#
##############################################################################
"""Build a PCGI resource file.
You must be in the directory containing this script.
"""
import os
from do import *
def main(cwd=os.getcwd(), name='Zope', user='', group=''):
python=sys.executable
print '-'*78
print 'Writing the pcgi resource file (ie cgi script), %s' % name
cwd=os.environ.get('ZDIR',cwd)
open(name,'w').write('''#!%(cwd)s/pcgi/pcgi-wrapper
PCGI_NAME=Zope
PCGI_MODULE_PATH=%(cwd)s/lib/python/Zope
PCGI_PUBLISHER=%(cwd)s/pcgi/pcgi_publisher.py
PCGI_EXE=%(python)s
PCGI_SOCKET_FILE=%(cwd)s/var/pcgi.soc
PCGI_PID_FILE=%(cwd)s/var/pcgi.pid
PCGI_ERROR_LOG=%(cwd)s/var/pcgi.log
PCGI_DISPLAY_ERRORS=1
BOBO_REALM=%(name)s
BOBO_DEBUG_MODE=1
INSTANCE_HOME=%(cwd)s
''' % vars())
ch(name, user, group, 0755)
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
import optparse
import tarfile
from distutils import filelist
INCLUDES = tuple('.*'.split())
EXCLUDES = tuple(r""".*.svn\\ .*CVS\\ .*.tgz
.*makefile$ .*Makefile$
.*inst\\tmp\\.* .*inst\\src\\.*
.*build-base\\ .*build\\
.*~ .*.#.*""".split())
def collect(top_dir, includes=INCLUDES, excludes=EXCLUDES):
old_dir = os.getcwd()
os.chdir(top_dir)
try:
fl = filelist.FileList()
fl.findall()
for inc in includes:
fl.include_pattern(inc, is_regex=1)
for exc in excludes:
fl.exclude_pattern(exc, is_regex=1)
return fl.files
finally:
os.chdir(old_dir)
def tar_it_up(dest, files):
tar = tarfile.open(dest, mode='w:gz')
basename = os.path.splitext(os.path.basename(dest))[0]
for fname in files:
tar.add(fname, os.path.join(basename, fname), recursive=False)
tar.close()
def main(options, args):
dest, top_dir = args
includes = options.include
excludes = options.exclude
excludes.append('.*%s.*' % os.path.basename(dest))
files = collect(top_dir, includes=includes, excludes=excludes)
tar_it_up(dest, files)
if __name__ == '__main__':
excludes = list(EXCLUDES)
includes = list(INCLUDES)
parser = optparse.OptionParser()
parser.add_option('', '--exclude', action='append', default=excludes)
parser.add_option('', '--include', action='append', default=includes)
options, args = parser.parse_args()
if not len(args) == 2:
parser.print_help()
parser.exit(status=1)
main(options, args)
ZOPE_MAJOR_VERSION = '2.12'
ZOPE_MINOR_VERSION = '3'
ZOPE_BRANCH_NAME = '$Name$'[6:] or 'no-branch'
# always start prerelease branches with '0' to avoid upgrade
# issues in RPMs
VERSION_RELEASE_TAG = 'final'
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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, sys
DEBUG = 0
if os.name in ('posix', 'nt', 'dos'):
EXCLUDED_NAMES=['..', '.']
else:
EXCLUDED_NAMES=[]
# extend EXCLUDED_NAMES here manually with filenames ala "asyncore.pyc" for
# files that are only distributed in compiled format (.pyc, .pyo)
# if necessary (not currently necessary in 2.3.1 AFAIK) - chrism
def walkandscrub(path):
path = os.path.expandvars(os.path.expanduser(path))
print
print '-'*78
sys.stdout.write(
"Deleting '.pyc' and '.pyo' files recursively under %s...\n" % path
)
os.path.walk(path, scrub, [])
sys.stdout.write('Done.\n')
def scrub(list, dirname, filelist):
for name in filelist:
if name in EXCLUDED_NAMES:
continue
prefix, ext = os.path.splitext(name)
if ext == '.pyo' or ext == '.pyc':
full = os.path.join(dirname, name)
os.unlink(full)
if DEBUG: print full
if __name__ == '__main__':
DEBUG = 1
walkandscrub(os.getcwd())
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