strip_on_install.py 517 B

1234567891011121314151617181920
  1. #! /usr/bin/env python
  2. """
  3. Strip executables upon installation
  4. """
  5. import shutil, os
  6. from waflib import Build, Utils, Context
  7. def copy_fun(self, src, tgt):
  8. if Utils.is_win32 and len(tgt) > 259 and not tgt.startswith('\\\\?\\'):
  9. tgt = '\\\\?\\' + tgt
  10. shutil.copy2(src, tgt)
  11. os.chmod(tgt, self.chmod)
  12. if getattr(self.generator, 'link_task', None):
  13. if self.generator.link_task.outputs[0] in self.inputs:
  14. self.generator.bld.cmd_and_log('strip %s' % tgt, quiet=Context.BOTH)
  15. Build.inst.copy_fun = copy_fun