Changeset 1407 for pykota/trunk/setup.py

Show
Ignore:
Timestamp:
03/18/04 10:18:09 (20 years ago)
Author:
jalet
Message:

Installation now checks for old scripts

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/setup.py

    r1386 r1407  
    2424# 
    2525# $Log$ 
     26# Revision 1.38  2004/03/18 09:18:09  jalet 
     27# Installation now checks for old scripts 
     28# 
    2629# Revision 1.37  2004/03/03 19:35:36  jalet 
    2730# Spelling problem. Thanks to Jurandy Martins 
     
    172175ACTION_CONTINUE = 0 
    173176ACTION_ABORT = 1 
     177 
     178def checkOldScript(cmd) : 
     179    """Checks if an old shell script is still around in /usr/bin.""" 
     180    return os.path.isfile(os.path.join("/usr/bin", cmd)) 
    174181 
    175182def checkModule(module) : 
     
    263270            dummy = raw_input("Please press ENTER when you have read the message above. ") 
    264271    else :     
    265         # already at 1.14 or above, nothing to be done. 
    266         pass 
     272        # already at 1.14 or above. 
     273        # Now check if old scripts are still in /usr/bin 
     274        for script in ["cupspykota", "pykota", "waitprinter.sh", "papwaitprinter.sh", "mailandpopup.sh", "pagecount.pl"] : 
     275            if checkOldScript(script) : 
     276                sys.stderr.write("WARNING : the %s script is still present in /usr/bin, but the new version will be installed in /usr/share/pykota, please remove the %s script from /usr/bin and double check that your configuration is correct.\n" % (script, script)) 
     277                if script == "cupspykota" : 
     278                    sys.stderr.write("\nBe sure to also remove the old symbolic link from /usr/lib/cups/backend/cupspykota to /usr/bin/cupspykota. You'll have to recreate it once the installation has finished successfully.\n") 
     279                sys.stderr.write("\nINSTALLATION ABORTED !\nPlease correct the problem and restart installation.\n") 
     280                sys.exit(-1) 
    267281         
    268282    # Second stage, we will fail if onfiguration is incorrect for security reasons