Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 676

Show
Ignore:
Timestamp:
09/24/05 13:30:13
Author:
dowski
Message:

Fix for #316 (old sessionfilter package conflict).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/setup.py

    r654 r676  
    1010from distutils.command.install import INSTALL_SCHEMES 
    1111import sys 
     12import os 
     13import shutil 
    1214 
    1315required_python_version = '2.3' 
     
    5557############################################################################### 
    5658 
     59 
    5760def main(): 
    5861    if sys.version < required_python_version: 
     
    6669        scheme['data'] = scheme['purelib'] 
    6770 
    68     setup( 
     71    dist = setup( 
    6972        name=name, 
    7073        version=version, 
     
    8184    ) 
    8285 
     86    # the code in the following "if" block handles situations where the 
     87    # user has installed over an older release of 2.1 with a conflicting 
     88    # version of the sessionfilter 
     89    if 'install_lib' in dist.command_obj: 
     90         
     91        # get the installation directory (is there a better way to do this?) 
     92        install_dir = dist.command_obj['install_lib'].install_dir 
     93 
     94        # make sure we have an absolute install path 
     95        install_dir = os.path.join(os.path.abspath('/'), install_dir) 
     96         
     97        old_session_filter_path = os.path.join( 
     98            install_dir, 'cherrypy', 'lib', 'filter', 'sessionfilter') 
     99         
     100        # check for existence of old sessionfilter package dir 
     101        # and prompt the user if it exists 
     102        if os.path.exists(old_session_filter_path): 
     103            handle_old_session_filter(old_session_filter_path) 
     104 
     105         
     106def handle_old_session_filter(pth): 
     107    warn_old_session_filter(pth) 
     108    choice = raw_input('Delete old sessionfilter directory? (yes/no): ') 
     109    if choice.lower() in ('y', 'yes'): 
     110        shutil.rmtree(pth) 
     111        print "Old sessionfilter directory deleted." 
     112    else: 
     113        print "You will need to manually need to delete the old sessionfilter directory." 
     114 
     115 
     116def warn_old_session_filter(pth): 
     117    msg = """ 
     118************************ WARNING ***************************** 
     119 Since you have installed over the top of an existing CherryPy 
     120 installation, you must remove the old sessionfilter package 
     121 directory at: 
     122 %s 
     123************************ WARNING ***************************** 
     124""" % (pth,) 
     125    print msg 
     126     
     127 
    83128if __name__ == "__main__": 
    84129    main() 
    85  

Hosted by WebFaction

Log in as guest/cpguest to create tickets