From 17184457b791b2ec050a0b768035d4b55a4dde3e Mon Sep 17 00:00:00 2001 From: Lindsay Hill Date: Wed, 27 Jun 2018 17:15:29 -0700 Subject: [PATCH 01/10] Make setup requirements consistent --- st2client/setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/st2client/setup.py b/st2client/setup.py index f673d207d3..393894fc01 100644 --- a/st2client/setup.py +++ b/st2client/setup.py @@ -53,12 +53,17 @@ 'Programming Language :: Python :: 2.7' ], install_requires=[ - 'jsonpath-rw>=1.3.0', + 'argcomplete', + 'jsonpath-rw>=1.4.0', 'prettytable', + 'prompt-toolkit==1.0.15', 'python-dateutil', - 'pyyaml<4.0,>=3.11', + 'python-editor==1.0.3', + 'pytz==2018.4', + 'pyyaml<4.0,>=3.12', 'requests[security]<2.15,>=2.14.1', - 'six==1.11.0' + 'six==1.11.0', + 'sseclient==0.0.19' ], dependency_links=[], test_suite=ST2_COMPONENT, From f9455e235e6304f7951431747f94bcb77824b2ad Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Thu, 28 Jun 2018 10:36:04 +0200 Subject: [PATCH 02/10] Update st2client setup.py file to dynamically load requirements from requirements.txt file. This is now possible since we install pip 9.0.0 in pack and st2 virtual environments. Keep in mind that this won't work with very old versions of pip (< 9.0). --- st2client/setup.py | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/st2client/setup.py b/st2client/setup.py index 393894fc01..587f2c0faf 100644 --- a/st2client/setup.py +++ b/st2client/setup.py @@ -18,19 +18,20 @@ from setuptools import setup, find_packages -# Note: We should re-enable usage of dist_utils once we ensure -# that we install new version of virtualenv which ships with -# pip >= 6.1 in all the environments -# from dist_utils import fetch_requirements -# from dist_utils import apply_vagrant_workaround +from dist_utils import check_pip_version +from dist_utils import fetch_requirements +from dist_utils import apply_vagrant_workaround + from st2client import __version__ +check_pip_version() + ST2_COMPONENT = 'st2client' BASE_DIR = os.path.dirname(os.path.abspath(__file__)) REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirements.txt') -# install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) -# apply_vagrant_workaround() +install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE) +apply_vagrant_workaround() setup( name=ST2_COMPONENT, @@ -52,20 +53,8 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7' ], - install_requires=[ - 'argcomplete', - 'jsonpath-rw>=1.4.0', - 'prettytable', - 'prompt-toolkit==1.0.15', - 'python-dateutil', - 'python-editor==1.0.3', - 'pytz==2018.4', - 'pyyaml<4.0,>=3.12', - 'requests[security]<2.15,>=2.14.1', - 'six==1.11.0', - 'sseclient==0.0.19' - ], - dependency_links=[], + install_requires=install_reqs, + dependency_links=dep_links, test_suite=ST2_COMPONENT, zip_safe=False, include_package_data=True, From 8c6659ccfdfcbb561ba772fd9ae1cab85e0e96df Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Thu, 28 Jun 2018 10:40:50 +0200 Subject: [PATCH 03/10] Allow user to pass minimum supported pip version to the function as an argument. --- scripts/dist_utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/dist_utils.py b/scripts/dist_utils.py index ede9e4a358..91a4ff489b 100644 --- a/scripts/dist_utils.py +++ b/scripts/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) From 79d0d1399f87d8e5588cca0ed587f84673b1e73b Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Thu, 28 Jun 2018 10:51:46 +0200 Subject: [PATCH 04/10] Update fetch_requirements function so it also works with older versions of pip where the attribute was called req.url (in newer versions it's called req.link). --- scripts/dist_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/dist_utils.py b/scripts/dist_utils.py index 91a4ff489b..965e6387da 100644 --- a/scripts/dist_utils.py +++ b/scripts/dist_utils.py @@ -73,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) From 45c86104e1d9ac43fe76b46f428cac10d2d68aee Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Thu, 28 Jun 2018 10:52:38 +0200 Subject: [PATCH 05/10] Re-generate dist_utils.py files. --- .../runners/action_chain_runner/dist_utils.py | 16 ++++++++++------ .../runners/announcement_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/cloudslang_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/http_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/inquirer_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/local_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/mistral_v2/dist_utils.py | 16 ++++++++++------ contrib/runners/noop_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/orchestra_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/python_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/remote_runner/dist_utils.py | 16 ++++++++++------ contrib/runners/windows_runner/dist_utils.py | 16 ++++++++++------ st2actions/dist_utils.py | 16 ++++++++++------ st2api/dist_utils.py | 16 ++++++++++------ st2auth/dist_utils.py | 16 ++++++++++------ st2client/dist_utils.py | 16 ++++++++++------ st2client/requirements.txt | 1 + st2common/dist_utils.py | 16 ++++++++++------ st2debug/dist_utils.py | 16 ++++++++++------ st2exporter/dist_utils.py | 16 ++++++++++------ st2reactor/dist_utils.py | 16 ++++++++++------ st2stream/dist_utils.py | 16 ++++++++++------ st2tests/dist_utils.py | 16 ++++++++++------ 23 files changed, 221 insertions(+), 132 deletions(-) diff --git a/contrib/runners/action_chain_runner/dist_utils.py b/contrib/runners/action_chain_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/action_chain_runner/dist_utils.py +++ b/contrib/runners/action_chain_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/announcement_runner/dist_utils.py b/contrib/runners/announcement_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/announcement_runner/dist_utils.py +++ b/contrib/runners/announcement_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/cloudslang_runner/dist_utils.py b/contrib/runners/cloudslang_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/cloudslang_runner/dist_utils.py +++ b/contrib/runners/cloudslang_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/http_runner/dist_utils.py b/contrib/runners/http_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/http_runner/dist_utils.py +++ b/contrib/runners/http_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/inquirer_runner/dist_utils.py b/contrib/runners/inquirer_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/inquirer_runner/dist_utils.py +++ b/contrib/runners/inquirer_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/local_runner/dist_utils.py b/contrib/runners/local_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/local_runner/dist_utils.py +++ b/contrib/runners/local_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/mistral_v2/dist_utils.py b/contrib/runners/mistral_v2/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/mistral_v2/dist_utils.py +++ b/contrib/runners/mistral_v2/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/noop_runner/dist_utils.py b/contrib/runners/noop_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/noop_runner/dist_utils.py +++ b/contrib/runners/noop_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/orchestra_runner/dist_utils.py b/contrib/runners/orchestra_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/orchestra_runner/dist_utils.py +++ b/contrib/runners/orchestra_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/python_runner/dist_utils.py b/contrib/runners/python_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/python_runner/dist_utils.py +++ b/contrib/runners/python_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/remote_runner/dist_utils.py b/contrib/runners/remote_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/remote_runner/dist_utils.py +++ b/contrib/runners/remote_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/contrib/runners/windows_runner/dist_utils.py b/contrib/runners/windows_runner/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/contrib/runners/windows_runner/dist_utils.py +++ b/contrib/runners/windows_runner/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2actions/dist_utils.py b/st2actions/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2actions/dist_utils.py +++ b/st2actions/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2api/dist_utils.py b/st2api/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2api/dist_utils.py +++ b/st2api/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2auth/dist_utils.py b/st2auth/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2auth/dist_utils.py +++ b/st2auth/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2client/dist_utils.py b/st2client/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2client/dist_utils.py +++ b/st2client/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2client/requirements.txt b/st2client/requirements.txt index f514d2b738..1f0a694696 100644 --- a/st2client/requirements.txt +++ b/st2client/requirements.txt @@ -1,4 +1,5 @@ # Don't edit this file. It's generated automatically! +git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper argcomplete jsonpath-rw==1.4.0 prettytable diff --git a/st2common/dist_utils.py b/st2common/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2common/dist_utils.py +++ b/st2common/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2debug/dist_utils.py b/st2debug/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2debug/dist_utils.py +++ b/st2debug/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2exporter/dist_utils.py b/st2exporter/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2exporter/dist_utils.py +++ b/st2exporter/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2reactor/dist_utils.py b/st2reactor/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2reactor/dist_utils.py +++ b/st2reactor/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2stream/dist_utils.py b/st2stream/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2stream/dist_utils.py +++ b/st2stream/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) diff --git a/st2tests/dist_utils.py b/st2tests/dist_utils.py index ede9e4a358..965e6387da 100644 --- a/st2tests/dist_utils.py +++ b/st2tests/dist_utils.py @@ -54,13 +54,15 @@ ] -def check_pip_version(): +def check_pip_version(min_version='6.0.0'): """ Ensure that a minimum supported version of pip is installed. """ - if StrictVersion(pip.__version__) < StrictVersion('6.0.0'): - print("Upgrade pip, your version `{0}' " - "is outdated:\n{1}".format(pip.__version__, GET_PIP)) + if StrictVersion(pip.__version__) < StrictVersion(min_version): + print("Upgrade pip, your version '{0}' " + "is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__, + min_version, + GET_PIP)) sys.exit(1) @@ -71,8 +73,10 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] for req in parse_requirements(requirements_file_path, session=False): - if req.link: - links.append(str(req.link)) + # Note: req.url was used before 9.0.0 and req.link is used in all the recent versions + link = getattr(req, 'link', getattr(req, 'url', None)) + if link: + links.append(str(link)) reqs.append(str(req.req)) return (reqs, links) From ad20dd2264ff7e40937f0b4906615c6fac4da777 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Thu, 28 Jun 2018 10:56:46 +0200 Subject: [PATCH 06/10] Add changelog entry. --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7d711b1b1c..1ddd28fb4c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -66,6 +66,9 @@ Changed Note: This change is fully backward compatible since it just changes the underlying backend and implementation details. The same underlying encryption algorithm is used (AES256 in CBC mode with HMAC signature). (improvement) #4165 +* Update ``st2client/setup.py`` file to dynamically load requirements from + ``st2client/requirements.txt`` file. The code works with pip >= 6.0.0, although using pip 9.0.0 + or higher is strongly recommended. (improvement) #4209 Fixed ~~~~~ From 264ba6e07317aa394c7b4ecd3bf25d17ee09ef46 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 3 Jul 2018 16:16:41 +0200 Subject: [PATCH 07/10] st2client doesn't require logshipper package to work. --- st2client/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/st2client/requirements.txt b/st2client/requirements.txt index 1f0a694696..f514d2b738 100644 --- a/st2client/requirements.txt +++ b/st2client/requirements.txt @@ -1,5 +1,4 @@ # Don't edit this file. It's generated automatically! -git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper argcomplete jsonpath-rw==1.4.0 prettytable From 62360d9a5d5bdcfb1623d6cc76c822902f22d70a Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 3 Jul 2018 16:20:06 +0200 Subject: [PATCH 08/10] st2client also depends on jsonschema. --- st2client/in-requirements.txt | 1 + st2client/requirements.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/st2client/in-requirements.txt b/st2client/in-requirements.txt index 3214109105..1bcf2d0b7a 100644 --- a/st2client/in-requirements.txt +++ b/st2client/in-requirements.txt @@ -4,6 +4,7 @@ prettytable pytz python-dateutil pyyaml +jsonschema jsonpath-rw requests six diff --git a/st2client/requirements.txt b/st2client/requirements.txt index f514d2b738..604d661fff 100644 --- a/st2client/requirements.txt +++ b/st2client/requirements.txt @@ -1,6 +1,7 @@ # Don't edit this file. It's generated automatically! argcomplete jsonpath-rw==1.4.0 +jsonschema==2.6.0 prettytable prompt-toolkit==1.0.15 python-dateutil From 61b47a5ec1615785746ee38d88a7c0195ca0567b Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 3 Jul 2018 21:15:04 +0200 Subject: [PATCH 09/10] Make trigger example more complete and also add payload_schema attribute to it. --- contrib/examples/triggers/sample-trigger.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/examples/triggers/sample-trigger.yaml b/contrib/examples/triggers/sample-trigger.yaml index ae140cad67..105e427cd3 100644 --- a/contrib/examples/triggers/sample-trigger.yaml +++ b/contrib/examples/triggers/sample-trigger.yaml @@ -1,3 +1,10 @@ --- name: sample_trigger description: Sample trigger +payload_schema: + type: "object" + properties: + executed_at: + type: "string" + format: "date-time" + default: "2014-07-30 05:04:24.578325" From fb41816d3c6bda2720ea61c79c1ad6fd61025e63 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 9 Jul 2018 12:50:23 +0200 Subject: [PATCH 10/10] Update CHANGELOG.rst --- CHANGELOG.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b8e216bb38..fffac28615 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,13 @@ Added * Add new ``?tags``, query param filter to the ``/v1/actions`` API endpoint. This query parameter allows users to filter out actions based on the tag name . By default, when no filter values are provided, all actions are returned. (new feature) #4219 + +Changed +~~~~~~~ + +* Update ``st2client/setup.py`` file to dynamically load requirements from + ``st2client/requirements.txt`` file. The code works with pip >= 6.0.0, although using pip 9.0.0 + or higher is strongly recommended. (improvement) #4209 2.8.0 - July 10, 2018 --------------------- @@ -76,9 +83,6 @@ Changed Note: This change is fully backward compatible since it just changes the underlying backend and implementation details. The same underlying encryption algorithm is used (AES256 in CBC mode with HMAC signature). (improvement) #4165 -* Update ``st2client/setup.py`` file to dynamically load requirements from - ``st2client/requirements.txt`` file. The code works with pip >= 6.0.0, although using pip 9.0.0 - or higher is strongly recommended. (improvement) #4209 Fixed ~~~~~