#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file import os,sys,errno,traceback,inspect,re,shutil,datetime,gc,platform import subprocess from collections import deque,defaultdict try: import _winreg as winreg except ImportError: try: import winreg except ImportError: winreg=None from waflib import Errors try: from collections import UserDict except ImportError: from UserDict import UserDict try: from hashlib import md5 except ImportError: try: from md5 import md5 except ImportError: pass try: import threading except ImportError: if not'JOBS'in os.environ: os.environ['JOBS']='1' class threading(object): pass class Lock(object): def acquire(self): pass def release(self): pass threading.Lock=threading.Thread=Lock else: run_old=threading.Thread.run def run(*args,**kwargs): try: run_old(*args,**kwargs) except(KeyboardInterrupt,SystemExit): raise except Exception: sys.excepthook(*sys.exc_info()) threading.Thread.run=run SIG_NIL='iluvcuteoverload' O644=420 O755=493 rot_chr=['\\','|','/','-'] rot_idx=0 try: from collections import OrderedDict as ordered_iter_dict except ImportError: class ordered_iter_dict(dict): def __init__(self,*k,**kw): self.lst=[] dict.__init__(self,*k,**kw) def clear(self): dict.clear(self) self.lst=[] def __setitem__(self,key,value): dict.__setitem__(self,key,value) try: self.lst.remove(key) except ValueError: pass self.lst.append(key) def __delitem__(self,key): dict.__delitem__(self,key) try: self.lst.remove(key) except ValueError: pass def __iter__(self): for x in self.lst: yield x def keys(self): return self.lst is_win32=sys.platform in('win32','cli','os2') def readf(fname,m='r',encoding='ISO8859-1'): if sys.hexversion>0x3000000 and not'b'in m: m+='b' f=open(fname,m) try: txt=f.read() finally: f.close() if encoding: txt=txt.decode(encoding) else: txt=txt.decode() else: f=open(fname,m) try: txt=f.read() finally: f.close() return txt def writef(fname,data,m='w',encoding='ISO8859-1'): if sys.hexversion>0x3000000 and not'b'in m: data=data.encode(encoding) m+='b' f=open(fname,m) try: f.write(data) finally: f.close() def h_file(fname): f=open(fname,'rb') m=md5() try: while fname: fname=f.read(200000) m.update(fname) finally: f.close() return m.digest() def readf_win32(f,m='r',encoding='ISO8859-1'): flags=os.O_NOINHERIT|os.O_RDONLY if'b'in m: flags|=os.O_BINARY if'+'in m: flags|=os.O_RDWR try: fd=os.open(f,flags) except OSError: raise IOError('Cannot read from %r'%f) if sys.hexversion>0x3000000 and not'b'in m: m+='b' f=os.fdopen(fd,m) try: txt=f.read() finally: f.close() if encoding: txt=txt.decode(encoding) else: txt=txt.decode() else: f=os.fdopen(fd,m) try: txt=f.read() finally: f.close() return txt def writef_win32(f,data,m='w',encoding='ISO8859-1'): if sys.hexversion>0x3000000 and not'b'in m: data=data.encode(encoding) m+='b' flags=os.O_CREAT|os.O_TRUNC|os.O_WRONLY|os.O_NOINHERIT if'b'in m: flags|=os.O_BINARY if'+'in m: flags|=os.O_RDWR try: fd=os.open(f,flags) except OSError: raise IOError('Cannot write to %r'%f) f=os.fdopen(fd,m) try: f.write(data) finally: f.close() def h_file_win32(fname): try: fd=os.open(fname,os.O_BINARY|os.O_RDONLY|os.O_NOINHERIT) except OSError: raise IOError('Cannot read from %r'%fname) f=os.fdopen(fd,'rb') m=md5() try: while fname: fname=f.read(200000) m.update(fname) finally: f.close() return m.digest() readf_unix=readf writef_unix=writef h_file_unix=h_file if hasattr(os,'O_NOINHERIT')and sys.hexversion<0x3040000: readf=readf_win32 writef=writef_win32 h_file=h_file_win32 try: x=''.encode('hex') except LookupError: import binascii def to_hex(s): ret=binascii.hexlify(s) if not isinstance(ret,str): ret=ret.decode('utf-8') return ret else: def to_hex(s): return s.encode('hex') to_hex.__doc__=""" Return the hexadecimal representation of a string :param s: string to convert :type s: string """ def listdir_win32(s): if not s: try: import ctypes except ImportError: return[x+':\\'for x in list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')] else: dlen=4 maxdrives=26 buf=ctypes.create_string_buffer(maxdrives*dlen) ndrives=ctypes.windll.kernel32.GetLogicalDriveStringsA(maxdrives*dlen,ctypes.byref(buf)) return[str(buf.raw[4*i:4*i+2].decode('ascii'))for i in range(int(ndrives/dlen))] if len(s)==2 and s[1]==":": s+=os.sep if not os.path.isdir(s): e=OSError('%s is not a directory'%s) e.errno=errno.ENOENT raise e return os.listdir(s) listdir=os.listdir if is_win32: listdir=listdir_win32 def num2ver(ver): if isinstance(ver,str): ver=tuple(ver.split('.')) if isinstance(ver,tuple): ret=0 for i in range(4): if i