diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7e89b716c8..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 --------------------- 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" 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/scripts/dist_utils.py b/scripts/dist_utils.py index ede9e4a358..965e6387da 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) @@ -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/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 diff --git a/st2client/setup.py b/st2client/setup.py index f673d207d3..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,15 +53,8 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7' ], - install_requires=[ - 'jsonpath-rw>=1.3.0', - 'prettytable', - 'python-dateutil', - 'pyyaml<4.0,>=3.11', - 'requests[security]<2.15,>=2.14.1', - 'six==1.11.0' - ], - dependency_links=[], + install_requires=install_reqs, + dependency_links=dep_links, test_suite=ST2_COMPONENT, zip_safe=False, include_package_data=True, 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)