2008-05-31 09:55:54 +00:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
# Thomas Nagy, 2005-2008
|
|
|
|
|
|
|
|
"""
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
3. The name of the author may not be used to endorse or promote products
|
|
|
|
derived from this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
|
|
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os, sys
|
|
|
|
if sys.hexversion<0x203000f: raise "Waf requires Python >= 2.3"
|
|
|
|
|
|
|
|
if 'PSYCOWAF' in os.environ:
|
|
|
|
try:import psyco;psyco.full()
|
|
|
|
except:pass
|
|
|
|
|
2008-06-03 21:10:46 +00:00
|
|
|
VERSION="1.4.2"
|
|
|
|
REVISION="052bab0c35dd0fc6015e412d863fb679"
|
2008-05-31 09:55:54 +00:00
|
|
|
INSTALL=sys.platform=='win32' and 'c:/temp' or '/usr/local'
|
|
|
|
cwd = os.getcwd()
|
|
|
|
join = os.path.join
|
|
|
|
|
|
|
|
def decode(s):
|
|
|
|
p1 = len(s)
|
|
|
|
s += '!!!!!'
|
|
|
|
w1 = [256**(3-u) for u in xrange(4)]
|
|
|
|
w2 = [(u, 85**(4-u)) for u in xrange(5)]
|
|
|
|
tot = [sum([(ord(s[i+m])-33) * n for (m, n) in w2]) for i in xrange(0, p1, 5)]
|
|
|
|
return ''.join([chr((y/x) & 255) for y in tot for x in w1])
|
|
|
|
|
|
|
|
def err(m):
|
|
|
|
print '\033[91mError: %s\033[0m' % m
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
def unpack_wafdir(dir):
|
|
|
|
f = open(sys.argv[0],'rb')
|
|
|
|
c = "corrupted waf (%d)"
|
|
|
|
while 1:
|
|
|
|
line = f.readline()
|
|
|
|
if not line: err("run waf-light from a folder containing wafadmin")
|
|
|
|
if line == '#==>\n':
|
|
|
|
txt = f.readline()
|
|
|
|
if not txt: err(c % 1)
|
|
|
|
if f.readline()!='#<==\n': err(c % 2)
|
|
|
|
break
|
|
|
|
if not txt: err(c % 3)
|
|
|
|
try: txt = decode(txt[1:-1].replace('z', '!!!!!'))
|
|
|
|
except: err(c % 4)
|
|
|
|
|
|
|
|
import shutil, tarfile
|
|
|
|
try: shutil.rmtree(dir)
|
|
|
|
except OSError: pass
|
|
|
|
try: os.makedirs(join(dir, 'wafadmin', 'Tools'))
|
2008-06-03 21:10:46 +00:00
|
|
|
except OSError: err("Cannot unpack waf lib into %s\nMove waf into a writeable directory" % dir)
|
2008-05-31 09:55:54 +00:00
|
|
|
|
|
|
|
os.chdir(dir)
|
|
|
|
tmp = 't.tbz2'
|
|
|
|
t = open(tmp,'wb')
|
|
|
|
t.write(txt)
|
|
|
|
t.close()
|
|
|
|
|
|
|
|
t = tarfile.open(tmp)
|
|
|
|
for x in t: t.extract(x)
|
|
|
|
t.close()
|
|
|
|
|
2008-06-03 21:10:46 +00:00
|
|
|
os.chmod(join('wafadmin','Tools'), 0755)
|
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
os.unlink(tmp)
|
|
|
|
os.chdir(cwd)
|
|
|
|
|
|
|
|
def test(dir):
|
|
|
|
try: os.stat(join(dir, 'wafadmin')); return os.path.abspath(dir)
|
|
|
|
except OSError: pass
|
|
|
|
|
|
|
|
def find_lib():
|
|
|
|
name = sys.argv[0]
|
|
|
|
base = os.path.dirname(os.path.abspath(name))
|
|
|
|
|
|
|
|
#devs use $WAFDIR
|
|
|
|
w=test(os.environ.get('WAFDIR', ''))
|
|
|
|
if w: return w
|
|
|
|
|
|
|
|
#waf-light
|
|
|
|
if name.endswith('waf-light'):
|
|
|
|
w = test(base)
|
|
|
|
if w: return w
|
|
|
|
err("waf-light requires wafadmin -> export WAFDIR=/folder")
|
|
|
|
|
|
|
|
dir = "/lib/waf-%s-%s/" % (VERSION, REVISION)
|
|
|
|
for i in [INSTALL,'/usr','/usr/local','/opt']:
|
|
|
|
w = test(i+dir)
|
|
|
|
if w: return w
|
|
|
|
|
|
|
|
#waf-local
|
|
|
|
s = '.waf-%s-%s'
|
|
|
|
if sys.platform == 'win32': s = s[1:]
|
|
|
|
dir = join(base, s % (VERSION, REVISION))
|
|
|
|
w = test(dir)
|
|
|
|
if w: return w
|
|
|
|
|
|
|
|
#unpack
|
|
|
|
unpack_wafdir(dir)
|
|
|
|
return dir
|
|
|
|
|
|
|
|
wafdir = find_lib()
|
|
|
|
if "-vv" in sys.argv: print "wafdir is %s" % wafdir
|
|
|
|
|
|
|
|
w = join(wafdir, 'wafadmin')
|
|
|
|
t = join(w, 'Tools')
|
|
|
|
sys.path = [w, t] + sys.path
|
|
|
|
|
|
|
|
import Scripting, Params
|
|
|
|
Params.g_tooldir = [t]
|
|
|
|
Params.g_cwd_launch = cwd
|
|
|
|
|
|
|
|
if Params.g_version != VERSION:
|
|
|
|
err('Version mismatch: waf %s <> wafadmin %s (wafdir %s)' % (VERSION, Params.g_version, wafdir))
|
|
|
|
Scripting.prepare()
|
|
|
|
|
|
|
|
#==>
|
2008-06-03 21:10:46 +00:00
|
|
|
#6<\%_0gSqh;d"-6rAt(Y.KBGJ[/f.bs8W-!s8W-!s8W*t!!8"A!WX)<Uc&6>!(0:cX5*GUh9W;*zzz!!!!.kFb$9&&!_dHcAS&q?Nau[[,0FDRrB-.jY0q;lA6F28-ENQRbdHeZOW;?E#3QhMO;noQBbLC%p8N24()OmQL#\SpP_d"l%Jff5Ek1$2(WO^>\aqp?WOfhHL)kD?+f?B70-hgfeW5_9(<+pYDG8!'Yo5!"IthB*2NAmK0H'k<8:<%RZn;hfZ!3M#fjAY!',XcokF:B\%\6#-!^V^dM$t6BtLM:f9[g>8dZB8?8/edK"C:55)O6e_W@:VlX3rZL#T-doAt@>AMQ/d.k3JV:Wb7CK]?HVqY:eIGRAQ\$b$&ZQFNg^!?<>I>>K.h]DOHmr*;FY]$Yj4THqs#msM%!)Vs7He3KIJjnnqE+NVoOtOWR(PR]3"]UXb'e6WsQ`WUI^#i(,>;r%1l`fiiHfI2X]Bdtq6WCO-Mqb_+>i&Z]=l,.0G>$^M^$]C"gUgM[4mdSS]48"3S_[pBcZ@jCG/o[J$98<G]sd>dICHYohfea[pq>"%43&B%[b4rjGAN:E]:SWMQG&eA>C4*TmpCInql@?L\)-k%h^qf1pYP0#i43-OgPssW^@%9D4,r^#mCfq5>HaT`gV%KMn0MR]mr%a/aNJ5&NkOl;L$lq8qL.LMgL"7Sqg`"jL$b);H$XAKgr9BX55@5%FSE7X+'Z<[mcKT<!/.!g70c,_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