bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
|
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
| 476,300
|
def Analyze(self, check_sanity=False): # Glob all the results files in the "testing.tmp" directory filenames = glob.glob(self.TMP_DIR + "/*/results.txt")
|
def Analyze(self, check_sanity=False): # Glob all the results files in the "testing.tmp" directory filenames = glob.glob(self.TMP_DIR + "/*/results.txt")
| 476,301
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_NPAPI_FILENAME = FLAGS.set_npapi_filename O3D_PLUGIN_NPAPI_MIMETYPE = FLAGS.set_npapi_mimetype O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID = FLAGS.set_activex_hostcontrol_clsid O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID = FLAGS.set_activex_typelib_clsid O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME = FLAGS.set_activex_hostcontrol_name O3D_PLUGIN_ACTIVEX_TYPELIB_NAME = FLAGS.set_activex_typelib_name if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
| 476,302
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginNpapiFilename@@@', O3D_PLUGIN_NPAPI_FILENAME), ('@@@PluginNpapiMimeType@@@', O3D_PLUGIN_NPAPI_MIMETYPE), ('@@@PluginActiveXHostControlClsid@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID), ('@@@PluginActiveXTypeLibClsid@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID), ('@@@PluginActiveXHostControlName@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME), ('@@@PluginActiveXTypeLibName@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_NAME), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
| 476,303
|
def ApplyDirectoryRules(existing_rules, dir_name): """Combines rules from the existing rules and the new directory. Any directory can contain a DEPS file. Toplevel DEPS files can contain module dependencies which are used by gclient. We use these, along with additional include rules and implicit rules for the given directory, to come up with a combined set of rules to apply for the directory. Args: existing_rules: The rules for the parent directory. We'll add-on to these. dir_name: The directory name that the deps file may live in (if it exists). This will also be used to generate the implicit rules. Returns: A tuple containing: (1) the combined set of rules to apply to the sub-tree, and (2) a list of all subdirectories that should NOT be checked, as specified in the DEPS file (if any). """ # Check for a .svn directory in this directory. This will tell us if it's # a source directory and should be checked. if not os.path.exists(os.path.join(dir_name, ".svn")): return (None, []) # Check the DEPS file in this directory. if VERBOSE: print "Applying rules from", dir_name def FromImpl(unused): pass # NOP function so "From" doesn't fail. class _VarImpl: def __init__(self, local_scope): self._local_scope = local_scope def Lookup(self, var_name): """Implements the Var syntax.""" if var_name in self._local_scope.get("vars", {}): return self._local_scope["vars"][var_name] raise Error("Var is not defined: %s" % var_name) local_scope = {} global_scope = {"From": FromImpl, "Var": _VarImpl(local_scope).Lookup} deps_file = os.path.join(dir_name, "DEPS") if os.path.exists(deps_file): execfile(deps_file, global_scope, local_scope) elif VERBOSE: print " No deps file found in", dir_name # Even if a DEPS file does not exist we still invoke ApplyRules # to apply the implicit "allow" rule for the current directory deps = local_scope.get(DEPS_VAR_NAME, {}) include_rules = local_scope.get(INCLUDE_RULES_VAR_NAME, []) skip_subdirs = local_scope.get(SKIP_SUBDIRS_VAR_NAME, []) return (ApplyRules(existing_rules, deps, include_rules, dir_name), skip_subdirs)
|
def ApplyDirectoryRules(existing_rules, dir_name): """Combines rules from the existing rules and the new directory. Any directory can contain a DEPS file. Toplevel DEPS files can contain module dependencies which are used by gclient. We use these, along with additional include rules and implicit rules for the given directory, to come up with a combined set of rules to apply for the directory. Args: existing_rules: The rules for the parent directory. We'll add-on to these. dir_name: The directory name that the deps file may live in (if it exists). This will also be used to generate the implicit rules. Returns: A tuple containing: (1) the combined set of rules to apply to the sub-tree, and (2) a list of all subdirectories that should NOT be checked, as specified in the DEPS file (if any). """ # Check for a .svn directory in this directory. This will tell us if it's # a source directory and should be checked. if not os.path.exists(os.path.join(dir_name, ".svn")): return (None, []) # Check the DEPS file in this directory. if VERBOSE: print "Applying rules from", dir_name def FromImpl(unused): pass # NOP function so "From" doesn't fail. class _VarImpl: def __init__(self, local_scope): self._local_scope = local_scope def Lookup(self, var_name): """Implements the Var syntax.""" if var_name in self._local_scope.get("vars", {}): return self._local_scope["vars"][var_name] raise Error("Var is not defined: %s" % var_name) local_scope = {} global_scope = {"From": FromImpl, "Var": _VarImpl(local_scope).Lookup} deps_file = os.path.join(dir_name, "DEPS") if os.path.exists(deps_file): execfile(deps_file, global_scope, local_scope) elif VERBOSE: print " No deps file found in", dir_name # Even if a DEPS file does not exist we still invoke ApplyRules # to apply the implicit "allow" rule for the current directory deps = local_scope.get(DEPS_VAR_NAME, {}) include_rules = local_scope.get(INCLUDE_RULES_VAR_NAME, []) skip_subdirs = local_scope.get(SKIP_SUBDIRS_VAR_NAME, []) return (ApplyRules(existing_rules, deps, include_rules, dir_name), skip_subdirs)
| 476,304
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars. The files are created on the fly and cleaned after use. """ download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
| 476,305
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
| 476,306
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
| 476,307
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
|
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
| 476,308
|
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
|
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
| 476,309
|
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
|
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
| 476,310
|
def __init__(self, options): self._options = options
|
def __init__(self, options): self._options = options
| 476,311
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = json.dumps(server_data) debug('sending server_data: %s' % server_data_json) server_data_len = len(server_data_json) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,312
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = json.dumps(server_data) debug('sending server_data: %s' % server_data_json) server_data_len = len(server_data_json) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = json.dumps(server_data) debug('sending server_data: %s' % server_data_json) server_data_len = len(server_data_json) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,313
|
def TryKillingOldServer(port): # Note that an HTTP /kill request to the FTP server has the effect of # killing it. for protocol in ["http", "https"]: try: urllib2.urlopen("%s://localhost:%d/kill" % (protocol, port)).read() print "Killed old server instance on port %d (via %s)" % (port, protocol) except urllib2.URLError: # Common case, indicates no server running. pass
|
def TryKillingOldServer(port): # Note that an HTTP /kill request to the FTP server has the effect of # killing it. for protocol in ["http", "https"]: try: urllib2.urlopen("%s://localhost:%d/kill" % (protocol, port)).read() print "Killed old server instance on port %d (via %s)" % (port, protocol) except urllib2.URLError: # Common case, indicates no server running. pass
| 476,314
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port # Try to free up the port if there's an orphaned old instance. TryKillingOldServer(port) if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified cert file not found: ' + options.cert + ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None MakeDumpDir(server.data_dir) # means FTP Server else: my_data_dir = MakeDataDir() def line_logger(msg): if (msg.find("kill") >= 0): server.stop = True print 'shutting down server' sys.exit(0) # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer pyftpdlib.ftpserver.logline = line_logger # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port # Try to free up the port if there's an orphaned old instance. TryKillingOldServer(port) if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified cert file not found: ' + options.cert + ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None MakeDumpDir(server.data_dir) # means FTP Server else: my_data_dir = MakeDataDir() def line_logger(msg): if (msg.find("kill") >= 0): server.stop = True print 'shutting down server' sys.exit(0) # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer pyftpdlib.ftpserver.logline = line_logger # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,315
|
def CombineLibraries(output, remove_re, inputs): '''Combines all the libraries and objects in inputs, while removing any object files that match remove_re. ''' removals = [] if remove_re: removals = CollectRemovals(remove_re, inputs) print removals args = ['lib.exe', '/out:%s' % output] args += ['/remove:%s' % obj for obj in removals] args += inputs Shell(*args)
|
def CombineLibraries(output, remove_re, inputs): '''Combines all the libraries and objects in inputs, while removing any object files that match remove_re. ''' removals = [] if remove_re: removals = CollectRemovals(remove_re, inputs) print removals args = ['lib.exe', '/out:%s' % output] args += ['/remove:%s' % obj for obj in removals] args += inputs Shell(*args)
| 476,316
|
def Main(): '''Main function for this script''' parser = GetOptionParser() (opt, args) = parser.parse_args() output = opt.output remove = opt.remove if not output: parser.error('You must specify an output file') if not args: parser.error('You must specify at least one object or library') output = output.strip() remove = remove.strip() if remove: try: remove_re = re.compile(opt.remove) except: parser.error('%s is not a valid regular expression' % opt.remove) else: remove_re = None if sys.platform != 'win32': parser.error('this script only works on Windows for now') # If this is set, we can't capture lib.exe's output. if 'VS_UNICODE_OUTPUT' in os.environ: del os.environ['VS_UNICODE_OUTPUT'] CombineLibraries(output, remove_re, args)
|
def Main(): '''Main function for this script''' parser = GetOptionParser() (opt, args) = parser.parse_args() output = opt.output remove = opt.remove if not output: parser.error('You must specify an output file') if not args: parser.error('You must specify at least one object or library') output = output.strip() remove = remove.strip() if remove: try: remove_re = re.compile(opt.remove) except: parser.error('%s is not a valid regular expression' % opt.remove) else: remove_re = None if sys.platform != 'win32' and sys.platform != 'cygwin': parser.error('this script only works on Windows for now') # If this is set, we can't capture lib.exe's output. if 'VS_UNICODE_OUTPUT' in os.environ: del os.environ['VS_UNICODE_OUTPUT'] CombineLibraries(output, remove_re, args)
| 476,317
|
def main(argv): if len(argv) < 3: print('usage: %s order.html input_source_dir_1 input_source_dir_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() extractor = OrderedJSFilesExtractor(argv[1]) expander = PathExpander(argv[2:]) output = StringIO() for input_file_name in extractor.ordered_js_files: full_path = expander.expand(input_file_name) if (full_path is None): raise Exception('File %s referenced in %s not found on any source paths, ' 'check source tree for consistency' % (input_file_name, input_file_name)) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_path, 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
|
def main(argv): if len(argv) < 3: print('usage: %s order.html input_source_dir_1 input_source_dir_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() input_order_file_name = argv[1] extractor = OrderedJSFilesExtractor(input_order_file_name) expander = PathExpander(argv[2:]) output = StringIO() for input_file_name in extractor.ordered_js_files: full_path = expander.expand(input_file_name) if (full_path is None): raise Exception('File %s referenced in %s not found on any source paths, ' 'check source tree for consistency' % (input_file_name, input_file_name)) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_path, 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
| 476,318
|
def main(argv): if len(argv) < 3: print('usage: %s order.html input_source_dir_1 input_source_dir_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() extractor = OrderedJSFilesExtractor(argv[1]) expander = PathExpander(argv[2:]) output = StringIO() for input_file_name in extractor.ordered_js_files: full_path = expander.expand(input_file_name) if (full_path is None): raise Exception('File %s referenced in %s not found on any source paths, ' 'check source tree for consistency' % (input_file_name, input_file_name)) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_path, 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
|
def main(argv): if len(argv) < 3: print('usage: %s order.html input_source_dir_1 input_source_dir_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() extractor = OrderedJSFilesExtractor(argv[1]) expander = PathExpander(argv[2:]) output = StringIO() for input_file_name in extractor.ordered_js_files: full_path = expander.expand(input_file_name) if (full_path is None): raise Exception('File %s referenced in %s not found on any source paths, ' 'check source tree for consistency' % (input_file_name, input_order_file_name)) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_path, 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
| 476,319
|
def SimpleTest(self, module, name, heapcheck_test_args=None, cmd_args=None): '''Builds the command line and runs the specified test.
|
def SimpleTest(self, module, name, heapcheck_test_args=None, cmd_args=None): '''Builds the command line and runs the specified test.
| 476,320
|
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues() for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
|
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues(func) for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
| 476,321
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
| 476,322
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
| 476,323
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
| 476,324
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
| 476,325
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
| 476,326
|
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
|
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetCmdArgs() id_arg = args[0] bucket_arg = args[1] id_arg.WriteGetCode(file) bucket_arg.WriteGetCode(file) id_arg.WriteValidationCode(file) file.Write(" GLint len = 0;\n") file.Write(" %s(%s, %s, &len);\n" % ( func.GetInfo('get_len_func'), id_arg.name, func.GetInfo('get_len_enum'))) file.Write(" Bucket* bucket = CreateBucket(%s);\n" % bucket_arg.name) file.Write(" bucket->SetSize(len + 1);\n"); file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
| 476,327
|
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
|
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s(%s, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));\n" % (func.GetGLFunctionName(), id_arg.name)) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
| 476,328
|
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" return 0
|
def GetNumInvalidValues(self, func): """returns the number of invalid values to be tested.""" return 0
| 476,329
|
def WriteValidationCode(self, file): """Writes the validation code for an argument.""" if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
|
def WriteValidationCode(self, file): """Writes the validation code for an argument.""" if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
| 476,330
|
def GetNumInvalidValues(self): """overridden from Argument.""" return 1
|
def GetNumInvalidValues(self, func): """overridden from Argument.""" return 1
| 476,331
|
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
|
def GetInvalidArg(self, offset, index): """overridden from Argument.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
| 476,332
|
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
|
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
| 476,333
|
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] return len(invalid) return 0
|
def GetNumInvalidValues(self, func): """returns the number of invalid values to be tested.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] return len(invalid) return 0
| 476,334
|
def GetInvalidArg(self, offset, index): """returns an invalid value by index.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] num_invalid = len(invalid) if index >= num_invalid: index = num_invalid - 1 return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
|
def GetInvalidArg(self, offset, index): """returns an invalid value by index.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] num_invalid = len(invalid) if index >= num_invalid: index = num_invalid - 1 return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
| 476,335
|
def GetNumInvalidValues(self): """Overridden from Argument.""" return 2
|
def GetNumInvalidValues(self, func): """Overridden from Argument.""" return 2
| 476,336
|
def add(self, name, arcname=None, recursive=True, exclude=None): if exclude is not None and exclude(name): return tarfile.TarFile.add(self, name, arcname=arcname, recursive=recursive)
|
def add(self, name, arcname=None, recursive=True, exclude=None): head, tail = os.path.split(name) if tail in ('.svn', '.git'): return tarfile.TarFile.add(self, name, arcname=arcname, recursive=recursive)
| 476,337
|
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
|
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
| 476,338
|
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
|
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
| 476,339
|
def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] self.file.write(line1 + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = line[i] if not splitter == ',': indent = " " + indent self.__WriteLine(indent + line[i + 1:].lstrip(), True) return self.file.write(line) if ends_with_eol: self.file.write('\n')
|
def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] nolint = '' if len(line1) > 80: nolint = ' // NOLINT' self.file.write(line1 + nolint + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = line[i] if not splitter == ',': indent = " " + indent self.__WriteLine(indent + line[i + 1:].lstrip(), True) return self.file.write(line) if ends_with_eol: self.file.write('\n')
| 476,340
|
def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] self.file.write(line1 + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = line[i] if not splitter == ',': indent = " " + indent self.__WriteLine(indent + line[i + 1:].lstrip(), True) return self.file.write(line) if ends_with_eol: self.file.write('\n')
|
def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] self.file.write(line1 + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = line[i] if not splitter == ',': indent = " " + indent self.__WriteLine(indent + line[i + 1:].lstrip(), True) return nolint = '' if len(line) > 80: nolint = ' // NOLINT' self.file.write(line + nolint) if ends_with_eol: self.file.write('\n')
| 476,341
|
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', pid]) sys.exit(0)
|
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', str(pid)]) sys.exit(0)
| 476,342
|
def kill(self): """Kill our running process if needed. Wait for kill to complete.
|
def kill(self): """Kill our running process if needed. Wait for kill to complete.
| 476,343
|
def kill(self): """Kill our running process if needed. Wait for kill to complete.
|
def kill(self): """Kill our running process if needed. Wait for kill to complete.
| 476,344
|
def retcode(self): """Return the return value of the subprocess.
|
def retcode(self): """Return the return value of the subprocess.
| 476,345
|
def setUp(self): global WEBDRIVER_SERVER_URL global WEBDRIVER_PROCESS WEBDRIVER_PROCESS = subprocess.Popen([WEBDRIVER_EXE, '--port=%d' % WEBDRIVER_PORT]) if WEBDRIVER_PROCESS == None: print "Chromium executable not found. The path used was: " print WEBDRIVER_EXE sys.exit(-1)
|
def setUp(self): global WEBDRIVER_SERVER_URL global WEBDRIVER_PROCESS WEBDRIVER_PROCESS = subprocess.Popen([WEBDRIVER_EXE, '--port=%d' % WEBDRIVER_PORT]) if WEBDRIVER_PROCESS == None: print "Chromium executable not found. The path used was: " print WEBDRIVER_EXE sys.exit(-1)
| 476,346
|
def assertURL(self, url): u = self.driver.get_current_url() self.assertEqual(u, url)
|
def assertURL(self, url): u = self.driver.get_current_url() self.assertEqual(u, url)
| 476,347
|
def testNavigation(self): # Loads two pages into chrome's navigation history. self.navigate(self.NEWS) self.navigate(self.SEARCH)
|
def testNavigation(self): # Loads two pages into chrome's navigation history. self.navigate(self.NEWS) self.navigate(self.SEARCH)
| 476,348
|
def testNoTranslate(self): """Tests that a page isn't translated if the user declines translate.""" self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) self.SelectTranslateOption('decline_translation') self.WaitForInfobarCount(0) translate_info = self.GetTranslateInfo() self.assertEqual(self.spanish, translate_info['original_language']) self.assertFalse(translate_info['page_translated']) self.assertTrue(translate_info['can_translate_page']) # If the user goes to the site again, the infobar should drop down but # the page should not be automatically translated. self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) translate_info = self.GetTranslateInfo() self.assertFalse(translate_info['page_translated']) self.assertTrue(translate_info['can_translate_page']) self.assertTrue('translate_bar' in translate_info) self.assertEquals(self.before_translate, translate_info['translate_bar']['bar_state'])
|
def testNoTranslate(self): """Tests that a page isn't translated if the user declines translate.""" self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) self.SelectTranslateOption('decline_translation') translate_info = self.GetTranslateInfo() self.assertEqual(self.spanish, translate_info['original_language']) self.assertFalse(translate_info['page_translated']) self.assertTrue(translate_info['can_translate_page']) # If the user goes to the site again, the infobar should drop down but # the page should not be automatically translated. self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) translate_info = self.GetTranslateInfo() self.assertFalse(translate_info['page_translated']) self.assertTrue(translate_info['can_translate_page']) self.assertTrue('translate_bar' in translate_info) self.assertEquals(self.before_translate, translate_info['translate_bar']['bar_state'])
| 476,349
|
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', str(pid)]) sys.exit(0)
|
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', str(pid)]) sys.exit(0)
| 476,350
|
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', str(pid)]) sys.exit(0)
|
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', str(pid)]) sys.exit(0)
| 476,351
|
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
|
def run(self): stdout_file = tempfile.TemporaryFile() try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
| 476,352
|
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
|
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
| 476,353
|
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
|
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
| 476,354
|
def RunUntilCompletion(self, timeout): """Run thread until completion or timeout (in seconds).
|
def RunUntilCompletion(self, timeout): """Run thread until completion or timeout (in seconds).
| 476,355
|
def Start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.IsRunning(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
|
def Start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.IsRunning(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
| 476,356
|
def WriteGLES2ImplementationDeclaration(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
|
def WriteGLES2ImplementationDeclaration(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
| 476,357
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') impl_decl = func.GetInfo('impl_decl') if (func.can_auto_generate and (impl_func == None or impl_func == True) and (impl_decl == None or impl_decl == True)): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: self.WriteGLES2ImplementationDeclaration(func, file)
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: self.WriteGLES2ImplementationDeclaration(func, file)
| 476,358
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 476,359
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" FreeIds(%s);\n" % func.MakeOriginalArgString("")) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" FreeIds(%s);\n" % func.MakeOriginalArgString("")) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
| 476,360
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) all_but_last_args = func.GetOriginalArgs()[:-1] arg_string = ( ", ".join(["%s" % arg.name for arg in all_but_last_args])) code = """ typedef %(func_name)s::Result Result;
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) all_but_last_args = func.GetOriginalArgs()[:-1] arg_string = ( ", ".join(["%s" % arg.name for arg in all_but_last_args])) code = """ typedef %(func_name)s::Result Result;
| 476,361
|
code = """ typedef %(func_name)s::Result Result;
|
code = """ typedef %(func_name)s::Result Result;
| 476,362
|
code = """ typedef %(func_name)s::Result Result;
|
code = """ typedef %(func_name)s::Result Result;
| 476,363
|
def main(): cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[0])))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
|
def main(): cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[0])))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
| 476,364
|
def serve_forever(self): self.stop = False self.nonce = None while not self.stop: self.handle_request() self.socket.close()
|
def serve_forever(self): self.stop = False self.nonce_time = None while not self.stop: self.handle_request() self.socket.close()
| 476,365
|
def AuthDigestHandler(self): """This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
|
def AuthDigestHandler(self): """This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
| 476,366
|
def AuthDigestHandler(self): """This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
|
def AuthDigestHandler(self): """This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
| 476,367
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
| 476,368
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" %s_id_handler_->FreeIds(%s);\n" % (func.name[6:-1].lower(), func.MakeOriginalArgString(""))) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" %s_id_handler_->FreeIds(%s);\n" % (func.name[6:-1].lower(), func.MakeOriginalArgString(""))) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
| 476,369
|
code = """ typedef %(func_name)s::Result Result;
|
code = """ typedef %(func_name)s::Result Result;
| 476,370
|
def parse_json_file(path, encoding="utf-8"): """ Load the specified file and parse it as JSON. Args: path: Path to a file containing JSON-encoded data. encoding: Encoding used in the file. Defaults to utf-8. Returns: A Python object representing the data encoded in the file. Raises: Exception: If the file could not be read or its contents could not be parsed as JSON data. """ try: json_file = open(path, 'r') except IOError, msg: raise Exception("Failed to read the file at %s: %s" % (path, msg)) try: json_obj = json.load(json_file, encoding) except ValueError, msg: raise Exception("Failed to parse JSON out of file %s: %s" % (path, msg)) json_file.close() return json_obj
|
def parse_json_file(path, encoding="utf-8"): """ Load the specified file and parse it as JSON. Args: path: Path to a file containing JSON-encoded data. encoding: Encoding used in the file. Defaults to utf-8. Returns: A Python object representing the data encoded in the file. Raises: Exception: If the file could not be read or its contents could not be parsed as JSON data. """ try: json_file = open(path, 'r') except IOError, msg: raise Exception("Failed to read the file at %s: %s" % (path, msg)) try: json_obj = json.load(json_file, encoding) except ValueError, msg: raise Exception("Failed to parse JSON out of file %s: %s" % (path, msg)) finally: json_file.close() return json_obj
| 476,371
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
| 476,372
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
| 476,373
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
| 476,374
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
|
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
| 476,375
|
def Analyze(self, log_lines, check_sanity=False): """Analyzes the app's output and applies suppressions to the reports.
|
defif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 Analyze(self,if not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 log_lines,if not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 check_sanity=False):if not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 """Analyzesif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 theif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 app'sif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 outputif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 andif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 appliesif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 suppressionsif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 toif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 theif not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3 reports.
| 476,376
|
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
|
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
| 476,377
|
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
|
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
| 476,378
|
def EchoAllHandler(self): """This handler yields a (more) human-readable page listing information about the request header & contents."""
|
def EchoAllHandler(self): """This handler yields a (more) human-readable page listing information about the request header & contents."""
| 476,379
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,380
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,381
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
deflisten_port = server.server_port main(options,listen_port = server.server_port args):listen_port = server.server_port logfilelisten_port = server.server_port =listen_port = server.server_port open('testserver.log',listen_port = server.server_port 'w')listen_port = server.server_port sys.stdoutlisten_port = server.server_port =listen_port = server.server_port FileMultiplexer(sys.stdout,listen_port = server.server_port logfile)listen_port = server.server_port sys.stderrlisten_port = server.server_port =listen_port = server.server_port FileMultiplexer(sys.stderr,listen_port = server.server_port logfile)listen_port = server.server_port listen_port = server.server_port portlisten_port = server.server_port =listen_port = server.server_port options.portlisten_port = server.server_port listen_port = server.server_port iflisten_port = server.server_port options.server_typelisten_port = server.server_port ==listen_port = server.server_port SERVER_HTTP:listen_port = server.server_port iflisten_port = server.server_port options.cert:listen_port = server.server_port #listen_port = server.server_port let'slisten_port = server.server_port makelisten_port = server.server_port surelisten_port = server.server_port thelisten_port = server.server_port certlisten_port = server.server_port filelisten_port = server.server_port exists.listen_port = server.server_port iflisten_port = server.server_port notlisten_port = server.server_port os.path.isfile(options.cert):listen_port = server.server_port printlisten_port = server.server_port 'specifiedlisten_port = server.server_port serverlisten_port = server.server_port certlisten_port = server.server_port filelisten_port = server.server_port notlisten_port = server.server_port found:listen_port = server.server_port 'listen_port = server.server_port +listen_port = server.server_port options.certlisten_port = server.server_port +listen_port = server.server_port \listen_port = server.server_port 'listen_port = server.server_port exiting...'listen_port = server.server_port returnlisten_port = server.server_port forlisten_port = server.server_port ca_certlisten_port = server.server_port inlisten_port = server.server_port options.ssl_client_ca:listen_port = server.server_port iflisten_port = server.server_port notlisten_port = server.server_port os.path.isfile(ca_cert):listen_port = server.server_port printlisten_port = server.server_port 'specifiedlisten_port = server.server_port trustedlisten_port = server.server_port clientlisten_port = server.server_port CAlisten_port = server.server_port filelisten_port = server.server_port notlisten_port = server.server_port found:listen_port = server.server_port 'listen_port = server.server_port +listen_port = server.server_port ca_certlisten_port = server.server_port +listen_port = server.server_port \listen_port = server.server_port 'listen_port = server.server_port exiting...'listen_port = server.server_port returnlisten_port = server.server_port serverlisten_port = server.server_port =listen_port = server.server_port HTTPSServer(('127.0.0.1',listen_port = server.server_port port),listen_port = server.server_port TestPageHandler,listen_port = server.server_port options.cert,listen_port = server.server_port options.ssl_client_auth,listen_port = server.server_port options.ssl_client_ca)listen_port = server.server_port printlisten_port = server.server_port 'HTTPSlisten_port = server.server_port serverlisten_port = server.server_port startedlisten_port = server.server_port onlisten_port = server.server_port portlisten_port = server.server_port %d...'listen_port = server.server_port %listen_port = server.server_port portlisten_port = server.server_port else:listen_port = server.server_port serverlisten_port = server.server_port =listen_port = server.server_port StoppableHTTPServer(('127.0.0.1',listen_port = server.server_port port),listen_port = server.server_port TestPageHandler)listen_port = server.server_port printlisten_port = server.server_port 'HTTPlisten_port = server.server_port serverlisten_port = server.server_port startedlisten_port = server.server_port onlisten_port = server.server_port portlisten_port = server.server_port %d...'listen_port = server.server_port %listen_port = server.server_port portlisten_port = server.server_port listen_port = server.server_port server.data_dirlisten_port = server.server_port =listen_port = server.server_port MakeDataDir()listen_port = server.server_port server.file_root_urllisten_port = server.server_port =listen_port = server.server_port options.file_root_urllisten_port = server.server_port server._sync_handlerlisten_port = server.server_port =listen_port = server.server_port Nonelisten_port = server.server_port listen_port = server.server_port #listen_port = server.server_port meanslisten_port = server.server_port FTPlisten_port = server.server_port Serverlisten_port = server.server_port else:listen_port = server.server_port my_data_dirlisten_port = server.server_port =listen_port = server.server_port MakeDataDir()listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Instantiatelisten_port = server.server_port alisten_port = server.server_port dummylisten_port = server.server_port authorizerlisten_port = server.server_port forlisten_port = server.server_port managinglisten_port = server.server_port 'virtual'listen_port = server.server_port userslisten_port = server.server_port authorizerlisten_port = server.server_port =listen_port = server.server_port pyftpdlib.ftpserver.DummyAuthorizer()listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Definelisten_port = server.server_port alisten_port = server.server_port newlisten_port = server.server_port userlisten_port = server.server_port havinglisten_port = server.server_port fulllisten_port = server.server_port r/wlisten_port = server.server_port permissionslisten_port = server.server_port andlisten_port = server.server_port alisten_port = server.server_port read-onlylisten_port = server.server_port #listen_port = server.server_port anonymouslisten_port = server.server_port userlisten_port = server.server_port authorizer.add_user('chrome',listen_port = server.server_port 'chrome',listen_port = server.server_port my_data_dir,listen_port = server.server_port perm='elradfmw')listen_port = server.server_port listen_port = server.server_port authorizer.add_anonymous(my_data_dir)listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Instantiatelisten_port = server.server_port FTPlisten_port = server.server_port handlerlisten_port = server.server_port classlisten_port = server.server_port ftp_handlerlisten_port = server.server_port =listen_port = server.server_port pyftpdlib.ftpserver.FTPHandlerlisten_port = server.server_port ftp_handler.authorizerlisten_port = server.server_port =listen_port = server.server_port authorizerlisten_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Definelisten_port = server.server_port alisten_port = server.server_port customizedlisten_port = server.server_port bannerlisten_port = server.server_port (stringlisten_port = server.server_port returnedlisten_port = server.server_port whenlisten_port = server.server_port clientlisten_port = server.server_port connects)listen_port = server.server_port ftp_handler.bannerlisten_port = server.server_port =listen_port = server.server_port ("pyftpdliblisten_port = server.server_port %slisten_port = server.server_port basedlisten_port = server.server_port ftpdlisten_port = server.server_port ready."listen_port = server.server_port %listen_port = server.server_port pyftpdlib.ftpserver.__ver__)listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Instantiatelisten_port = server.server_port FTPlisten_port = server.server_port serverlisten_port = server.server_port classlisten_port = server.server_port andlisten_port = server.server_port listenlisten_port = server.server_port tolisten_port = server.server_port 127.0.0.1:portlisten_port = server.server_port addresslisten_port = server.server_port =listen_port = server.server_port ('127.0.0.1',listen_port = server.server_port port)listen_port = server.server_port serverlisten_port = server.server_port =listen_port = server.server_port pyftpdlib.ftpserver.FTPServer(address,listen_port = server.server_port ftp_handler)listen_port = server.server_port printlisten_port = server.server_port 'FTPlisten_port = server.server_port serverlisten_port = server.server_port startedlisten_port = server.server_port onlisten_port = server.server_port portlisten_port = server.server_port %d...'listen_port = server.server_port %listen_port = server.server_port portlisten_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Notifylisten_port = server.server_port thelisten_port = server.server_port parentlisten_port = server.server_port thatlisten_port = server.server_port we'velisten_port = server.server_port started.listen_port = server.server_port (BaseServerlisten_port = server.server_port subclasseslisten_port = server.server_port #listen_port = server.server_port bindlisten_port = server.server_port theirlisten_port = server.server_port socketslisten_port = server.server_port onlisten_port = server.server_port construction.)listen_port = server.server_port iflisten_port = server.server_port options.startup_pipelisten_port = server.server_port islisten_port = server.server_port notlisten_port = server.server_port None:listen_port = server.server_port iflisten_port = server.server_port sys.platformlisten_port = server.server_port ==listen_port = server.server_port 'win32':listen_port = server.server_port fdlisten_port = server.server_port =listen_port = server.server_port msvcrt.open_osfhandle(options.startup_pipe,listen_port = server.server_port 0)listen_port = server.server_port else:listen_port = server.server_port fdlisten_port = server.server_port =listen_port = server.server_port options.startup_pipelisten_port = server.server_port startup_pipelisten_port = server.server_port =listen_port = server.server_port os.fdopen(fd,listen_port = server.server_port "w")listen_port = server.server_port startup_pipe.write("READY")listen_port = server.server_port startup_pipe.close()listen_port = server.server_port listen_port = server.server_port try:listen_port = server.server_port server.serve_forever()listen_port = server.server_port exceptlisten_port = server.server_port KeyboardInterrupt:listen_port = server.server_port printlisten_port = server.server_port 'shuttinglisten_port = server.server_port downlisten_port = server.server_port server'listen_port = server.server_port server.stoplisten_port = server.server_port =listen_port = server.server_port Truelisten_port = server.server_port
| 476,382
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,383
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,384
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,385
|
def __init__(self, options): self._options = options
|
def __init__(self, options): self._options = options
| 476,386
|
def DownloadFileFromDownloadsDataDir(test, file_name): """Download a file from downloads data directory. Args: test: derived from pyauto.PyUITest - base class for UI test cases file_name: name of file to download """ download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads') downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), file_name) # Check if file already exists. If so then delete it. if os.path.exists(downloaded_pkg): RemoveDownloadedTestFile(test, file_name) test.WaitForAllDownloadsToComplete()
|
def DownloadFileFromDownloadsDataDir(test, file_name): """Download a file from downloads data directory, in first tab first window. Args: test: derived from pyauto.PyUITest - base class for UI test cases file_name: name of file to download """ download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads') downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), file_name) # Check if file already exists. If so then delete it. if os.path.exists(downloaded_pkg): RemoveDownloadedTestFile(test, file_name) test.WaitForAllDownloadsToComplete()
| 476,387
|
def DownloadFileFromDownloadsDataDir(test, file_name): """Download a file from downloads data directory. Args: test: derived from pyauto.PyUITest - base class for UI test cases file_name: name of file to download """ download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads') downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), file_name) # Check if file already exists. If so then delete it. if os.path.exists(downloaded_pkg): RemoveDownloadedTestFile(test, file_name) test.WaitForAllDownloadsToComplete()
|
def DownloadFileFromDownloadsDataDir(test, file_name): """Download a file from downloads data directory. Args: test: derived from pyauto.PyUITest - base class for UI test cases file_name: name of file to download """ file_url = test.GetFileURLForDataPath(os.path.join('downloads', file_name)) downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), file_name) # Check if file already exists. If so then delete it. if os.path.exists(downloaded_pkg): RemoveDownloadedTestFile(test, file_name) test.WaitForAllDownloadsToComplete()
| 476,388
|
def _CancelNotification(self, notification_id, tab_index=0, windex=0): """Cancels a notification with the given id.
|
def _CancelNotification(self, notification_id, tab_index=0, windex=0): """Cancels a notification with the given id.
| 476,389
|
def _CancelNotification(self, notification_id, tab_index=0, windex=0): """Cancels a notification with the given id.
|
def _CancelNotification(self, notification_id, tab_index=0, windex=0): """Cancels a notification with the given id.
| 476,390
|
def testCreateSimpleNotification(self): """Creates a simple notification.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateSimpleNotification('no_such_file.png', 'My Title', 'My Body') self.assertEquals(len(self.GetActiveNotifications()), 1) notification = self.GetActiveNotifications()[0] html_data = urllib.unquote(notification['content_url']) self.assertTrue('no_such_file.png' in html_data) self.assertTrue('My Title' in html_data) self.assertTrue('My Body' in html_data)
|
def testCreateSimpleNotification(self): """Creates a simple notification.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateSimpleNotification('no_such_file.png', 'My Title', 'My Body') self.assertEquals(1, len(self.GetActiveNotifications())) notification = self.GetActiveNotifications()[0] html_data = urllib.unquote(notification['content_url']) self.assertTrue('no_such_file.png' in html_data) self.assertTrue('My Title' in html_data) self.assertTrue('My Body' in html_data)
| 476,391
|
def testCreateHTMLNotification(self): """Creates an HTML notification using a fake url.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertEquals(len(self.GetActiveNotifications()), 1) notification = self.GetActiveNotifications()[0] self.assertEquals(self.NO_SUCH_URL, notification['content_url']) self.assertEquals('', notification['display_source']) self.assertEquals('file:///', notification['origin_url'])
|
def testCreateHTMLNotification(self): """Creates an HTML notification using a fake url.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertEquals(1, len(self.GetActiveNotifications())) notification = self.GetActiveNotifications()[0] self.assertEquals(self.NO_SUCH_URL, notification['content_url']) self.assertEquals('', notification['display_source']) self.assertEquals('file:///', notification['origin_url'])
| 476,392
|
def testCloseNotification(self): """Creates a notification and closes it.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self.CloseNotification(0) self.assertEquals(len(self.GetActiveNotifications()), 0)
|
def testCloseNotification(self): """Creates a notification and closes it.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self.CloseNotification(0) self.assertEquals(len(self.GetActiveNotifications()), 0)
| 476,393
|
def testCancelNotification(self): """Creates a notification and cancels it in the origin page.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) note_id = self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertNotEquals(-1, note_id) self._CancelNotification(note_id) self.assertEquals(len(self.GetActiveNotifications()), 0)
|
def testCancelNotification(self): """Creates a notification and cancels it in the origin page.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) note_id = self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertNotEquals(-1, note_id) self._CancelNotification(note_id) self.assertEquals(len(self.GetActiveNotifications()), 0)
| 476,394
|
def testPermissionInfobarAppears(self): """Requests notification privileges and verifies the infobar appears.""" self.NavigateToURL(self.TEST_PAGE_URL) self._RequestPermission() self.assertTrue(self.WaitForInfobarCount(1)) self.assertEquals(len(self.GetActiveNotifications()), 0) self._VerifyInfobar('') # file:/// origins are blank
|
def testPermissionInfobarAppears(self): """Requests notification privileges and verifies the infobar appears.""" self.NavigateToURL(self.TEST_PAGE_URL) self._RequestPermission() self.assertTrue(self.WaitForInfobarCount(1)) self.assertFalse(self.GetActiveNotifications()) self._VerifyInfobar('') # file:/// origins are blank
| 476,395
|
def testAllowOnPermissionInfobar(self): """Tries to create a notification and clicks allow on the infobar.""" self.NavigateToURL(self.TEST_PAGE_URL) # This notification should not be shown because we don't have permission. self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertEquals(len(self.GetActiveNotifications()), 0)
|
def testAllowOnPermissionInfobar(self): """Tries to create a notification and clicks allow on the infobar.""" self.NavigateToURL(self.TEST_PAGE_URL) # This notification should not be shown because we don't have permission. self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertEquals(len(self.GetActiveNotifications()), 0)
| 476,396
|
def __init__(self, server_address, request_hander_class, cert_path, ssl_client_auth, ssl_client_cas): s = open(cert_path).read() x509 = tlslite.api.X509() x509.parse(s) self.cert_chain = tlslite.api.X509CertChain([x509]) s = open(cert_path).read() self.private_key = tlslite.api.parsePEMKey(s, private=True) self.ssl_client_auth = ssl_client_auth self.ssl_client_cas = [] for ca_file in ssl_client_cas: s = open(ca_file).read() x509 = tlslite.api.X509() x509.parse(s) self.ssl_client_cas.append(x509.subject)
|
def __init__(self, server_address, request_hander_class, cert_path, ssl_client_auth, ssl_client_cas, ssl_bulk_ciphers): s = open(cert_path).read() x509 = tlslite.api.X509() x509.parse(s) self.cert_chain = tlslite.api.X509CertChain([x509]) s = open(cert_path).read() self.private_key = tlslite.api.parsePEMKey(s, private=True) self.ssl_client_auth = ssl_client_auth self.ssl_client_cas = [] for ca_file in ssl_client_cas: s = open(ca_file).read() x509 = tlslite.api.X509() x509.parse(s) self.ssl_client_cas.append(x509.subject)
| 476,397
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,398
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 476,399
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.