Changeset 3005 for pykota

Show
Ignore:
Timestamp:
09/03/06 17:37:17 (18 years ago)
Author:
jerome
Message:

Now ensures that the permissions on /usr/share/pykota/cupspykota
are correctly set for CUPS 1.2 and higher.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/setup.py

    r2909 r3005  
    2828import glob 
    2929import os 
     30import stat 
    3031import shutil 
    3132try : 
    3233    from distutils.core import setup 
     34    from distutils.command.install_data import install_data 
    3335except ImportError, msg :     
    3436    sys.stderr.write("%s\n" % msg) 
     
    108110data_files.append((sqlitedirectory, ["initscripts/sqlite/README.sqlite", "initscripts/sqlite/pykota-sqlite.sql"])) 
    109111 
     112class MyInstallData(install_data) : 
     113    """A special class to ensure permissions are OK on the cupspykota backend.""" 
     114    def run(self) : 
     115        """Launches the normal installation and then tweaks permissions.""" 
     116        install_data.run(self) 
     117        if not self.dry_run : 
     118            cupspykota = [ filename for filename in self.get_outputs() if filename.endswith("cupspykota") ][0] 
     119            os.chmod(cupspykota, stat.S_IRWXU) 
     120     
    110121os.umask(022) 
    111122setup(name = "pykota", version = __version__, 
     
    121132                  "bin/pykosd", "bin/edpykota", "bin/repykota", \ 
    122133                  "bin/warnpykota", "bin/pykotme", "bin/pkprinters" ], 
    123       data_files = data_files) 
     134      data_files = data_files, 
     135      cmdclass = { "install_data" : MyInstallData })