<s> from distutils . command . install_lib import install_lib as _install_lib <EOL> import os <EOL> class install_lib ( _install_lib ) : <EOL> """<STR_LIT>""" <EOL> def _bytecode_filenames ( self , py_filenames ) : <EOL> bytecode_files = [ ] <EOL> for py_file in py_filenames : <EOL> if not py_file . endswith ( '<STR_LIT>' ) : <EOL> continue <EOL> if self . compile : <EOL> bytecode_files . append ( py_file + "<STR_LIT:c>" ) <EOL> if self . optimize > <NUM_LIT:0> : <EOL> bytecode_files . append ( py_file + "<STR_LIT:o>" ) <EOL> return bytecode_files <EOL> def run ( self ) : <EOL> self . build ( ) <EOL> outfiles = self . install ( ) <EOL> if outfiles is not None : <EOL> self . byte_compile ( outfiles ) <EOL> def get_exclusions ( self ) : <EOL> exclude = { } <EOL> nsp = self . distribution . namespace_packages <EOL> if ( nsp and self . get_finalized_command ( '<STR_LIT>' ) <EOL> . single_version_externally_managed <EOL> ) : <EOL> for pkg in nsp : <EOL> parts = pkg . split ( '<STR_LIT:.>' ) <EOL> while parts : <EOL> pkgdir = os . path . join ( self . install_dir , * parts ) <EOL> for f in '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' : <EOL> exclude [ os . path . join ( pkgdir , f ) ] = <NUM_LIT:1> <EOL> parts . pop ( ) <EOL> return exclude <EOL> def copy_tree ( <EOL> self , infile , outfile , <EOL> preserve_mode = <NUM_LIT:1> , preserve_times = <NUM_LIT:1> , preserve_symlinks = <NUM_LIT:0> , level = <NUM_LIT:1> <EOL> ) : <EOL> assert preserve_mode and preserve_times and not preserve_symlinks <EOL> exclude = self . get_exclusions ( ) <EOL> if not exclude : <EOL> return _install_lib . copy_tree ( self , infile , outfile ) <EOL> from setuptools . archive_util import unpack_directory <EOL> from distutils import log <EOL> outfiles = [ ] <EOL> def pf ( src , dst ) : <EOL> if dst in exclude : <EOL> log . warn ( "<STR_LIT>" , dst ) <EOL> return False <EOL> log . info ( "<STR_LIT>" , src , os . path . dirname ( dst ) ) <EOL> outfiles . append ( dst ) <EOL> return dst <EOL> unpack_directory ( infile , outfile , pf ) <EOL> return outfiles <EOL> def get_outputs ( self ) : <EOL> outputs = _install_lib . get_outputs ( self ) <EOL> exclude = self . get_exclusions ( ) <EOL> if exclude : <EOL> return [ f for f in outputs if f not in exclude ] <EOL> return outputs </s>
