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

Ticket #316: setup.py.patch

  • setup.py

    old new  
    88 
    99from distutils.core import setup 
    1010from distutils.command.install import INSTALL_SCHEMES 
    11 import sys 
     11import sys 
     12import os 
    1213 
    1314required_python_version = '2.3' 
    1415 
     
    5354############################################################################### 
    5455# end arguments for setup 
    5556############################################################################### 
    56  
     57 
     58 
    5759def main(): 
    5860    if sys.version < required_python_version: 
    5961        s = "I'm sorry, but %s %s requires Python %s or later." 
    6062        print s % (name, version, required_python_version) 
    61         sys.exit(1) 
    62  
     63        sys.exit(1) 
     64 
    6365    # set default location for "data_files" to platform specific "site-packages" 
    6466    # location 
    6567    for scheme in INSTALL_SCHEMES.values(): 
    6668        scheme['data'] = scheme['purelib'] 
    6769 
    68     setup( 
     70    dist = setup( 
    6971        name=name, 
    7072        version=version, 
    7173        description=desc, 
     
    7880        packages=packages, 
    7981        download_url=download_url, 
    8082        data_files=data_files, 
    81     ) 
     83    ) 
     84 
     85    # get the installation directory (is there a better way to do this? 
     86    install_dir = dist.command_obj['install_lib'].install_dir 
     87 
     88    # make sure we have an absolute install path 
     89    install_dir = os.path.join(os.path.abspath('/'), install_dir) 
     90     
     91    old_session_filter_path = os.path.join( 
     92        install_dir, 'cherrypy', 'lib', 'filter', 'sessionfilter') 
     93     
     94    # check for existence of old sessionfilter package dir 
     95    # and warn user if present 
     96    if os.path.exists(old_session_filter_path): 
     97        warn_old_session_filter(old_session_filter_path) 
     98     
     99 
     100def warn_old_session_filter(pth): 
     101    msg = """ 
     102************************ WARNING ***************************** 
     103 Since you have installed over the top of an existing CherryPy 
     104 installation, you must remove the old sessionfilter package 
     105 directory at: 
     106 %s 
     107************************ WARNING ***************************** 
     108""" % (pth,) 
     109    print msg 
     110     
    82111 
    83112if __name__ == "__main__": 
    84113    main() 
    85  

Hosted by WebFaction

Log in as guest/cpguest to create tickets