./waf-light --interpreter "#! /usr/bin/env python3" - for #1856

This commit is contained in:
Thomas Nagy 2016-11-20 21:25:22 +01:00
parent ec9081e81c
commit f9f6dbfa50
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
1 changed files with 6 additions and 0 deletions

View File

@ -82,6 +82,9 @@ def options(opt):
opt.add_option('--make-waf', action='store_true', default=True,
help='creates the waf script', dest='waf')
opt.add_option('--interpreter', action='store', default=None,
help='specify the #! line on top of the waf file', dest='interpreter')
opt.add_option('--sign', action='store_true', default=False, help='make a signed file', dest='signed')
default_zip = 'bz2'
@ -386,6 +389,9 @@ def create_waf(self, *k, **kw):
(cnt, C1) = find_unused(cnt, '\n')
ccc = code1.replace("C1='x'", "C1='%s'" % C1).replace("C2='x'", "C2='%s'" % C2).replace("C3='x'", "C3='%s'" % C3)
if getattr(Options.options, 'interpreter', None):
ccc = ccc.replace('#!/usr/bin/env python', Options.options.interpreter)
f = open('waf', 'wb')
try:
f.write(ccc.encode())