Changeset 884

Show
Ignore:
Timestamp:
04/03/03 22:03:37 (22 years ago)
Author:
jalet
Message:

Installation script now allows to install the sample configuration file.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/setup.py

    r873 r884  
    2323# 
    2424# $Log$ 
     25# Revision 1.7  2003/04/03 20:03:37  jalet 
     26# Installation script now allows to install the sample configuration file. 
     27# 
    2528# Revision 1.6  2003/03/29 13:45:26  jalet 
    2629# GPL paragraphs were incorrectly (from memory) copied into the sources. 
     
    5356import glob 
    5457import os 
     58import shutil 
    5559from distutils.core import setup 
    5660 
     
    106110    if os.path.isfile("/etc/cups/pykota.conf") : 
    107111        if not os.path.isfile("/etc/pykota.conf") : 
    108             sys.stdout.write("From version 1.02 on, PyKota expects to find its configuration file in /etc instead of /etc/cups.\n") 
    109             sys.stdout.write("It seems that you've got a configuration file in the old location, so it will not be used anymore, and no configuration file in the new location.\n") 
    110             answer = raw_input("Do you want me to move your configuration file to the new location in /etc (y/N) ? ") 
     112            sys.stdout.write("From version 1.02 on, PyKota expects to find its configuration\nfile in /etc instead of /etc/cups.\n") 
     113            sys.stdout.write("It seems that you've got a configuration file in the old location,\nso it will not be used anymore,\nand there's no configuration file in the new location.\n") 
     114            answer = raw_input("Do you want to move /etc/cups/pykota.conf to /etc/pykota.conf (y/N) ? ") 
    111115            if answer[0:1].upper() == 'Y' : 
    112116                try : 
     
    120124        else :         
    121125            sys.stderr.write("WARNING : Configuration file /etc/cups/pykota.conf will not be used !\nThe file /etc/pykota.conf will be used instead.\n") 
     126    elif not os.path.isfile("/etc/pykota.conf") :         
     127        # no configuration file, first installation it seems. 
     128        if os.path.isfile("conf/pykota.conf.sample") : 
     129            answer = raw_input("Do you want to install conf/pykota.conf.sample as /etc/pykota.conf (y/N) ? ") 
     130            if answer[0:1].upper() == 'Y' : 
     131                try : 
     132                    shutil.copy("conf/pykota.conf.sample", "/etc/pykota.conf")         
     133                except IOError :     
     134                    sys.stderr.write("WARNING : Problem while installing /etc/pykota.conf, please do it manually.\n") 
     135                else :     
     136                    sys.stdout.write("Configuration file /etc/pykota.conf installed.\nDon't forget to adapt /etc/pykota.conf to your needs.\n") 
     137            else :         
     138                sys.stderr.write("WARNING : PyKota won't run without a configuration file !\n") 
    122139     
    123140    # checks if some needed Python modules are there or not.