home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_2414 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  3.1 KB  |  80 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from distutils.command.install_lib import install_lib as _install_lib
  5. import os
  6.  
  7. class install_lib(_install_lib):
  8.     
  9.     def _bytecode_filenames(self, py_filenames):
  10.         bytecode_files = []
  11.         for py_file in py_filenames:
  12.             if not py_file.endswith('.py'):
  13.                 continue
  14.             
  15.             if self.compile:
  16.                 bytecode_files.append(py_file + 'c')
  17.             
  18.             if self.optimize > 0:
  19.                 bytecode_files.append(py_file + 'o')
  20.                 continue
  21.         
  22.         return bytecode_files
  23.  
  24.     
  25.     def run(self):
  26.         self.build()
  27.         outfiles = self.install()
  28.         if outfiles is not None:
  29.             self.byte_compile(outfiles)
  30.         
  31.  
  32.     
  33.     def get_exclusions(self):
  34.         exclude = { }
  35.         nsp = self.distribution.namespace_packages
  36.         if nsp and self.get_finalized_command('install').single_version_externally_managed:
  37.             for pkg in nsp:
  38.                 parts = pkg.split('.')
  39.                 while parts:
  40.                     pkgdir = os.path.join(self.install_dir, *parts)
  41.                     for f in ('__init__.py', '__init__.pyc', '__init__.pyo'):
  42.                         exclude[os.path.join(pkgdir, f)] = 1
  43.                     
  44.                     parts.pop()
  45.             
  46.         
  47.         return exclude
  48.  
  49.     
  50.     def copy_tree(self, infile, outfile, preserve_mode = 1, preserve_times = 1, preserve_symlinks = 0, level = 1):
  51.         exclude = self.get_exclusions()
  52.         if not exclude:
  53.             return _install_lib.copy_tree(self, infile, outfile)
  54.         unpack_directory = unpack_directory
  55.         import setuptools.archive_util
  56.         log = log
  57.         import distutils
  58.         outfiles = []
  59.         
  60.         def pf(src, dst):
  61.             if dst in exclude:
  62.                 log.warn('Skipping installation of %s (namespace package)', dst)
  63.                 return False
  64.             log.info('copying %s -> %s', src, os.path.dirname(dst))
  65.             outfiles.append(dst)
  66.             return dst
  67.  
  68.         unpack_directory(infile, outfile, pf)
  69.         return outfiles
  70.  
  71.     
  72.     def get_outputs(self):
  73.         outputs = _install_lib.get_outputs(self)
  74.         exclude = self.get_exclusions()
  75.         if exclude:
  76.             return _[1]
  77.         return outputs
  78.  
  79.  
  80.