waf/playground/strip/strip_on_install.py

21 lines
517 B
Python
Raw Normal View History

2016-08-13 19:32:02 +02:00
#! /usr/bin/env python
"""
Strip executables upon installation
"""
2016-08-13 19:32:02 +02:00
import shutil, os
from waflib import Build, Utils, Context
2016-08-13 19:32:02 +02:00
def copy_fun(self, src, tgt):
if Utils.is_win32 and len(tgt) > 259 and not tgt.startswith('\\\\?\\'):
tgt = '\\\\?\\' + tgt
2016-08-13 19:32:02 +02:00
shutil.copy2(src, tgt)
os.chmod(tgt, self.chmod)
if getattr(self.generator, 'link_task', None):
if self.generator.link_task.outputs[0] in self.inputs:
self.generator.bld.cmd_and_log('strip %s' % tgt, quiet=Context.BOTH)
Build.inst.copy_fun = copy_fun
2016-08-13 19:32:02 +02:00