From ac129a2576d0598f7d35f04b0b4287a00c0bcfd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 22 Nov 2018 13:10:59 +0100 Subject: [PATCH] Only patch sarge's async on python 2 --- src/octoprint/__init__.py | 4 ++-- src/octoprint/util/fixes.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index b4ed1468b..48cf8f25c 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -595,8 +595,8 @@ def main(): # cut off stuff from the beginning args = args[-1 * sys_args_length:] if sys_args_length else [] - from octoprint.util.fixes import fix_sarge_async - fix_sarge_async() + from octoprint.util.fixes import patch_sarge_async_on_py2 + patch_sarge_async_on_py2() from octoprint.cli import octo octo(args=args, prog_name="octoprint", auto_envvar_prefix="OCTOPRINT") diff --git a/src/octoprint/util/fixes.py b/src/octoprint/util/fixes.py index e5ea56af8..8ea63d8d3 100644 --- a/src/octoprint/util/fixes.py +++ b/src/octoprint/util/fixes.py @@ -7,8 +7,12 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp import functools import warnings +import sys + +def patch_sarge_async_on_py2(): + if sys.version_info[0] >= 3: + return -def fix_sarge_async(): def move_async(f): @functools.wraps(f) def decorated_function(*args, **kwargs):