mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
74 KiB
132 lines
74 KiB
16 years ago
|
#!/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
|
||
|
|
||
|
VERSION="1.5.2"
|
||
|
REVISION="9bdedb7508a3a68a9e2e89a73bed6d5b"
|
||
|
INSTALL=sys.platform=='win32' and 'c:/temp' or '/usr/local'
|
||
|
C1='#.'
|
||
|
C2='#('
|
||
|
cwd = os.getcwd()
|
||
|
join = os.path.join
|
||
|
|
||
|
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)
|
||
|
txt = txt[1:-1].replace(C1, '\n').replace(C2, '\r')
|
||
|
|
||
|
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'), 493)
|
||
|
|
||
|
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()
|
||
|
w = join(wafdir, 'wafadmin')
|
||
|
t = join(w, 'Tools')
|
||
|
sys.path = [w, t] + sys.path
|
||
|
|
||
|
import Scripting
|
||
|
Scripting.prepare(t, cwd, VERSION, wafdir)
|
||
|
|
||
|
#==>
|
||
|
#BZh91AY&SY��iJ����1AB������������$ B� P� 8a~ܭ� ���[hz�4iGJm}9v�{2p6eV�jݾ��=��+����6����WD���� ��nm��=�AA^�&���Ǟ�j���{�ݻ�f]���u��n_[[O#(>��zp� A�5P�w����[}��֞�mv�|����l!C�ÈBPJ��[ � }#(�DP #(�7l���j9���wMJE#(w�y�ε����)��/��Sxj�s�7���Mr�j�n��;����t������B���e([`�A���ב�����w��#( +=�#.�$���%l 9���^U�0ׯ{�}���}>������4=�� ��Ө�n�+��}}������m�K(\�y����\�jy��{��mD��ػr��0��-�G#(ٚ��m��WZ���p�e���t���۾���o�W�Z��c��}����[�/}��A|���uk��23:�_m`7g��}7��B�t@Q���R��rb�UB�]T�]����{���֞ZB�,hJܷ����ݺ� {�Bz4���Y�Śv��p7__{,���9�l�����K�d�7!gr2�9o2������&H��%}��_t��Ӗ�_|��g�����ozY��n.iO!�{�_}�<z+��*����u����x���顽�}���[���=�W���F��:j���`6Y��wj�ot_}���}����=�: �}�R�g��t��ws�ƹ=mn��:�ov�GGӑ��g���H��zwc7����(�#(�u��/=#(j ����}�w���-��n��=��]�*F��ƕ�;[�&�{���M%�7v{���|�����F��lVdBV�5u�w��V��a�}<W������n}�� ɦ� ��4�FT�����F����%4A�4OD=4j��O�jz@�OSF�z�� �@�jh4 ��@�Fڦ�I�@�F�i���� OT��4SS�Sɵ2��hyM��ѐi�@ $@� &�i1#( ���i���SښmSCFM�� 5� � ���OSBOiOL�z�d�P�� � ���_Ѷ�\W������������6��f���*��kV�`���~�EG�EO�q5MNF&�������z�8�3yp��t>`?��4�!&���B_�HK�/��x�x��HHV�)\����H�սtQqR��SSZ�R�8�(y�q������%q�yr��$��@/�Tkl��U��U�>yBAP.�����@���(���b��M!�G�%Z��%%$�H��k531���6��-J1�)L�f�J�2 �3T ��c��1���SbMi6d�d�@B�%�Ȗ2�d�i� lֳkRF�d�ԛ��ŒRbƕ)#($�ZViI����i�d����D��Q24i Ƅ���TE��2#)��d̤�Z���-$�e,�cJ���JFB �I�0Ԉ��Ы(��6f�ff��hѦZ�&h�$Rh��E���M�lm26f�X#(�0��H�3J������1��"��T�Y�##QlQ�42�%62F�نb��#E&LX��f&VH�e�JQ �(i! ɓ&1��)�2Y$ddML،X #$��Xɔ�і&�fVb"� #Ld� ��ƖZ2$DF`��d̈ 2f�F�FaJ2�E�m&5�Rk"l�4)H��,�d3$-*IL��%%��L�@ZM�b�#(F���%�H���$i$R��2aBSI�QRV*�M�cb�I�b�Ɗ���fL�,�H��CF�(�ZEF�*J0���1A(kS[LbI�c&��є"mf2KA��%��&��I���g��ň���lJ$�d�-�ٴ�Jmc�2���jd��̂�-��I��ef3 �Z 1(��جْM�l ���f0mb�e�͔�,2ɨ�Uib)�E�ڨ��Q�PU�H�R�M�a�bf�4i�-%cL�6�m5)��em4��Ձ��m2�ز-�cI�e� M�$m��F����SS%)f�Pa �L��$��%���,��i�(���(� ���$E4� ��%�)5SF�)L�D3JIC4��RI�(52 �jb[3I��#0�m�#.��0d��l�(�65�D���Q�m�%`�ԕ@JQlX���-�I�H��,6l��&D&���F�H���Q��iYi*I�4��d�&j"JK��E)�I#*`�ĕ�ce-ij-��IE���)��"%��2��4l3���Q4�ڂ�m�d)���c&H�B)JCa�i5�bґA�,��6��RL�66U$mDf�lS!�IlU)���,I$Qe$�fZ ڔ%Db(h��F6!j�VJL�(a2Ƥ4���ª���hؙ�fX�F4��F�a,3A%,��IY#(F� �l��1�Z�D�TE�M�$̚65#2�P�MZak�ʕ�f2TRj6ą*Cf�j5F�V,d�-lL�b�4���-���ڦ��F�$D�LI�#4�f�&SJiSM�-$F����3f�ɕm%&T�V�iFF�"���)1I�EHi�2eM�&5bѢ֥)SERmR)�R���*�6IKΫ�V dh����?��dR��en���T���\3?��z�o�?ȹ��`����6/�u�Ե#.j<e��x��]+�'K^��;��R�*����'03����.���R�cB4��Ղ�rK{q��"Qu��g����ݱ��{wq����?L�J;�����^/���o@��Lu��Z������"ED������#(h��[!b��,��L2�����(A���4lf�XF2��������k��O���<�]`�96���B?��o�`2��E1)��D$�2=���GXu�m�����5�~�+��"���>��"6;�h���T]T���ꅎS������X�Ǖ��Bc#;�Zt�m�D�m�bc����]�x��u!����a�(o}����>;�F����TRŌTHori�U��A�%�l���UG"�p�Q@�t�����X10�TѲ���f`DH�bh�X���-U�%�BF3-(�uBG=�l60d�����{���x ̎��iD��u�N�÷�������=��%:��ti�(dQw )!VY�[4��g phQQ�����T}*L� IS@�5U[4_¡@�6a�x�ab+<�zmN,���wі'�������N��*'��LVUc�5�(����-J-�%ʪ'�v��W�w�:�&���K�#(qUԌ�?9c����d�E"�����o�}���<�}ز��&εJEm)���c)��|R��;��P��*M���g%s85#��b!�IQ �]]1���h�ҪJdXG.���r�l��z�_�ٽ^Jtj3}TR'��}1z8*����P�ڨ�cŔ �vjҪ#(R�O:)�g���ƕJ" �2��@R�:��-5q����q^dm�5h�h���uHnf\�j��W]��W*�w,�Ҭͼ.X夊�F�*4)���A]Aj�x|�����?;8�EQ(�^��ц���0�1�\�K�~+C]�>.Sj9]�k���#.L��s@�����(/�˒5g���/FP�CTvN۸�T*��w����։ ��etzD��D5���4O����#(�s��m�v�ą)�^���(��O[�grM<J��f����X\#!S�@tM���#¹��.�M����O��ݻ^���(Q`��M�����R���[M�{��FsS�cpr|)lg��̃_$��5;E�,<�x�|j�w@��w�N��'XD��>m�v/�}a��Pk��6�P~n#(>ɋ�lW�SEQ��43�Q��]�5��ښ�dӟF�����.�|��{g?�I�t�sW6?�F�=zRrȻDFu�����f>�{gkH.G�h7���J\��Z�k�Iփ�M28��ګ�T2*E3Ҷb�,�@�e�S�L 좭�JP�>�7�A�:`|�<�j?#.I!t�q8]���ԙ^U�����na]����1f�M6?�/٫d_T���N�o�P����Va+��������]��">�;�4y8s�hǶr�$_U��O�T�o\�L�������o�u�.^˷\T��,9���Ed)�s�[�����IG�:��u���U#.�jj���&��
|
||
|
#<==
|