Commit 79969808 authored by Chris McDonough's avatar Chris McDonough

Remove decoy modules.

parent f5110d28
##############################################################################
#
# 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.
This must be run from the top-level directory of the installation.
\(Yes, this is cheezy. We'll fix this when we have a chance.)
"""
import sys, os, getopt
from do import *
def setup(me):
home=os.path.split(me)[0]
if not home or home=='.': home=os.getcwd()
home=os.path.split(home)[0]
if not home or home=='.': home=os.getcwd()
sys.path.insert(0, os.path.join(home))
sys.path.insert(0, os.path.join(home,'inst'))
return home
def main(args):
me=args[0]
home=setup(me)
pcgi=os.path.join(home, 'Zope.cgi')
usage="""install [options]
where options are:
-p -- Supply the path to the PCGI resource file.
This defaults to %s.
Note that this path must include the file name.
-g -- Supply the name of the unix group to which
the user that runs your web server belongs.
If not specified, the installer will attempt
to determine the group itself. If no group
is specified and the installer is unable to
determine the group, the install will fail.
-u -- Supply the name of the unix user used to
run your web server. If not specified, this
defaults to the userid of the current user,
or 'nobody' is the current user is root.
-h -- Show command summary
""" % (pcgi)
try: options, args = getopt.getopt(sys.argv[1:], 'p:g:hu:')
except: error(usage, sys.exc_info())
if args: error('', ('Unexpected arguments', args))
group=user=''
for k, v in options:
if k=='-p': pcgi=v
elif k=='-g': group=v
elif k=='-u': user=v
elif k=='-h':
print usage
sys.exit()
import compilezpy
print '-'*78
import zpasswd; zpasswd.write_inituser(home, user, group)
import default_content; default_content.main(home, user, group)
import make_resource; make_resource.main(home, pcgi, user, group)
import make_start; make_start.sh(home, user, group)
print '-'*78
print
print 'Done!'
if __name__=='__main__': main(sys.argv)
##############################################################################
#
# 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
#
##############################################################################
"""Build the Zope Extension Modules
You must be in the directory containing this script.
"""
import sys
from do import do
def build():
print
print '-'*78
print 'Building extension modules'
do('"%s" setup.py build_ext -i' % sys.executable)
##############################################################################
#
# 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
#
##############################################################################
"""Build a PCGI
You must be in the directory containing this script.
"""
print
print '-'*78
print "Building the PCGI wrapper"
from do import *
os.chdir('pcgi')
do('./configure')
do('make')
os.chdir('..')
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import os
from do import *
def main(home, user='', group=''):
data_dir=os.path.join(home,'var')
ch(data_dir, user, group, 0711)
db_path=os.path.join(data_dir, 'Data.fs')
dd_path=os.path.join(data_dir, 'Data.fs.in')
if not os.path.exists(db_path) and os.path.exists(dd_path):
print '-'*78
print 'setting dir permissions'
def dir_chmod(mode, dir, files, user=user, group=group):
ch(dir, user=user, group=group, mode=mode, quiet=1)
os.path.walk(home, dir_chmod, 0775)
print '-'*78
print 'creating default database'
open(db_path,'wb').write(open(dd_path,'rb').read())
ch(db_path, user, group)
##############################################################################
#
# 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
#
##############################################################################
"""Shared routines used by the various scripts.
"""
import os, sys, string
try: import thread
except:
print "*******************************************"
print "Error: "
print "Zope requires Python thread support!"
print "*******************************************"
sys.exit(1)
cd=os.chdir
def do(command, picky=1, quiet=0):
if not quiet:
print command
i=os.system(command)
if i and picky: raise SystemError, i
def wheres_Makefile_pre_in():
"Identify Makefile.pre.in location (in much the same way it does)."
return "%s/lib/python%s/config/Makefile.pre.in" % (sys.exec_prefix,
sys.version[:3])
def error(message, error):
print message
if error: print "%s: %s" % error[:2]
def ch(path, user, group, mode=0600, quiet=0):
if group:
mode=mode|060
do("chgrp %s %s" % (group, path), 0, quiet)
if user:
do("chown %s %s" % (user, path), 0, quiet)
os.chmod(path, mode)
def make(*args):
print
print '-'*48
print 'Compiling extensions in %s' % string.join(args,'/')
for a in args: os.chdir(a)
# Copy over and use the prototype extensions makefile from python dist:
do("cp %s ." % wheres_Makefile_pre_in())
do('make -f Makefile.pre.in boot PYTHON=%s' % sys.executable)
do('make')
do('make clean')
for a in args: os.chdir('..')
##############################################################################
#
# 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
#
##############################################################################
"""Make an INSTANCE_HOME."""
import sys, os, string
def setup(me):
home=os.path.abspath(os.path.split(me)[0])
return os.path.split(home)[0]
def get_ih(home):
print 'The instance home is the directory from which you will run Zope.'
print 'Several instance homes, each with their own data and'
print 'configuration, can share one copy of Zope.'
while 1:
print
ih = raw_input('Instance home [%s]: ' % home)
if ih == '': ih = home
else: ih = os.path.abspath(ih)
if not os.path.exists(ih):
print '%s does not exist.' % `ih`
make_ih = raw_input('Shall I create it [y]? ')
if make_ih and make_ih[0] not in 'yY': continue
try:
os.mkdir(ih, 0775)
except:
print 'Unable to create %s' % `ih`
else:
print 'Created.'
return ih
elif not os.path.isdir(ih):
print '%s is not a directory.' % `ih`
else:
print "%s exists, so I left it alone." % `ih`
return ih
def main(me):
home=setup(me)
ih = get_ih(home)
# Make skeleton
for dirname in ('Extensions', 'import', 'Products', 'var'):
mode = (dirname == 'var') and 0711 or 0775
dirpath = os.path.join(ih, dirname)
if not os.path.isdir(dirpath):
os.mkdir(dirpath, mode)
print 'Created %s directory.' % `dirname`
# Set up Data.fs
db_path = os.path.join(ih, 'var', 'Data.fs')
dd_path = os.path.join(home, 'var', 'Data.fs.in')
if os.path.exists(db_path):
print 'Database exists, so I left it alone.'
elif os.path.exists(dd_path):
open(db_path,'wb').write(open(dd_path,'rb').read())
print 'Created default database'
# Set up other *.in files
# Note: They will be %-substituted, so quote '%'s!
idata = {'python': sys.executable, 'software_home': home}
from glob import glob
for infile in glob(os.path.join(home, 'inst', '*.in')):
fn = os.path.split(infile)[1][:-3]
target = os.path.join(ih, fn)
if os.path.exists(target):
print '%s exists, so I left it alone' % fn
else:
txt = open(infile, 'rb').read() % idata
outfile = open(target, 'wb')
outfile.write(txt)
outfile.close()
os.chmod(target, 0700)
print 'Created %s' % fn
print '-'*78
print
print ('Now to create a starting user. Leave the username '
'blank if you want to skip this step.')
print
sys.path.insert(0, home)
choose_inituser(ih)
def choose_inituser(home):
ac_path=os.path.join(home, 'inituser')
if not os.path.exists(ac_path):
import getpass, zpasswd
print '-'*78
print 'Please choose a username and password.'
print 'This will create the initial user with which you manage Zope.'
username = raw_input("Username: ")
if username == '':
return
while 1:
pw = getpass.getpass("Password: ")
verify = getpass.getpass("Verify password: ")
if verify == pw:
break
else:
pw = verify = ''
print "Password mismatch, please try again..."
acfile=open(ac_path, 'w')
acfile.write('%s:%s' % (username, zpasswd.generate_passwd(pw, 'SHA')))
acfile.close()
import do; do.ch(ac_path, '', '', mode=0644)
if __name__=='__main__': main(sys.argv[0])
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import sys, os
from do import *
def sh(home, user, group):
start=os.path.join(home, 'start')
if not os.path.exists(start):
print '-'*78
print 'Creating start script, start'
f = open(start,'w')
f.write(START_SCRIPT % sys.executable)
ch(start,user,group,0711)
f.close()
stop=os.path.join(home, 'stop')
if not os.path.exists(stop):
print '-'*78
print 'Creating stop script, stop'
f = open(stop,'w')
f.write(STOP_SCRIPT % os.path.join(home,'var','Z2.pid'))
ch(stop,user,group,0711)
f.close()
START_SCRIPT="""#!/bin/sh
umask 077
reldir=`dirname $0`
cwd=`cd $reldir; pwd`
# Zope's event logger is controlled by the "EVENT_LOG_FILE" environment
# variable. If you don't have a "EVENT_LOG_FILE" environment variable
# (or its older alias "STUPID_LOG_FILE") set, Zope will log to the standard
# output. For more information on EVENT_LOG_FILE, see doc/ENVIRONMENT.txt.
ZLOGFILE=$EVENT_LOG_FILE
if [ -z "$ZLOGFILE" ]; then
ZLOGFILE=$STUPID_LOG_FILE
fi
if [ -z "$ZLOGFILE" ]; then
EVENT_LOG_FILE=""
export EVENT_LOG_FILE
fi
exec %s $cwd/z2.py -D "$@"
"""
STOP_SCRIPT="#! /bin/sh\nkill `cat %s`\n"
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