From eeda891a327f5f45d575db27ff70d35c9bab42bf Mon Sep 17 00:00:00 2001 From: Madhava Jay Date: Fri, 29 Apr 2022 22:17:52 +1000 Subject: [PATCH] Fixes #42: ImportError for `safe_join` (#41) --- MANIFEST.in | 1 + docs/source/requirements.txt | 12 +++++++++++- flask_shell2http/classes.py | 8 ++++++-- requirements.dev.txt | 14 +------------- tox.ini | 12 +++++++----- 5 files changed, 26 insertions(+), 21 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 87f7551..25c6223 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,5 @@ include README.md include version.txt include requirements.txt include requirements.dev.txt +include docs/source/requirements.txt include LICENSE \ No newline at end of file diff --git a/docs/source/requirements.txt b/docs/source/requirements.txt index 3fdc29b..3ebb666 100644 --- a/docs/source/requirements.txt +++ b/docs/source/requirements.txt @@ -1 +1,11 @@ -# This requirements.txt is intentionally left blank for RTD build \ No newline at end of file +sphinx==4.4.0 +Pallets-Sphinx-Themes>=2.0.2 +sphinxcontrib-applehelp==1.0.2 +sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-htmlhelp>=2.0.0 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-napoleon==0.7 +sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-serializinghtml>=1.1.5 +commonmark +recommonmark \ No newline at end of file diff --git a/flask_shell2http/classes.py b/flask_shell2http/classes.py index fe6724e..961e97f 100644 --- a/flask_shell2http/classes.py +++ b/flask_shell2http/classes.py @@ -7,9 +7,13 @@ from typing import List, Dict, Tuple, Any, Optional # web imports -from flask.helpers import safe_join -from werkzeug.utils import secure_filename from flask_executor.futures import Future +from werkzeug.utils import secure_filename + +try: + from flask.helpers import safe_join +except ImportError: + from werkzeug.utils import safe_join # lib imports from .helpers import list_replace, gen_key, get_logger, DEFAULT_TIMEOUT diff --git a/requirements.dev.txt b/requirements.dev.txt index 9df0a7a..2536fea 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -5,16 +5,4 @@ tox-gh-actions black==22.3.0 flake8==3.8.4 -pre-commit==2.9.2 - -Sphinx==3.1.1 -Pallets-Sphinx-Themes==1.2.3 -sphinxcontrib-applehelp==1.0.2 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==1.0.3 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-napoleon==0.7 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.4 -commonmark==0.9.1 -recommonmark==0.6.0 \ No newline at end of file +pre-commit==2.9.2 \ No newline at end of file diff --git a/tox.ini b/tox.ini index 922d702..52a2a87 100644 --- a/tox.ini +++ b/tox.ini @@ -10,8 +10,11 @@ commands = setenv = PIP_INDEX_URL = https://pypi.python.org/simple/ deps = - -r requirements.dev.txt - flask1: flask>=1.1.0,<2.0.0 + -r requirements.txt + flask_testing + codecov + flask1: flask>=1.1.3,<2.0.0 + flask1: markupsafe==2.0.1 flask2: flask>=2.0.0,<3.0.0 [gh-actions] @@ -24,12 +27,11 @@ python = # Configuration for coverage and flake8 is being set in `./setup.cfg` [testenv:codecov] -passenv = TOXENV CI TRAVIS TRAVIS_* CODECOV_* +passenv = TOXENV CI CODECOV_* commands = codecov -e TOXENV deps = codecov>=2.1.10 - [testenv:docs-html] deps = - -r requirements.dev.txt + -r docs/source/requirements.txt commands = sphinx-build -b html -d docs/build/doctrees docs/source docs/build/html \ No newline at end of file