[Zope-Checkins] CVS: Zope/inst/WinBuilders/bin - compilezpy.py:1.1.2.1 decompilezpy.py:1.1.2.1 escape.sh:1.1.2.1 fixreg.py:1.1.2.1 makezope.bat:1.1.2.1 runzeo.bat:1.1.2.1

Christian Theune ct at gocept.com
Mon May 9 04:07:42 EDT 2005


Update of /cvs-repository/Zope/inst/WinBuilders/bin
In directory cvs.zope.org:/tmp/cvs-serv24822/WinBuilders/bin

Added Files:
      Tag: Zope-2_7-branch
	compilezpy.py decompilezpy.py escape.sh fixreg.py makezope.bat 
	runzeo.bat 
Log Message:
 - Added WinBuilders in 2.7 flavour


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

import 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)


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

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])


=== Added File Zope/inst/WinBuilders/bin/escape.sh ===
echo $1 | sed 's@\\@\\\\\\\\@g' 


=== Added File Zope/inst/WinBuilders/bin/fixreg.py ===
""" 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])
        
    


=== Added File Zope/inst/WinBuilders/bin/makezope.bat ===
cd %1%
set MAKEFLAGS=
nmake build
nmake install


=== Added File Zope/inst/WinBuilders/bin/runzeo.bat ===
@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



More information about the Zope-Checkins mailing list