rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
jaropts.append(d.bldpath())
jaropts.append(srcdir_node.bldpath())
def jar_files(self): basedir = getattr(self, 'basedir', '.') destfile = getattr(self, 'destfile', 'test.jar') jaropts = getattr(self, 'jaropts', []) jarcreate = getattr(self, 'jarcreate', 'cf') d = self.path.find_dir(basedir) if not d: raise tsk = self.create_task('jar_create') tsk.set_outputs(self.path.find_or_decla...
jar_tsk.set_run_after(tsk)
def apply_java(self): Utils.def_attrs(self, jarname='', jaropts='', classpath='', sourcepath='.', srcdir='.', jar_mf_attributes={}, jar_mf_classpath=[]) nodes_lst = [] if not self.classpath: if not self.env['CLASSPATH']: self.env['CLASSPATH'] = '..' + os.pathsep + '.' else: self.env['CLASSPATH'] = self.classpath if ...
import Configure, config_c, Options, Utils, Logs from Logs import warn, debug from Configure import conf
from waflib import Configure, Options, Utils, Logs from waflib.Tools import c_config from waflib.Logs import warn, debug from waflib.Configure import conf
#def build(bld):
self.files.append(''.join(self.buf))
self.files.append(''.join(self.buf).encode())
def endElement(self, name): if name == 'file': self.files.append(''.join(self.buf))
nm = aux_node.name docuname = nm[ : len(nm) - 4 ]
docuname = aux_node.name[:-4]
def tex_build(task, command='LATEX'): env = task.env bld = task.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') fun = latex_fun if command == 'PDFLATEX': fun = pdflatex_fun node = task.inputs[0] srcfile = n...
task.env.env = {'TEXINPUTS': sr2}
task.env.env = {} task.env.env.update(os.environ) task.env.env.update({'TEXINPUTS': sr2})
def tex_build(task, command='LATEX'): env = task.env bld = task.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') fun = latex_fun if command == 'PDFLATEX': fun = pdflatex_fun node = task.inputs[0] srcfile = n...
task.env.env = {'TEXINPUTS': sr2 + os.pathsep}
task.env.env = {} task.env.env.update(os.environ) task.env.env.update({'TEXINPUTS': sr2 + os.pathsep})
def tex_build(task, command='LATEX'): env = task.env bld = task.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') fun = latex_fun if command == 'PDFLATEX': fun = pdflatex_fun node = task.inputs[0] srcfile = n...
error('error when calling %s %s' % (command, latex_compile_cmd))
error('error when calling %s %s' % (command, task))
def tex_build(task, command='LATEX'): env = task.env bld = task.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') fun = latex_fun if command == 'PDFLATEX': fun = pdflatex_fun node = task.inputs[0] srcfile = n...
if not getattr(self, 'type', None) in ['latex', 'pdflatex']:
if not getattr(self, 'type', None) in ['latex', 'pdflatex', 'xelatex']:
def apply_tex(self): if not getattr(self, 'type', None) in ['latex', 'pdflatex']: self.type = 'pdflatex' tree = self.bld outs = Utils.to_list(getattr(self, 'outs', [])) # prompt for incomplete files (else the batchmode is used) self.env['PROMPT_LATEX'] = getattr(self, 'prompt', 1) deps_lst = [] if getattr(self, 'de...
for p in 'tex latex pdflatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split():
for p in 'tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split():
def configure(self): v = self.env for p in 'tex latex pdflatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split(): try: self.find_program(p, var=p.upper()) except self.errors.ConfigurationError: pass v['DVIPSFLAGS'] = '-Ppdf'
b('pdf2ps', '${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}', color='BLUE', after=["dvipdf", "pdflatex"], shell=False)
b('pdf2ps', '${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}', color='BLUE', after=["dvipdf", "xelatex", "pdflatex"], shell=False)
def configure(self): v = self.env for p in 'tex latex pdflatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split(): try: self.find_program(p, var=p.upper()) except self.errors.ConfigurationError: pass v['DVIPSFLAGS'] = '-Ppdf'
b('xelatex', xelatex_build, vars=xelatex_vardeps, scan=scan)
def configure(self): v = self.env for p in 'tex latex pdflatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split(): try: self.find_program(p, var=p.upper()) except self.errors.ConfigurationError: pass v['DVIPSFLAGS'] = '-Ppdf'
Enables the *in* syntax::
Enable the *in* syntax::
def __contains__(self, key): """ Enables the *in* syntax::
Dictionary interface: get value from key There is one gotcha: getitem returns [] if the contents evals to False This means:: env['foo'] = {}; print env['foo'] will print ``[]`` not ``{}``
Dictionary interface: get value from key:: def configure(conf): conf.env['foo'] = {} print(env['foo'])
def __getitem__(self, key): """ Dictionary interface: get value from key
Attribute access provided for convenience:: env.value == env['value']
Attribute access provided for convenience. The following forms are equivalent:: def configure(conf): conf.env.value conf.env['value']
def __getattr__(self, name): """ Attribute access provided for convenience:: env.value == env['value'] """ if name in self.__slots__: return object.__getattr__(self, name) else: return self[name]
Attribute access provided for convenience:: env.value = x corresponds to:: env['value'] = x
Attribute access provided for convenience. The following forms are equivalent:: def configure(conf): conf.env.value = x env['value'] = x
def __setattr__(self, name, value): """ Attribute access provided for convenience:: env.value = x
Attribute access provided for convenience:: del env.value corresponds to:: del env['value']
Attribute access provided for convenience. The following forms are equivalent:: def configure(conf): del env.value del env['value']
def __delattr__(self, name): """ Attribute access provided for convenience:: del env.value
from waflib.Task import ASK_LATER from waflib.Tools.c import c
def start(cwd, version, wafdir): # no script file here Logs.init_log() Context.waf_dir = wafdir Context.out_dir = Context.top_dir = Context.run_dir = cwd Context.g_module = imp.new_module('wscript') Context.g_module.root_path = cwd Context.Context.recurse = recurse_rep Context.g_module.configure = configure Context.g_...
class c2(c):
class c2(waflib.Tools.c.c):
def start(cwd, version, wafdir): # no script file here Logs.init_log() Context.waf_dir = wafdir Context.out_dir = Context.top_dir = Context.run_dir = cwd Context.g_module = imp.new_module('wscript') Context.g_module.root_path = cwd Context.Context.recurse = recurse_rep Context.g_module.configure = configure Context.g_...
ret = super(c, self).runnable_status()
ret = super(waflib.Tools.c.c, self).runnable_status()
def runnable_status(self): ret = super(c, self).runnable_status() self.more_tasks = []
if ret != ASK_LATER:
if ret != Task.ASK_LATER:
def runnable_status(self): ret = super(c, self).runnable_status() self.more_tasks = []
return super(c, self).runnable_status()
return super(waflib.Tools.c.c, self).runnable_status()
def runnable_status(self): ret = super(c, self).runnable_status() self.more_tasks = []
from waflib import TaskGen
def runnable_status(self): ret = super(c, self).runnable_status() self.more_tasks = []
v['fcshlib_FCFLAGS'] = ['-fpic'] v['fcshlib_LINKFLAGS'] = ['-shared']
v['FCFLAGS_fcshlib'] = ['-fpic'] v['LINKFLAGS_fcshlib'] = ['-shared']
def fc_flags(conf): v = conf.env v['FC_SRC_F'] = '' v['FC_TGT_F'] = ['-c', '-o', ''] v['FCINCPATH_ST'] = '-I%s' v['FCDEFINES_ST'] = '-D%s' if not v['LINK_FC']: v['LINK_FC'] = v['FC'] v['FCLNK_SRC_F'] = '' v['FCLNK_TGT_F'] = ['-o', ''] v['fcshlib_FCFLAGS'] = ['-fpic'] v['fcshlib_LINKFLAGS'] = ['-shared'] v[...
if self.generator.bld.get_dest_binfmt() == 'pe': lst = [x[1:].strip()[1:] for x in lst] elif self.generator.bld.get_dest_binfmt() == 'elf': lst = [x[1:].strip() for x in lst] else: raise NotImplemented return ' '.join(lst)
return lst != [] and '\n'.join(lst) or ''
def filter(self, x): lst = self.re_nm.findall(x) if self.generator.bld.get_dest_binfmt() == 'pe': lst = [x[1:].strip()[1:] for x in lst] #x is like "T _foo", but we need only "foo" elif self.generator.bld.get_dest_binfmt() == 'elf': lst = [x[1:].strip() for x in lst] else: raise NotImplemented return ' '.join(lst)
self.re_nm = re.compile(r'\|\s+_' + self.generator.export_symbols_regex + r'\b')
self.re_nm = re.compile(r'External\s+\|\s+_(' + self.generator.export_symbols_regex + r')\b')
def run(self): syms = [] for x in self.inputs: if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME): self.re_nm = re.compile(r'\|\s+_' + self.generator.export_symbols_regex + r'\b') s = self.filter(self.generator.bld.cmd_and_log(['dumpbin', '/symbols', x.abspath()], quiet=STDOUT)) else: if self.generator.bld.get_dest_bin...
self.re_nm = re.compile(r'T\s+_' + self.generator.export_symbols_regex + r'\b')
self.re_nm = re.compile(r'T\s+_(' + self.generator.export_symbols_regex + r')\b')
def run(self): syms = [] for x in self.inputs: if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME): self.re_nm = re.compile(r'\|\s+_' + self.generator.export_symbols_regex + r'\b') s = self.filter(self.generator.bld.cmd_and_log(['dumpbin', '/symbols', x.abspath()], quiet=STDOUT)) else: if self.generator.bld.get_dest_bin...
self.re_nm = re.compile(r'T\s+' + self.generator.export_symbols_regex + r'\b')
self.re_nm = re.compile(r'T\s+(' + self.generator.export_symbols_regex + r')\b')
def run(self): syms = [] for x in self.inputs: if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME): self.re_nm = re.compile(r'\|\s+_' + self.generator.export_symbols_regex + r'\b') s = self.filter(self.generator.bld.cmd_and_log(['dumpbin', '/symbols', x.abspath()], quiet=STDOUT)) else: if self.generator.bld.get_dest_bin...
syms.append(s)
s and syms.append(s)
def run(self): syms = [] for x in self.inputs: if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME): self.re_nm = re.compile(r'\|\s+_' + self.generator.export_symbols_regex + r'\b') s = self.filter(self.generator.bld.cmd_and_log(['dumpbin', '/symbols', x.abspath()], quiet=STDOUT)) else: if self.generator.bld.get_dest_bin...
tinfo = tar.gettarinfo(name=x.abspath(), arcname=self.get_base_name() + '/' + x.path_from(self.base_path))
tinfo = tar.gettarinfo(name=x.abspath(), arcname=self.get_tar_prefix() + '/' + x.path_from(self.base_path))
def archive(self): """ Create the archive (override or subclass) """ import tarfile
if hasattr(self, 'gir'):
if self.gir:
def run(self): env = self.env
if self.gir:
if valatask.gir:
def _get_api_version(): api_version = getattr (Context.g_module, 'API_VERSION', None) if api_version == None: version = Context.g_module.VERSION.split(".") if version[0] == "0": api_version = "0." + version[1] else: api_version = version[0] + ".0" return api_version
for x in self.dep_nodes: upd(x.get_bld_sig())
def sig_explicit_deps(self): bld = self.generator.bld upd = self.m.update
tarball = Context.g_module.dist(ctx)
def check(self): import tempfile, tarfile
path = appname + '-' + version instdir = tempfile.mkdtemp('.inst', '%s-%s' % (appname, version)) ret = subprocess.Popen([waf, 'configure', 'install', 'uninstall', '--destdir=' + instdir], cwd=path).wait()
instdir = tempfile.mkdtemp('.inst', self.get_base_name()) ret = subprocess.Popen([sys.argv[0], 'configure', 'install', 'uninstall', '--destdir=' + instdir], cwd=self.get_base_name()).wait()
def check(self): import tempfile, tarfile
shutil.rmtree(path)
shutil.rmtree(self.get_base_name())
def check(self): import tempfile, tarfile
opt.add_option('--dwidth', action='store', type='int', help='diagram width', default=5000, dest='dwidth')
opt.add_option('--dwidth', action='store', type='int', help='diagram width', default=500, dest='dwidth')
def options(opt): opt.add_option('--dtitle', action='store', default='Parallel build representation for %r' % ' '.join(sys.argv), help='title for the svg diagram', dest='dtitle') opt.add_option('--dwidth', action='store', type='int', help='diagram width', default=5000, dest='dwidth') opt.add_option('--dtime', action='s...
cls = Task.classes[name]
try: cls = Task.classes[name] except KeyError: return color2code['RED']
def map_to_color(name): if name in mp: return mp[name] cls = Task.classes[name] if cls.color in mp: return mp[cls.color] if cls.color in color2code: return color2code[cls.color] return color2code['RED']
self.taskinfo = Queue.Queue()
self.taskinfo = Queue()
self.bld.fatal('use def options(opt): opt.load("parallel_debug")!')
info.sort(cmp= lambda x, y: cmp(x[0], y[0]))
info.sort(key=lambda x: x[0])
def process_colors(producer): # first, cast the parameters tmp = [] try: while True: tup = producer.taskinfo.get(False) tmp.append(list(tup)) except: pass try: ini = float(tmp[0][2]) except: return if not info: seen = [] for x in tmp: name = x[3] if not name in seen: seen.append(name) else: continue info.append((nam...
if Options.platform == 'darwin': conf.check_tool('osx')
def check_python_headers(conf): """Check for headers and libraries necessary to extend or embed python. On success the environment variables xxx_PYEXT and xxx_PYEMBED are added for uselib PYEXT: for compiling python extensions PYEMBED: for embedding a python interpreter""" if not conf.env['CC_NAME'] and not conf.env...
basedir = self.path.find_dir(basedir)
basedir = self.path.get_bld().make_node(basedir)
def jar_files(self): destfile = getattr(self, 'destfile', 'test.jar') jaropts = getattr(self, 'jaropts', []) jarcreate = getattr(self, 'jarcreate', 'cf') basedir = getattr(self, 'basedir', None) if basedir: if not isinstance(self.basedir, Node.Node): basedir = self.path.find_dir(basedir) else: basedir = self.path.find...
basedir = self.path.find_dir(basedir) if not basedir: self.bld.fatal('Could not find the basedir %r for %r' % (self.basedir, self))
basedir = self.path.get_bld() if not basedir: self.bld.fatal('Could not find the basedir %r for %r' % (self.basedir, self))
def jar_files(self): destfile = getattr(self, 'destfile', 'test.jar') jaropts = getattr(self, 'jaropts', []) jarcreate = getattr(self, 'jarcreate', 'cf') basedir = getattr(self, 'basedir', None) if basedir: if not isinstance(self.basedir, Node.Node): basedir = self.path.find_dir(basedir) else: basedir = self.path.find...
tsk.basedir = srcdir_node
tsk.basedir = basedir
def jar_files(self): destfile = getattr(self, 'destfile', 'test.jar') jaropts = getattr(self, 'jaropts', []) jarcreate = getattr(self, 'jarcreate', 'cf') basedir = getattr(self, 'basedir', None) if basedir: if not isinstance(self.basedir, Node.Node): basedir = self.path.find_dir(basedir) else: basedir = self.path.find...
jaropts.append(srcdir_node.get_bld().bldpath())
jaropts.append(basedir.bldpath())
def jar_files(self): destfile = getattr(self, 'destfile', 'test.jar') jaropts = getattr(self, 'jaropts', []) jarcreate = getattr(self, 'jarcreate', 'cf') basedir = getattr(self, 'basedir', None) if basedir: if not isinstance(self.basedir, Node.Node): basedir = self.path.find_dir(basedir) else: basedir = self.path.find...
if not find_valac(self, 'valac-%d.%d' % (branch[0], branch[1]), min_version):
try: find_valac(self, 'valac-%d.%d' % (branch[0], branch[1]), min_version) except self.errors.ConfigurationError:
def check_vala(self, min_version=(0,8,0), branch=None): """ Check if vala compiler from a given branch exists of at least a given version. """ if not branch: branch = min_version[:2] if not find_valac(self, 'valac-%d.%d' % (branch[0], branch[1]), min_version): # Try again with the unversioned name find_valac(self, 'val...
You may want to use
You may want to use this to force a particular minimum version:
def configure(self): """ You may want to use conf.load('vala', funs='') conf.check_vala(min_version=(0,10,0)) """ self.load('gnu_dirs') self.check_vala_deps() self.check_vala()
lst.append('-outputresource:%s;%s' % (outfile, mode)))
lst.append('-outputresource:%s;%s' % (outfile, mode))
def exec_mf(self): """ Create the manifest file """ env = self.env mtool = env['MT'] if not mtool: return 0 self.do_manifest = False outfile = self.outputs[0].abspath() manifest = None for out_node in self.outputs: if out_node.name.endswith('.manifest'): manifest = out_node.abspath() break if manifest is None: # Sho...
for vcver,vcvar in [('VCExpress','exp'), ('VisualStudio','')]: try: all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\'+vcver)
for vcver,vcvar in [('VCExpress','Exp'), ('VisualStudio','')]: try: prefix = 'SOFTWARE\\Wow6432node\\Microsoft\\'+vcver all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, prefix)
def gather_msvc_versions(conf, versions): """checks SmartPhones SDKs""" try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs') exce...
all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\'+vcver)
prefix = 'SOFTWARE\\Microsoft\\'+vcver all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, prefix)
def gather_msvc_versions(conf, versions): """checks SmartPhones SDKs""" try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs') exce...
try: msvc_version = _winreg.OpenKey(all_versions, version + "\\Setup\\VS") path,type = _winreg.QueryValueEx(msvc_version, 'ProductDir') path=str(path) targets = [] if ce_sdk: for device,platforms in supported_wince_platforms: cetargets = [] for platform,compiler,include,lib in platforms: winCEpath = os.path.join(path, ...
if version.endswith('Exp'): versionnumber = float(version[:-3]) else: versionnumber = float(version) detected_versions.append((versionnumber, version, prefix+"\\"+version)) detected_versions.sort(key = lambda (x,y,z):x) for (v,version,reg) in detected_versions: try: msvc_version = _winreg.OpenKey(_winreg.HKEY_LOCAL_MAC...
def gather_msvc_versions(conf, versions): """checks SmartPhones SDKs""" try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs') exce...
targets.append(('x86', ('x86', conf.get_msvc_version('msvc', version, 'x86', os.path.join(path, 'Common7', 'Tools', 'vsvars32.bat'))))) except conf.errors.ConfigurationError:
targets.append((target, (realtarget, conf.get_msvc_version('msvc', version, target, os.path.join(path, 'VC', 'vcvarsall.bat'))))) except:
def gather_msvc_versions(conf, versions): """checks SmartPhones SDKs""" try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs') exce...
versions.append(('msvc '+version, targets)) except WindowsError: continue
elif os.path.isfile(os.path.join(path, 'Common7', 'Tools', 'vsvars32.bat')): try: targets.append(('x86', ('x86', conf.get_msvc_version('msvc', version, 'x86', os.path.join(path, 'Common7', 'Tools', 'vsvars32.bat'))))) except conf.errors.ConfigurationError: pass versions.append(('msvc '+version, targets)) except Window...
def gather_msvc_versions(conf, versions): """checks SmartPhones SDKs""" try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs') exce...
conf.gather_wsdk_versions(lst) conf.gather_icl_versions(lst)
def get_msvc_versions(conf): if not conf.env['MSVC_INSTALLED_VERSIONS']: lst = [] conf.gather_msvc_versions(lst) conf.gather_wsdk_versions(lst) conf.gather_icl_versions(lst) conf.env['MSVC_INSTALLED_VERSIONS'] = lst return conf.env['MSVC_INSTALLED_VERSIONS']
if "Changed but not updated" in output:
if commands.getstatusoutput("git status --porcelain")[1]:
def checkForUnsavedChanges(self): output = self.checkForRepository() if "Changed but not updated" in output: print "WARNING: changes have been made to source code!" print " use git stash or git commit to save changes" quit() else: return
self.username = person.sfullname.contents[0]
self.username = person.sfullname.contents[0].encode('utf-8')
def login(self): self.email = self.getCredentials()['email'] #self.username = self.getCredentials()['username'] password = "" while True: if not password: import getpass password = getpass.getpass("FogBugz password: ") else: break #connect to fogbugz with fbapi and login self.fbConnection.logon(self.email, password) ...
url = urllib2.unquote(url)
def __fetch(self, url, method="get", post_data = False, referrer = False): """hidden, called from get() or post()""" # TODO # http_proxy=http://localhost:8118 <-- not needed yet # auto-follow location headers (see curl -e)
cx.execute(self.id + '.' + name + '=function(){' + val + '}')
vals = re.split('(?<=[^a-zA-Z0-9_])this(?=[^a-zA-Z0-9_])', val) valstmp = re.split('^this(?=[^a-zA-Z0-9_])', vals[0]) if len(vals) > 1: vals = valstmp+vals[1:] valstmp = re.split('(?<=[^a-zA-Z0-9_])this$', vals[-1]) if len(vals) > 1: vals = vals[:-1]+valstmp val = self.id.join(vals) cx.execute(self.id + '.' + name + 't...
def __setattr__(self, name, val): if name == 'id' or name == 'name': self.__dict__[name] = val val = val.replace(':','_').replace('-','_') try: if self.__dict__['__window'].__dict__['__cx'].execute('typeof ' + val + ' == "undefined"'): self.__dict__['__window'].__dict__['__cx'].add_global(val, self) except: pass
pass
traceback.print_exc()
def __setattr__(self, name, val): if name == 'id' or name == 'name': self.__dict__[name] = val val = val.replace(':','_').replace('-','_') try: if self.__dict__['__window'].__dict__['__cx'].execute('typeof ' + val + ' == "undefined"'): self.__dict__['__window'].__dict__['__cx'].add_global(val, self) except: pass
def __init__(self, algorithn=None, algorithm=None, valueOf_=''): self.algorithn = _cast(None, algorithn)
def __init__(self, algorithm=None, valueOf_=''):
def __init__(self, algorithn=None, algorithm=None, valueOf_=''): self.algorithn = _cast(None, algorithn) self.algorithm = _cast(None, algorithm) self.valueOf_ = valueOf_
def get_algorithn(self): return self.algorithn def set_algorithn(self, algorithn): self.algorithn = algorithn
def get_algorithn(self): return self.algorithn
if self.algorithn is not None: outfile.write(' algorithn=%s' % (quote_attrib(self.algorithn), ))
def exportAttributes(self, outfile, level, namespace_='', name_='hash'): if self.algorithn is not None: outfile.write(' algorithn=%s' % (quote_attrib(self.algorithn), )) if self.algorithm is not None: outfile.write(' algorithm=%s' % (quote_attrib(self.algorithm), ))
if self.algorithn is not None: showIndent(outfile, level) outfile.write('algorithn = %s,\n' % (self.algorithn,))
def exportLiteralAttributes(self, outfile, level, name_): if self.algorithn is not None: showIndent(outfile, level) outfile.write('algorithn = %s,\n' % (self.algorithn,)) if self.algorithm is not None: showIndent(outfile, level) outfile.write('algorithm = %s,\n' % (self.algorithm,))
if attrs.get('algorithn'): self.algorithn = attrs.get('algorithn').value
def buildAttributes(self, attrs): if attrs.get('algorithn'): self.algorithn = attrs.get('algorithn').value if attrs.get('algorithm'): self.algorithm = attrs.get('algorithm').value
self.__dict__[sEvent] = fpNotify
self.__dict__[type] = listener
def addEventListener(self, type, listener, useCapture = False): if dataetc.isevent(type, 'window'): self.__dict__[sEvent] = fpNotify
Extension("libemu_module", ["libemu_module.c"],**pkgconfig('libemu')),
Extension("libemu", ["libemu_module.c"],**pkgconfig('libemu')),
def pkgconfig(*packages, **kw): flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'} for token in commands.getoutput("pkg-config --libs --cflags %s" % ' '.join(packages)).split(): kw.setdefault(flag_map.get(token[:2]), []).append(token[2:]) return kw
config.VERBOSE(config.VERBOSE_DETAIL, str(html))
config.VERBOSE(config.VERBOSE_DETAIL, html)
def write(self, html): config.VERBOSE(config.VERBOSE_DEBUG, '[DEBUG] in Document.py Document.write(ln)...') config.VERBOSE(config.VERBOSE_DETAIL, str(html)) if 'parser' not in self.contentWindow.__dict__['__sl'][-1].__dict__: self.contentWindow.__dict__['__sl'][-1].parser = \ PageParser(self.contentWindow, self.content...
options, args = getopt.getopt(args, 'hu:l:vd:rc',
options, args = getopt.getopt(args, 'hu:l:vd:rcn',
def report(alerts): for alert in alerts: print "\n====================================" if alert.atype == "ALERT_SHELLCODE": print "|--------AID:" + str(alert.aid) + "----------" print "|ATYPE:" + str(alert.atype) print "|MESSAGE:" + str(alert.msg) print "|MISC:" + str(alert.misc) print "|LENGTH:" ...
dev = self.end - self.begin - 1 - len(val)
dev = self.end - self.begin - len(val) print '[[[[[[[[[[[[[[]]]]]]]]]]]]]]'+str(dev)
def __setattr__(self, name, val): if name == 'id' or name == 'name': self.__dict__[name] = val val = val.replace(':','_').replace('-','_') try: if self.__dict__['__window'].__dict__['__cx'].execute('typeof ' + val + ' == "undefined"'): self.__dict__['__window'].__dict__['__cx'].add_global(val, self) except: pass
if i.end > self.end:
if i.end >= self.end:
def __setattr__(self, name, val): if name == 'id' or name == 'name': self.__dict__[name] = val val = val.replace(':','_').replace('-','_') try: if self.__dict__['__window'].__dict__['__cx'].execute('typeof ' + val + ' == "undefined"'): self.__dict__['__window'].__dict__['__cx'].add_global(val, self) except: pass
if 'onload' in window.__dict__: try: window.__dict__['__cx'].execute(str(window.onload)) except: print window.onload traceback.print_exc()
def parse(self): top_window = Window(self, self.url, False) parser = PageParser(top_window, top_window.document, top_window.__dict__['__html']) parser.close()
if 'onunload' in window.__dict__: try: window.__dict__['__cx'].execute(str(window.onunload)) except: print window.onunload traceback.print_exc()
def parse(self): top_window = Window(self, self.url, False) parser = PageParser(top_window, top_window.document, top_window.__dict__['__html']) parser.close()
domobj.begin = self.current
domobj.begin = self.current domobj.end = self.current + self.html.lower()[self.current:].index('</'+tag)
def unknown_starttag(self, tag, attrs): if config.verboselevel >= config.VERBOSE_DEBUG: print "[DEBUG] in PageParser.py Parsing... Got Tag "+tag if self.endearly: return domobj = DOMObject(self.__dict__['__window'], tag, self) #sometimes k in tag is not really attrname, so a transform is needed. #note that this is IE ...
ret = self.__dict__['__cx'].execute(self.__dict__['__cx'].patch_script(self.__dict__['__cx'].script))
ret = self.__dict__['__cx'].execute(self.__dict__['__cx'].patch_script(script))
def eval(self, script): config.VERBOSE(config.VERBOSE_DEBUG, "[DEBUG] Got eval, evaling...") config.VERBOSE(config.VERBOSE_DETAIL, str(script)) if not type(script) in types.StringTypes: return script try: ret = self.__dict__['__cx'].execute(self.__dict__['__cx'].patch_script(self.__dict__['__cx'].script)) return ret ex...
base_path_split = base_path.strip().split('/')
base_path_split = base_path.strip().split('/')[:-1]
def fix_url(self, url): base = self.__dict__['__document'].URL base_scheme, base_netloc, base_path, base_query, base_fragment = urlparse.urlsplit(base) # fix up relative URLs to absolute URLs scheme, netloc, path, query, fragment = urlparse.urlsplit(url) if scheme not in ('http', 'https'): if url.startswith('/'): url ...
f = 'function(){' + element + '}'
f = element
def do_execute(self, window, parser, element): f = 'function(){' + element + '}'
parser.add_option('--cpu', default=None, dest='cpu') parser.add_option('--platform', default=None, dest='platform') parser.add_option('-L', '--lib', action="append", default=[], dest='lib') parser.add_option('-I', '--include', action="append", default=[], dest='include')
parser.add_option('--cpu', default=None, dest='cpu', help='specifying the cpu activates the assembly opcodes for the given cpu.\n' 'you probably want to specify a platform instead if you are coding for\n' 'a specific machine. if you want to just create a generic binary for\n' 'a given cpu, then this is the option for ...
def __init__(self): self._options = None self._args = None
e.append(('type', Type.exprs()))
def first_exprs(klass): e = [] e.append(('return', FunctionReturn.exprs())) e.append(('enum', Enum.exprs())) e.append(('label', Label.exprs())) e.append(('typedef', Typedef.exprs())) e.append(('variable', Variable.exprs())) e.append(('struct', Struct.exprs())) e.append(('function', Function.exprs())) e.append(('functio...
rel = Group(Optional(Suppress('*')) + \
rel = Group(Suppress('*') + \
def exprs(klass): ops = Session().opcodes() kws = Session().keywords() conds = Session().conditions() variable_ref = Group(delimitedList(Name.exprs(), '.'))
version = '@VERSION@'
version = '@GAMMU_VERSION@'
def gammu_process_link(self, env, refnode, has_explicit_title, title, target): program = env.temp_data.get('std:program') if not has_explicit_title: if ' ' in title and not (title.startswith('/') or title.startswith('-')): program, target = re.split(' (?=-|--|/)?', title, 1) program = sphinx.domains.std.ws_re.sub('-', ...
_RL_STATUS[0] = True
def _init_runloop(): # Check the Run-Loop status _RL_STATUS_LOCK.acquire(True) try: # Set "should-run" to True _RL_STATUS[0] = True # Check if the thread is started and start it if not _RL_STATUS[1]: createthread(_runloop_main) _RL_STATUS[1] = True finally: _RL_STATUS_LOCK.release()
if "_orig_getruntime" not in _context: _orig_getruntime = getruntime
_orig_getruntime = getruntime
def _noop(*args,**kwargs): return True
PRINT_LOCK.acquire()
PRINT_LOCK.acquire(True)
def traced_call(self,name,func,args,kwargs,no_return=False,print_args=True,print_result=True): # Store the time, function call and arguments call_string = str(getruntime()) + " " + name # Print the optional stuff if not self is None: call_string += " " + str(self) if print_args and not args == (): str_args = str(args)...
PRINT_LOCK.acquire() print call_string,"->",str(e)
PRINT_LOCK.acquire(True) print call_string,"->",str(type(e))+" "+str(e)
def traced_call(self,name,func,args,kwargs,no_return=False,print_args=True,print_result=True): # Store the time, function call and arguments call_string = str(getruntime()) + " " + name # Print the optional stuff if not self is None: call_string += " " + str(self) if print_args and not args == (): str_args = str(args)...
def willblock(self,*args,**kwargs): return traced_call(self.sock,"socket.willblock",self.sock.willblock,args,kwargs)
def willblock(self,*args,**kwargs): return traced_call(self.sock,"socket.willblock",self.sock.willblock,args,kwargs)
def flush(self,*args,**kwargs): return traced_call(self.fileo,"file.flush",self.fileo.flush,args,kwargs,True) def next(self,*args,**kwargs): return traced_call(self.fileo,"file.next",self.fileo.next,args,kwargs) def read(self,*args,**kwargs): return traced_call(self.fileo,"file.read",self.fileo.read,args,kwargs) def...
def readat(self,*args,**kwargs): return traced_call(self.fileo,"file.readat",self.fileo.readat,args,kwargs) def writeat(self,*args,**kwargs): return traced_call(self.fileo,"file.writeat",self.fileo.writeat,args,kwargs,True)
def flush(self,*args,**kwargs): return traced_call(self.fileo,"file.flush",self.fileo.flush,args,kwargs,True)
def wrapped_openconn(*args, **kwargs):
class TCPServerObj(): def __init__(self,sock): self.sock = sock def getconnection(self, *args,**kwargs): ip,port,conn = traced_call(self.sock,"TCPServerSocket.getconnection",self.sock.getconnection,args,kwargs) return (ip,port, SocketObj(conn)) def close(self, *args, **kwargs): return traced_call(self.sock,"TCPServ...
def evaluate(self,*args,**kwargs): return traced_call(self.virt,"VirtualNamespace.evaluate",self.virt.evaluate,args,kwargs,print_args=False,print_result=False)
sock = traced_call(None,"openconn",openconn,args,kwargs)
sock = traced_call(None,"openconnection",openconnection,args,kwargs)
def wrapped_openconn(*args, **kwargs): # Trace the call sock = traced_call(None,"openconn",openconn,args,kwargs) # Wrap the socket object return SocketObj(sock)
def wrapped_waitforconn(*args, **kwargs): try: callback = args[2] except: callback = None def _wrapped_callback(*args,**kwargs): socket = SocketObj(args[2]) args = args[0:2] + (socket,) + args[3:] traced_call(callback, "new incoming conn.",callback,args,kwargs,True) args = args[0:2] + (_wrapped_callback,) r...
def wrapped_listenformessage(*args, **kwargs): sock = traced_call(None, "listenformessage", listenformessage, args, kwargs) return UDPServerObj(sock) def wrapped_listenforconnection(*args, **kwargs): sock = traced_call(None, "listenforconnection", listenforconnection, args, kwargs) return TCPServerObj(sock) ...
def wrapped_openconn(*args, **kwargs): # Trace the call sock = traced_call(None,"openconn",openconn,args,kwargs) # Wrap the socket object return SocketObj(sock)
lock = traced_call(None,"getlock",getlock,args,kwargs)
lock = traced_call(None,"createlock",createlock,args,kwargs)
def wrapped_getlock(*args,**kwargs): # Trace the call to get the lock lock = traced_call(None,"getlock",getlock,args,kwargs) # Return the wrapped lock return LockObj(lock)
def wrapped_open(*args,**kwargs):
def wrapped_openfile(*args,**kwargs):
def wrapped_getlock(*args,**kwargs): # Trace the call to get the lock lock = traced_call(None,"getlock",getlock,args,kwargs) # Return the wrapped lock return LockObj(lock)
fileo = traced_call(None,"open",open,args,kwargs)
fileo = traced_call(None,"openfile",openfile,args,kwargs)
def wrapped_open(*args,**kwargs): # Trace the call to get the file object fileo = traced_call(None,"open",open,args,kwargs) # Return the wrapped object return FileObj(fileo)
return VNObj(traced_call(None,"VirtualNamespace(...)",VirtualNamespace,args,kwargs,print_args=False))
return VNObj(traced_call(None,"VirtualNamespace(...)",createvirtualnamespace,args,kwargs,print_args=False))
def wrapped_virtual_namespace(*args,**kwargs): # Trace the call to get the object return VNObj(traced_call(None,"VirtualNamespace(...)",VirtualNamespace,args,kwargs,print_args=False))
CHILD_CONTEXT["openconn"] = wrapped_openconn CHILD_CONTEXT["waitforconn"] = wrapped_waitforconn CHILD_CONTEXT["recvmess"] = wrapped_recvmess CHILD_CONTEXT["getlock"] = wrapped_getlock CHILD_CONTEXT["open"] = wrapped_open CHILD_CONTEXT["VirtualNamespace"] = wrapped_virtual_namespace if callfunc == "initiali...
CHILD_CONTEXT["openconnection"] = wrapped_openconnection CHILD_CONTEXT["listenformessage"] = wrapped_listenformessage CHILD_CONTEXT["listenforconnection"] = wrapped_listenforconnection CHILD_CONTEXT["createlock"] = wrapped_createlock CHILD_CONTEXT["openfile"] = wrapped_openfile CHILD_CONTEXT["createvirtualnam...
def wrap_all(): # Handle the normal calls for call in NON_OBJ_API_CALLS: CHILD_CONTEXT[call] = NonObjAPICall(call).call # Wrap openconn CHILD_CONTEXT["openconn"] = wrapped_openconn # Wrap waitforconn CHILD_CONTEXT["waitforconn"] = wrapped_waitforconn # Wrap recvmess CHILD_CONTEXT["recvmess"] = wrapped_recvmess # Wr...
auth_header = resp.getheader('www-authenticate', '') if auth_header: if self._authenticate(auth_header, headers, credentials): resp.read() resp = _try_request() status = resp.status
authorization = basic_auth(credentials) if authorization: resp.read() headers['Authorization'] = authorization resp = _try_request() status = resp.status
def _retry(): conn.close() conn.connect() return _try_request(retries - 1)
def _authenticate(self, info, headers, credentials): match = re.match(r'''(\w*)\s+realm=['"]([^'"]+)['"]''', info) if match: scheme, realm = match.groups() if scheme.lower() == 'basic': headers['Authorization'] = 'Basic %s' % b64encode( '%s:%s' % credentials ) return True
def _authenticate(self, info, headers, credentials): # Naive Basic authentication support match = re.match(r'''(\w*)\s+realm=['"]([^'"]+)['"]''', info) if match: scheme, realm = match.groups() if scheme.lower() == 'basic': headers['Authorization'] = 'Basic %s' % b64encode( '%s:%s' % credentials ) return True
return datetime.strptime(i[1][1]['Date'][5:-4], '%d %b %Y %H:%M:%S')
t = time.mktime(time.strptime(i[1][1]['Date'][5:-4], '%d %b %Y %H:%M:%S')) return datetime.fromtimestamp(t)
def cache_sort(i): return datetime.strptime(i[1][1]['Date'][5:-4], '%d %b %Y %H:%M:%S')
return datetime.strptime(i[1][1]['Date'][5:-4], '%m %b %Y %H:%M:%S')
return datetime.strptime(i[1][1]['Date'][5:-4], '%d %b %Y %H:%M:%S')
def cache_sort(i): return datetime.strptime(i[1][1]['Date'][5:-4], '%m %b %Y %H:%M:%S')
def info(self): """Return information about the database as a dictionary.
def info(self, ddoc=None): """Return information about the database or design document as a dictionary. Without an argument, returns database information. With an argument, return information for the given design document.
def info(self): """Return information about the database as a dictionary.
a ``GET`` request on the database URI.
a ``GET`` request on the database or design document's info URI.
def info(self): """Return information about the database as a dictionary.