Changeset 1475 for pykota/trunk/setup.py

Show
Ignore:
Timestamp:
05/13/04 15:59:30 (20 years ago)
Author:
jalet
Message:

Code simplifications

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/setup.py

    r1430 r1475  
    2424# 
    2525# $Log$ 
     26# Revision 1.40  2004/05/13 13:59:27  jalet 
     27# Code simplifications 
     28# 
    2629# Revision 1.39  2004/04/08 17:07:41  jalet 
    2730# pkpgcounter added 
     
    173176    sys.exit(-1) 
    174177 
     178from distutils import sysconfig 
    175179sys.path.insert(0, "pykota") 
    176180from pykota.version import __version__, __doc__ 
     
    179183ACTION_ABORT = 1 
    180184 
     185def checkOldModule(path) : 
     186    """Checks if an old PyKota module is still in the destination (in case of upgrade).""" 
     187    fname = os.path.join(sysconfig.get_python_lib(), "pykota", path) 
     188    for ext in ["py", "pyc", "pyo"] : 
     189        fullname = "%s.%s" % (fname, ext) 
     190        if os.path.isfile(fullname) : 
     191            sys.stderr.write("ERROR : old module %s still exists. Remove it and restart installation.\n" % fullname) 
     192            sys.stderr.write("INSTALLATION ABORTED !\n") 
     193            sys.exit(-1) 
     194     
    181195def checkOldScript(cmd) : 
    182196    """Checks if an old shell script is still around in /usr/bin.""" 
     
    282296                sys.stderr.write("\nINSTALLATION ABORTED !\nPlease correct the problem and restart installation.\n") 
    283297                sys.exit(-1) 
     298                 
     299        # now checks if pre-1.19alpha8 code is still there        
     300        for module in ["accounters/querying", "accounters/external", "requesters/snmp"] : 
     301            checkOldModule(module) 
    284302         
    285303    # Second stage, we will fail if onfiguration is incorrect for security reasons 
     
    348366     
    349367    # WARNING MESSAGE     
    350     sys.stdout.write("WARNING : IF YOU ARE UPGRADING FROM A PRE-1.14 TO 1.16 OR ABOVE\n") 
     368    sys.stdout.write("WARNING : IF YOU ARE UPGRADING FROM A PRE-1.19alpha7 TO 1.19alpha7 OR ABOVE\n") 
    351369    sys.stdout.write("AND USE THE POSTGRESQL BACKEND, THEN YOU HAVE TO MODIFY YOUR\n") 
    352     sys.stdout.write("DATABASE SCHEMA USING initscripts/postgresql/upgrade-to-1.14.sql\n") 
    353     sys.stdout.write("AND initscripts/postgresql/upgrade-to-1.16.sql\n") 
     370    sys.stdout.write("DATABASE SCHEMA USING initscripts/postgresql/upgrade-to-1.19.sql\n") 
    354371    sys.stdout.write("PLEASE READ DOCUMENTATION IN initscripts/postgresql/ TO LEARN HOW TO DO.\n") 
    355372    sys.stdout.write("YOU CAN DO THAT AFTER THE INSTALLATION IS FINISHED, OR PRESS CTRL+C NOW.\n") 
    356     sys.stdout.write("\n\nYOU DON'T HAVE ANYTHING SPECIAL TO DO IF THIS IS YOUR FIRST INSTALLATION\nOR IF YOU ARE ALREADY RUNNING VERSION 1.16 OR ABOVE.\n\n") 
     373    sys.stdout.write("\n\nYOU DON'T HAVE ANYTHING SPECIAL TO DO IF THIS IS YOUR FIRST INSTALLATION\nOR IF YOU ARE ALREADY RUNNING VERSION 1.19alpha7 OR ABOVE.\n\n") 
    357374    dummy = raw_input("Please press ENTER when you have read the message above. ") 
    358375