def SetPortableUrl(json_dict, shortname, filepath): json_dict['portable'] = {} json_dict['portable']['pnacl-translate'] = {} json_dict['portable']['pnacl-translate']['url'] = shortname fd = DriverOpen(filepath, 'r') sha = hashlib.sha256() sha.update(fd.read()) fd.close() json_dict['portable']['pnacl-translate']['sha256'] = sha.hexdigest()
def SetPortableUrl(json_dict, shortname, filepath): json_dict['portable'] = {} json_dict['portable']['pnacl-translate'] = {} json_dict['portable']['pnacl-translate']['url'] = shortname fd = DriverOpen(filepath, 'r') sha = hashlib.sha256() sha.update(fd.read()) fd.close() json_dict['portable']['pnacl-translate']['sha256'] = sha.hexdigest()
def DoExpandCommandFile(argv, i): arg = argv[i] fd = DriverOpen(pathtools.normalize(arg[1:]), 'r') more_args = [] # Use shlex here to process the response file contents. # This ensures that single and double quoted args are # handled correctly. Since this file is very likely # to contain paths with windows path seperators we can't # use the normal shlex.parse() since we need to disable # disable '\' (the default escape char). for line in fd: lex = shlex.shlex(line, posix=True) lex.escape = '' lex.whitespace_split = True more_args += list(lex) fd.close() argv = argv[:i] + more_args + argv[i+1:] return argv
def DoExpandCommandFile(argv, i): arg = argv[i] fd = DriverOpen(pathtools.normalize(arg[1:]), 'r') more_args = [] # Use shlex here to process the response file contents. # This ensures that single and double quoted args are # handled correctly. Since this file is very likely # to contain paths with windows path seperators we can't # use the normal shlex.parse() since we need to disable # disable '\' (the default escape char). for line in fd: lex = shlex.shlex(line, posix=True) lex.escape = '' lex.whitespace_split = True more_args += list(lex) fd.close() argv = argv[:i] + more_args + argv[i+1:] return argv
def ReadBaselineNMF(baseline_file): f = DriverOpen(baseline_file, 'r') json_dict = json.load(f) f.close() return json_dict
def ReadBaselineNMF(baseline_file): f = DriverOpen(baseline_file, 'r') json_dict = json.load(f) f.close() return json_dict