[Zope-Checkins] CVS: Zope/inst - compile_all.py:1.1.6.1 configure.py:1.1.2.1 zctl.py.in:1.1.6.1 make_instance.py:1.3.4.1

Chris McDonough chrism@zope.com
Thu, 22 Aug 2002 00:30:17 -0400


Update of /cvs-repository/Zope/inst
In directory cvs.zope.org:/tmp/cvs-serv26817/inst

Modified Files:
      Tag: chrism-install-branch
	make_instance.py 
Added Files:
      Tag: chrism-install-branch
	compile_all.py configure.py zctl.py.in 
Log Message:
A branch which allows for a ./configure; make; make install Zope installation.

Here is a sample session to get a flavor for things:

[chrism@james InstallerBranch]$ ./configure --prefix=/home/chrism/opt/zoptest

Configuring Zope installation

Testing for an acceptable Python interpreter...
  The optimimum Python version (2.1.3) was found at /home/chrism/bin/python.

Configuring...
  SOFTWARE_HOME (Zope binary directory) will be /home/chrism/opt/zoptest.
  Makefile written.
  'makeinstance' script written.

[chrism@james InstallerBranch]$ make
/home/chrism/bin/python /home/chrism/software/InstallerBranch/inst/compile_all.py

------------------------------------------------------------------------------
Compiling python modules
Building extension modules
/home/chrism/bin/python setup.py build_ext -i
running build_ext
building 'AccessControl.cAccessControl' extension
gcc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -Wall -Wstrict-prototypes -fPIC -I/home/chrism/software/InstallerBranch/lib/Components/ExtensionClass/src -I/home/chrism/opt/Python2.1.3/include/python2.1 -c AccessControl/cAccessControl.c -o build/temp.linux-i686-2.1/cAccessControl.o

... and so on ...

chmod 0711 /home/chrism/software/InstallerBranch/var
------------------------------------------------------------------------------

/bin/touch /home/chrism/software/InstallerBranch/build
Zope built. Next, do make install.

