2008-06-08 14:19:49 +00:00
|
|
|
#!/usr/bin/env python
|
2008-06-05 14:05:55 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
VERSION="1.4.2"
|
2008-06-08 14:19:49 +00:00
|
|
|
REVISION="0edf0b55479df1fe516b41b2d7255b2e"
|
2008-06-05 14:05:55 +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'))
|
|
|
|
except OSError: err("Cannot unpack waf lib into %s\nMove waf into a writeable directory" % dir)
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
os.chmod(join('wafadmin','Tools'), 0755)
|
|
|
|
|
|
|
|
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-08 14:19:49 +00:00
|
|
|
#6<\%_0gSqh;d$/Ce_pRs.=_Bt]Du@>s8W-!s8W-!s8W+>6indd$:$<G0G4D:+;q+dV#L&UYHMsHzzz!!!!]S4&3NW4r"MAcpU#dY(Y;o"l`kCSt#pdnB*&GM4p_]?e1)<gq;!\dr3.G%>LZU/)mM4hgaT=3TDC^<F4E3dH$h2'cs]3U\n5pM@LPnFq7cL?H2*pRJn-fGqR)1qbI7f%RjPGJ1]C*Bbq0f50:3!'Z$#!)WEd1kB0c(]d^Em_+-nWN[bXX=i-8C]IMfg<Y&Ua$H@JHHH=T.>Z_DW_0'f`e=JR!Mg&+"V`Ii<E.X[l[V0Rp$6R@]=b'O=mN6F[`iJT"h(@EqqlaqhgO<se#hK=S]043T6BaGh`]ijgYM;lg!b64PJ*mISaJ/C]$IG>I'd[7hfsM*GG''S!U9)!,SD")%Aoilopu2;,RWo(]4)D1<f@;;^%8n4&/%DT&PHM[<V'efn%SS#4#]+IWt0/qpUpBpo?2RIc!+"Y]07m^\(>fkhS%['l\1n>NTYZ-@s<:4:>+tjDf7:IF.J<R?@D1452<hB"KU:(lT,PWfs.GXm@KplI7q.MmrRXcf=#SCDK,!u1L8;[F^<OA0)Ei]YIf-ckrmS1f=LjUgq)'Rn$AU"L?EUCB--5ap$Ui5XZ&Q%p>9[<[s)^GfR)TMS$b`W]^bH'c-CLAf<P))2gK045(28Qc+`r/osPp$Bu98Kf=gHlSN[hE.._lUZekQII<P(f%psNOmFgSs:@&[2C&nYi#+LIpXHp/WUMR*_8Cc+37J<e<6b>+c*nlh7Db?/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