home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 June / maximum-cd-2011-06.iso / DiscContents / LibO_3.3.1_Win_x86_install_multi.exe / libreoffice1.cab / install_headers.py < prev    next >
Encoding:
Python Source  |  2011-02-15  |  1.4 KB  |  53 lines

  1. """distutils.command.install_headers
  2.  
  3. Implements the Distutils 'install_headers' command, to install C/C++ header
  4. files to the Python include directory."""
  5.  
  6. # This module should be kept compatible with Python 2.1.
  7.  
  8. __revision__ = "$Id: install_headers.py 61000 2008-02-23 17:40:11Z christian.heimes $"
  9.  
  10. from distutils.core import Command
  11.  
  12.  
  13. class install_headers (Command):
  14.  
  15.     description = "install C/C++ header files"
  16.  
  17.     user_options = [('install-dir=', 'd',
  18.                      "directory to install header files to"),
  19.                     ('force', 'f',
  20.                      "force installation (overwrite existing files)"),
  21.                    ]
  22.  
  23.     boolean_options = ['force']
  24.  
  25.     def initialize_options (self):
  26.         self.install_dir = None
  27.         self.force = 0
  28.         self.outfiles = []
  29.  
  30.     def finalize_options (self):
  31.         self.set_undefined_options('install',
  32.                                    ('install_headers', 'install_dir'),
  33.                                    ('force', 'force'))
  34.  
  35.  
  36.     def run (self):
  37.         headers = self.distribution.headers
  38.         if not headers:
  39.             return
  40.  
  41.         self.mkpath(self.install_dir)
  42.         for header in headers:
  43.             (out, _) = self.copy_file(header, self.install_dir)
  44.             self.outfiles.append(out)
  45.  
  46.     def get_inputs (self):
  47.         return self.distribution.headers or []
  48.  
  49.     def get_outputs (self):
  50.         return self.outfiles
  51.  
  52. # class install_headers
  53.