Move to sarge 0.1.5
Replace async with async_ where necessary
This commit is contained in:
1 parent
e2394446b0
commit
d73d930e5f
9 files changed
+16
-14
No files matched your search
@@ -31,8 +31,7 @@ INSTALL_REQUIRES = [
|
||||
"pyserial>=3.4,<3.5",
|
||||
"netaddr>=0.7.19,<0.8",
|
||||
"watchdog>=0.8.3,<0.9",
|
||||
"sarge==0.1.4", # 0.1.5 introduced a breaking change with regards to the async keyword. Pinning
|
||||
# to 0.1.4 for now to work around this.
|
||||
"sarge==0.1.5",
|
||||
"netifaces>=0.10.6,<0.11",
|
||||
"pylru>=1.0.9,<1.1",
|
||||
"rsa>=3.2.3,<3.3",
|
||||
|
||||
@@ -364,7 +364,7 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
|
||||
self._logger.info("Invoking analysis command: {}".format(" ".join(command)))
|
||||
|
||||
self._aborted = False
|
||||
p = sarge.run(command, async=True, stdout=sarge.Capture())
|
||||
p = sarge.run(command, async_=True, stdout=sarge.Capture())
|
||||
|
||||
while len(p.commands) == 0:
|
||||
# somewhat ugly... we can't use wait_events because
|
||||
|
||||
@@ -312,7 +312,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
||||
working_dir))
|
||||
|
||||
import sarge
|
||||
p = sarge.run(args, cwd=working_dir, async=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
||||
p = sarge.run(args, cwd=working_dir, async_=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
||||
p.wait_events()
|
||||
self._slicing_commands[machinecode_path] = p.commands[0]
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
self._console_logger.propagate = False
|
||||
|
||||
# decouple repository fetching from server startup
|
||||
self._fetch_all_data(async=True)
|
||||
self._fetch_all_data(do_async=True)
|
||||
|
||||
##~~ SettingsPlugin
|
||||
|
||||
@@ -208,7 +208,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
from octoprint.events import Events
|
||||
if event != Events.CONNECTIVITY_CHANGED or not payload or not payload.get("new", False):
|
||||
return
|
||||
self._fetch_all_data(async=True)
|
||||
self._fetch_all_data(do_async=True)
|
||||
|
||||
##~~ SimpleApiPlugin
|
||||
|
||||
@@ -720,12 +720,12 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
self._event_bus.fire("plugin_pluginmanager_disableplugin", dict(id=plugin.key,
|
||||
version=plugin.version))
|
||||
|
||||
def _fetch_all_data(self, async=False):
|
||||
def _fetch_all_data(self, do_async=False):
|
||||
def run():
|
||||
self._repository_available = self._fetch_repository_from_disk()
|
||||
self._notices_available = self._fetch_notices_from_disk()
|
||||
|
||||
if async:
|
||||
if do_async:
|
||||
thread = threading.Thread(target=run)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
|
||||
@@ -978,7 +978,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
|
||||
self._logger.info("Restarting...")
|
||||
try:
|
||||
util.execute(restart_command, evaluate_returncode=False, async=True)
|
||||
util.execute(restart_command, evaluate_returncode=False, do_async=True)
|
||||
except exceptions.ScriptError as e:
|
||||
self._logger.exception("Error while restarting via command {}".format(restart_command))
|
||||
self._logger.warn("Restart stdout:\n{}".format(e.stdout))
|
||||
|
||||
@@ -59,7 +59,9 @@ def _execute(command, **kwargs):
|
||||
joined_command = command
|
||||
_log_call(joined_command)
|
||||
|
||||
kwargs.update(dict(async=True, stdout=sarge.Capture(), stderr=sarge.Capture()))
|
||||
kwargs.update(dict(async_=True,
|
||||
stdout=sarge.Capture(),
|
||||
stderr=sarge.Capture()))
|
||||
|
||||
try:
|
||||
p = sarge.run(command, **kwargs)
|
||||
|
||||
@@ -9,12 +9,14 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
from .exceptions import ScriptError
|
||||
|
||||
|
||||
def execute(command, cwd=None, evaluate_returncode=True, async=False):
|
||||
def execute(command, cwd=None, evaluate_returncode=True, **kwargs):
|
||||
do_async = kwargs.get("do_async", kwargs.get("async", False))
|
||||
|
||||
import sarge
|
||||
p = None
|
||||
|
||||
try:
|
||||
p = sarge.run(command, cwd=cwd, stdout=sarge.Capture(), stderr=sarge.Capture(), async=async)
|
||||
p = sarge.run(command, cwd=cwd, stdout=sarge.Capture(), stderr=sarge.Capture(), async_=do_async)
|
||||
except:
|
||||
returncode = p.returncode if p is not None else None
|
||||
stdout = p.stdout.text if p is not None and p.stdout is not None else ""
|
||||
|
||||
@@ -7,7 +7,6 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
import logging
|
||||
import netaddr
|
||||
import sarge
|
||||
|
||||
from flask import Blueprint, request, jsonify, abort, current_app, session, make_response, g
|
||||
from flask_login import login_user, logout_user, current_user
|
||||
|
||||
@@ -78,7 +78,7 @@ class CommandlineCaller(object):
|
||||
self._logger.debug(u"Calling: {}".format(joined_command))
|
||||
self.on_log_call(joined_command)
|
||||
|
||||
kwargs.update(dict(async=True, stdout=sarge.Capture(), stderr=sarge.Capture()))
|
||||
kwargs.update(dict(async_=True, stdout=sarge.Capture(), stderr=sarge.Capture()))
|
||||
|
||||
p = sarge.run(command, **kwargs)
|
||||
while len(p.commands) == 0:
|
||||
|
||||
Reference in new issue
Block a user