[chrism@james InstallerBranch]$ make install
/bin/mkdir -p /home/chrism/opt/zoptest
/bin/cp -r -u /home/chrism/software/InstallerBranch/* /home/chrism/opt/zoptest
... and so on ...
Zope binaries installed successfully.
Now run /home/chrism/opt/zoptest/makeinstance.

[chrism@james InstallerBranch]$ /home/chrism/opt/zoptest/makeinstance
The instance home is the directory from which you will run Zope.
Several instance homes, each with their own data and
configuration, can share one copy of Zope.

Instance home [/home/chrism/opt/zoptest]: /home/chrism/opt/instance
'/home/chrism/opt/instance' does not exist.
Shall I create it [y]? 
Created.
Created 'Extensions' directory.
Created 'import' directory.
Created 'Products' directory.
Created 'var' directory.
Created default database
Created zctl.py
------------------------------------------------------------------------------

Now to create a starting user. Leave the username blank if you want to skip this step.

------------------------------------------------------------------------------
Please choose a username and password.
This will create the initial user with which you manage Zope.
Username: admin
Password: 
Verify password: 
chmod 0644 /home/chrism/opt/instance/inituser
Done!  Use "/home/chrism/opt/instance/zctl.py start" to start Zope.

[chrism@james InstallerBranch]$ cd ~
[chrism@james chrism]$ cd opt/instance/
[chrism@james instance]$ ./zctl.py start
Starting Zope, using:
"/home/chrism/bin/python" "/home/chrism/opt/zoptest/z2.py" 
[chrism@james instance]$ 



=== Added File Zope/inst/compile_all.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Try to do all of the installation steps."""

import sys, os

def setup(me):
    home=os.path.split(me)[0]
    if not home or home=='.': home=os.getcwd()
    home=os.path.split(home)[0]
    return home

def main(me):
    home=setup(me)

    import compilezpy
    import build_extensions
    user=group=''
    import default_content; default_content.main(home, user, group)
    
    print '-'*78
    print

if __name__=='__main__': main(sys.argv[0])


=== Added File Zope/inst/configure.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Create a Makefile for building and installing Zope.

Also create a 'makeinstance' script for installing an INSTANCE_HOME
after the Zope 'binaries' are installed.
"""
import getopt, sys, os

SOFTWARE_HOME   = '/usr/local/zope'
INSTANCE_HOME = SOFTWARE_HOME
PYTHON          = sys.executable

MAKEINSTANCE = """#!/bin/sh
%(python)s %(software_home)s/inst/make_instance.py
"""

MAKEFILE = """
PYTHON=%(python)s
SOFTWARE_HOME=%(software_home)s
BUILD_DIR=$(shell pwd)
CPRU=/bin/cp -r -u
MKDIR=/bin/mkdir -p
RM=/bin/rm -rf
FIND=/usr/bin/find
TOUCH=/bin/touch
XARGS=/usr/bin/xargs

.PHONY : clean install uninstall

build:
	${PYTHON} ${BUILD_DIR}/inst/compile_all.py
	${TOUCH} ${BUILD_DIR}/build
	@echo Zope built.  Next, do \'make install\'.

install: build
	${MKDIR} ${SOFTWARE_HOME}
	${CPRU} ${BUILD_DIR}/* ${SOFTWARE_HOME}
	${RM} ${SOFTWARE_HOME}/Makefile
	${RM} ${SOFTWARE_HOME}/configure
	${RM} ${SOFTWARE_HOME}/stupid_clean
	${RM} ${SOFTWARE_HOME}/w_pcgi.py
	${RM} ${SOFTWARE_HOME}/wo_pcgi.py
	${RM} ${SOFTWARE_HOME}/setup.py
	${RM} ${SOFTWARE_HOME}/*.py[co]
	${RM} ${SOFTWARE_HOME}/build
	${RM} ${SOFTWARE_HOME}/start
	${RM} ${SOFTWARE_HOME}/stop
	${RM} ${SOFTWARE_HOME}/inituser
	${FIND} ${SOFTWARE_HOME} -name "CVS" | ${XARGS} rm -rf
	@echo Zope binaries installed successfully.
	@echo Now run \"${SOFTWARE_HOME}/makeinstance.\"

uninstall:
	${RM} ${SOFTWARE_HOME}

clean:
	${FIND} ${BUILD_DIR} -name '*.o' -o -name '*.so' -o -name '*.py[co]' \
          -o -name 'core*' | ${XARGS} rm -f
	${RM} ${BUILD_DIR}/build
"""

def main():
    software_home = SOFTWARE_HOME
    python = PYTHON
    try:
        longopts = ["help", "prefix="]
        opts, args = getopt.getopt(sys.argv[1:], "h", longopts)
    except getopt.GetoptError, v:
        print v
        usage()
        sys.exit(1)
    print "\nConfiguring..."
    for o, a in opts:
        if o in ('-h', '--help'):
            usage()
            sys.exit()
        if o == '--prefix':
            software_home=a
    print "  SOFTWARE_HOME (Zope binary directory) will be %s." % software_home
    opts = {'python':python,'software_home':software_home}
    mf = MAKEFILE % opts
    f = open('Makefile', 'w')
    f.write(mf)
    print "  Makefile written."
    mi = MAKEINSTANCE % opts
    f = open('makeinstance', 'w')
    f.write(mi)
    os.chmod('makeinstance', 0755)
    print "  'makeinstance' script written."
    print

def usage():
    usage = ("""
%(program)s configures and writes a Makefile for Zope.

Defaults for options are specified in brackets.

Configuration:
  -h, --help            display this help and exit

Installation directories:

  --prefix=DIR      install Zope SOFTWARE_HOME files in DIR [%(software_home)s]

By default, 'make install' will install Zope SOFTWARE_HOME  files in
'%(software_home)s'  You can specify an alternate SOFTWARE_HOME location by
using '--prefix', for example: '--prefix=$HOME/zope'.
""" % ({'program':sys.argv[0], 'software_home':SOFTWARE_HOME})
             )
    print usage

if __name__ == '__main__':
    main()
    


=== Added File Zope/inst/zctl.py.in ===
#!%(python)s
# -*- python -*-

# ZOPE_HOME is the directory containing the Zope software.
# You must set this, so we can load the zctl library.
ZOPE_HOME = '%(software_home)s'

# These two lines load the zctl library, and should be left alone:
import os
execfile(os.path.join(ZOPE_HOME, 'utilities', 'zctl_lib.py'))

# The following names are now available for use in your configuration code:
#
# modules: sys, os, socket, time, string
# functions: isfile, isdir, abspath
# HERE = the directory this file is in, also known as the INSTANCE_HOME
#
# Everything below, except the last line, is your configuration code.

# ZOPE[OPTS] may be used to provide additional z2.py command-line arguments.
#ZOPE[OPTS] = '-X -w 8080'

# ZOPE[PORT] may be used to specify the z2.py "-P" base services port
#ZOPE[PORT] = 8000

# ZOPE[LOG] may be used to specify a STUPID_LOG file
#ZOPE[LOG] = HERE + '/var/debug.log'

# ZOPE_ENV may be used to provide additional environment variables to Zope
#ZOPE_ENV['TMPDIR'] = '/tmp'


# ZEO

# If ZEO is installed, then ZEO[SOCKET] is required.
#ZEO[SOCKET] = '10.0.0.1:2221'

# ZEO[WAIT] may be used to specify how many seconds to wait for ZEO
# to start before giving up. (default: 60)
#ZEO[WAIT] = 60

# If ZEO[CONTROL] is the filename of a script that can start and
# stop ZEO, then you can use 'start_zeo' and 'stop_zeo', and
# automatically start ZEO when your client starts.
#ZEO[CONTROL] = HERE + '/zeo_ctl.py'

# ZEO[OPTS] may be used to provide additional arguments to the ZEO_CTL
# script.
#ZEO[OPTS] = ''

main() # This should be the last line of the file.


=== Zope/inst/make_instance.py 1.3 => 1.3.4.1 ===
--- Zope/inst/make_instance.py:1.3	Wed Aug 14 17:17:32 2002
+++ Zope/inst/make_instance.py	Thu Aug 22 00:30:16 2002
@@ -89,6 +89,7 @@
     print
     sys.path.insert(0, home)
     choose_inituser(ih)
+    print 'Done!  Use "%s/zctl.py start" to start Zope.' % ih
 
 def choose_inituser(home):
     ac_path=os.path.join(home, 'inituser')