def resource_usage(self, address=None, port=None, browser=None): import webbrowser from mozbuild.html_build_viewer import BuildViewerServer last = self._get_state_filename("build_resources.json") if not os.path.exists(last): print( "Build resources not available. If you have performed a " "build and receive this message, the psutil Python package " "likely failed to initialize properly." ) return 1 server = BuildViewerServer(address, port) server.add_resource_json_file("last", last) try: webbrowser.get(browser).open_new_tab(server.url) except Exception: print("Cannot get browser specified, trying the default instead.") try: browser = webbrowser.get().open_new_tab(server.url) except Exception: print("Please open %s in a browser." % server.url) print("Hit CTRL+c to stop server.") server.run()
def resource_usage(self, address=None, port=None, browser=None, url=None): import webbrowser from mozbuild.html_build_viewer import BuildViewerServer server = BuildViewerServer(address, port) if url: server.add_resource_json_url('url', url) else: last = self._get_state_filename('build_resources.json') if not os.path.exists(last): print('Build resources not available. If you have performed a ' 'build and receive this message, the psutil Python package ' 'likely failed to initialize properly.') return 1 server.add_resource_json_file('last', last) try: webbrowser.get(browser).open_new_tab(server.url) except Exception: print('Cannot get browser specified, trying the default instead.') try: browser = webbrowser.get().open_new_tab(server.url) except Exception: print('Please open %s in a browser.' % server.url) print('Hit CTRL+c to stop server.') server.run()
def resource_usage(command_context, address=None, port=None, browser=None, url=None): import webbrowser from mozbuild.html_build_viewer import BuildViewerServer server = BuildViewerServer(address, port) if url: server.add_resource_json_url("url", url) else: last = command_context._get_state_filename("build_resources.json") if not os.path.exists(last): print("Build resources not available. If you have performed a " "build and receive this message, the psutil Python package " "likely failed to initialize properly.") return 1 server.add_resource_json_file("last", last) try: webbrowser.get(browser).open_new_tab(server.url) except Exception: print("Cannot get browser specified, trying the default instead.") try: browser = webbrowser.get().open_new_tab(server.url) except Exception: print("Please open %s in a browser." % server.url) print("Hit CTRL+c to stop server.") server.run()
def resource_usage(self, address=None, port=None, browser=None): import webbrowser from mozbuild.html_build_viewer import BuildViewerServer last = self._get_state_filename('build_resources.json') if not os.path.exists(last): print('Build resources not available. If you have performed a ' 'build and receive this message, the psutil Python package ' 'likely failed to initialize properly.') return 1 server = BuildViewerServer(address, port) server.add_resource_json_file('last', last) try: webbrowser.get(browser).open_new_tab(server.url) except Exception: print('Please open %s in a browser.' % server.url) print('Hit CTRL+c to stop server.') server.run()