From a2744a206cf37d1004cb49bf0f8d8687f19f3fef Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 18:59:49 +0200 Subject: [PATCH 01/10] Update dist_utils.py so it doesn't depend on internal pip methods. This way it works with all recent pip versions. --- scripts/dist_utils.py | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/scripts/dist_utils.py b/scripts/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/scripts/dist_utils.py +++ b/scripts/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) From 7f7cdab9b4c5703f905b35d3884c5d59447e9664 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 19:08:53 +0200 Subject: [PATCH 02/10] Add tests for dist_utils.fetch_requirements. --- .../fixtures/requirements-used-for-tests.txt | 19 ++++++ st2common/tests/unit/test_dist_utils.py | 64 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 st2common/tests/fixtures/requirements-used-for-tests.txt create mode 100644 st2common/tests/unit/test_dist_utils.py diff --git a/st2common/tests/fixtures/requirements-used-for-tests.txt b/st2common/tests/fixtures/requirements-used-for-tests.txt new file mode 100644 index 0000000000..1a9b94352e --- /dev/null +++ b/st2common/tests/fixtures/requirements-used-for-tests.txt @@ -0,0 +1,19 @@ +# Don't edit this file. It's generated automatically! +RandomWords +amqp==2.4.2 +argcomplete +bcrypt==3.1.6 +flex==6.14.0 +# some +# more +# commments.... +git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper +git+https://github.com/StackStorm/orquesta.git@224c1a589a6007eb0598a62ee99d674e7836d369#egg=orquesta +git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient +git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file +gitpython==2.1.11 +ose-timer==0.7.5 +oslo.config<1.13,>=1.12.1 +requests[security]<2.23.0,>=2.22.0 +retrying==1.3.3 +zake==0.2.2 diff --git a/st2common/tests/unit/test_dist_utils.py b/st2common/tests/unit/test_dist_utils.py new file mode 100644 index 0000000000..0ea8d8b5be --- /dev/null +++ b/st2common/tests/unit/test_dist_utils.py @@ -0,0 +1,64 @@ +# Copyright 2019 Extreme Networks, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys + +import unittest2 + +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +SCRIPTS_PATH = os.path.join(BASE_DIR, '../../../scripts/') + +# Add scripts/ which contain main dist_utils.py to PYTHONPATH +sys.path.append(SCRIPTS_PATH) + +from dist_utils import fetch_requirements + +__all__ = [ + 'DistUtilsTestCase' +] + +REQUIREMENTS_PATH = os.path.join(BASE_DIR, '../fixtures/requirements-used-for-tests.txt') + + +class DistUtilsTestCase(unittest2.TestCase): + def test_fetch_requirements(self): + expected_reqs = [ + 'RandomWords', + 'amqp==2.4.2', + 'argcomplete', + 'bcrypt==3.1.6', + 'flex==6.14.0', + 'logshipper', + 'orquesta', + 'python-mistralclient', + 'st2-auth-backend-flat-file', + 'gitpython==2.1.11', + 'ose-timer==0.7.5', + 'oslo.config<1.13,>=1.12.1', + 'requests[security]<2.23.0,>=2.22.0', + 'retrying==1.3.3', + 'zake==0.2.2' + ] + expected_links = [ + 'git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper', + 'git+https://github.com/StackStorm/orquesta.git@224c1a589a6007eb0598a62ee99d674e7836d369#egg=orquesta', + 'git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient', + 'git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file' + ] + + reqs, links = fetch_requirements(REQUIREMENTS_PATH) + + self.assertEqual(reqs, expected_reqs) + self.assertEqual(links, expected_links) From 4fb6842235a396ad4fb7f27f54a5ef0364cb236b Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 19:09:26 +0200 Subject: [PATCH 03/10] Copy over latest dist_utils.py. --- .../runners/action_chain_runner/dist_utils.py | 34 ++++++++----------- .../runners/announcement_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/http_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/inquirer_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/local_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/mistral_v2/dist_utils.py | 34 ++++++++----------- contrib/runners/noop_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/orquesta_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/python_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/remote_runner/dist_utils.py | 34 ++++++++----------- contrib/runners/winrm_runner/dist_utils.py | 34 ++++++++----------- st2actions/dist_utils.py | 34 ++++++++----------- st2api/dist_utils.py | 34 ++++++++----------- st2auth/dist_utils.py | 34 ++++++++----------- st2client/dist_utils.py | 34 ++++++++----------- st2common/dist_utils.py | 34 ++++++++----------- st2debug/dist_utils.py | 34 ++++++++----------- st2exporter/dist_utils.py | 34 ++++++++----------- st2reactor/dist_utils.py | 34 ++++++++----------- st2stream/dist_utils.py | 34 ++++++++----------- st2tests/dist_utils.py | 34 ++++++++----------- 21 files changed, 294 insertions(+), 420 deletions(-) diff --git a/contrib/runners/action_chain_runner/dist_utils.py b/contrib/runners/action_chain_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/action_chain_runner/dist_utils.py +++ b/contrib/runners/action_chain_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/announcement_runner/dist_utils.py b/contrib/runners/announcement_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/announcement_runner/dist_utils.py +++ b/contrib/runners/announcement_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/http_runner/dist_utils.py b/contrib/runners/http_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/http_runner/dist_utils.py +++ b/contrib/runners/http_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/inquirer_runner/dist_utils.py b/contrib/runners/inquirer_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/inquirer_runner/dist_utils.py +++ b/contrib/runners/inquirer_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/local_runner/dist_utils.py b/contrib/runners/local_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/local_runner/dist_utils.py +++ b/contrib/runners/local_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/mistral_v2/dist_utils.py b/contrib/runners/mistral_v2/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/mistral_v2/dist_utils.py +++ b/contrib/runners/mistral_v2/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/noop_runner/dist_utils.py b/contrib/runners/noop_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/noop_runner/dist_utils.py +++ b/contrib/runners/noop_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/orquesta_runner/dist_utils.py b/contrib/runners/orquesta_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/orquesta_runner/dist_utils.py +++ b/contrib/runners/orquesta_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/python_runner/dist_utils.py b/contrib/runners/python_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/python_runner/dist_utils.py +++ b/contrib/runners/python_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/remote_runner/dist_utils.py b/contrib/runners/remote_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/remote_runner/dist_utils.py +++ b/contrib/runners/remote_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/contrib/runners/winrm_runner/dist_utils.py b/contrib/runners/winrm_runner/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/contrib/runners/winrm_runner/dist_utils.py +++ b/contrib/runners/winrm_runner/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2actions/dist_utils.py b/st2actions/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2actions/dist_utils.py +++ b/st2actions/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2api/dist_utils.py b/st2api/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2api/dist_utils.py +++ b/st2api/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2auth/dist_utils.py b/st2auth/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2auth/dist_utils.py +++ b/st2auth/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2client/dist_utils.py b/st2client/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2client/dist_utils.py +++ b/st2client/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2common/dist_utils.py b/st2common/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2common/dist_utils.py +++ b/st2common/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2debug/dist_utils.py b/st2debug/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2debug/dist_utils.py +++ b/st2debug/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2exporter/dist_utils.py b/st2exporter/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2exporter/dist_utils.py +++ b/st2exporter/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2reactor/dist_utils.py b/st2reactor/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2reactor/dist_utils.py +++ b/st2reactor/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2stream/dist_utils.py b/st2stream/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2stream/dist_utils.py +++ b/st2stream/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) diff --git a/st2tests/dist_utils.py b/st2tests/dist_utils.py index 63b868b145..1eb5afce3b 100644 --- a/st2tests/dist_utils.py +++ b/st2tests/dist_utils.py @@ -27,31 +27,18 @@ if PY3: text_type = str else: - text_type = unicode + text_type = unicode # NOQA GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' try: import pip - from pip import __version__ as pip_version except ImportError as e: print('Failed to import pip: %s' % (text_type(e))) print('') print('Download pip:\n%s' % (GET_PIP)) sys.exit(1) -try: - # pip < 10.0 - from pip.req import parse_requirements -except ImportError: - # pip >= 10.0 - - try: - from pip._internal.req.req_file import parse_requirements - except ImportError as e: - print('Failed to import parse_requirements from pip: %s' % (text_type(e))) - print('Using pip: %s' % (str(pip_version))) - sys.exit(1) __all__ = [ 'check_pip_version', @@ -80,12 +67,19 @@ def fetch_requirements(requirements_file_path): """ links = [] reqs = [] - for req in parse_requirements(requirements_file_path, session=False): - # 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)) + + with open(requirements_file_path, 'r') as fp: + for line in fp.readlines(): + line = line.strip() + + if line.startswith('#') or not line: + continue + + if line.startswith('git+'): + links.append(line) + else: + reqs.append(line) + return (reqs, links) From a3aa0635657a44c005c676a38d30ed3730079308 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 19:14:38 +0200 Subject: [PATCH 04/10] Add changelog entry. --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1046b4adb1..adb08ce0b3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -24,6 +24,8 @@ Fixed completed. (bug fix) #4735 * Added better error handling to `contrib/linux/actions/dig.py` to inform if dig is not installed. Contributed by JP Bourget (@punkrokk Syncurity) #4732 +* Update ``dist_utils`` module which is bundled with ``st2client`` and other Python packages so it + doesn't depend on internal pip API and so it works with latest pip version. (bug fix) #4750 3.1.0 - June 27, 2019 --------------------- From 82bb59e661d8f6daed702f7a7743a9f6e31a987b Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 19:35:35 +0200 Subject: [PATCH 05/10] Fix links handling, add support for non-git VCS requirements, add compatibility tests and verify the output of old and new function is the same. --- scripts/dist_utils.py | 22 ++++- scripts/dist_utils_old.py | 119 ++++++++++++++++++++++++ st2common/tests/unit/test_dist_utils.py | 16 +++- 3 files changed, 151 insertions(+), 6 deletions(-) create mode 100644 scripts/dist_utils_old.py diff --git a/scripts/dist_utils.py b/scripts/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/scripts/dist_utils.py +++ b/scripts/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/scripts/dist_utils_old.py b/scripts/dist_utils_old.py new file mode 100644 index 0000000000..63b868b145 --- /dev/null +++ b/scripts/dist_utils_old.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Extreme Networks, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import os +import re +import sys + +from distutils.version import StrictVersion + +# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here +PY3 = sys.version_info[0] == 3 + +if PY3: + text_type = str +else: + text_type = unicode + +GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python' + +try: + import pip + from pip import __version__ as pip_version +except ImportError as e: + print('Failed to import pip: %s' % (text_type(e))) + print('') + print('Download pip:\n%s' % (GET_PIP)) + sys.exit(1) + +try: + # pip < 10.0 + from pip.req import parse_requirements +except ImportError: + # pip >= 10.0 + + try: + from pip._internal.req.req_file import parse_requirements + except ImportError as e: + print('Failed to import parse_requirements from pip: %s' % (text_type(e))) + print('Using pip: %s' % (str(pip_version))) + sys.exit(1) + +__all__ = [ + 'check_pip_version', + 'fetch_requirements', + 'apply_vagrant_workaround', + 'get_version_string', + 'parse_version_string' +] + + +def check_pip_version(min_version='6.0.0'): + """ + Ensure that a minimum supported version of pip is installed. + """ + 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) + + +def fetch_requirements(requirements_file_path): + """ + Return a list of requirements and links by parsing the provided requirements file. + """ + links = [] + reqs = [] + for req in parse_requirements(requirements_file_path, session=False): + # 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) + + +def apply_vagrant_workaround(): + """ + Function which detects if the script is being executed inside vagrant and if it is, it deletes + "os.link" attribute. + Note: Without this workaround, setup.py sdist will fail when running inside a shared directory + (nfs / virtualbox shared folders). + """ + if os.environ.get('USER', None) == 'vagrant': + del os.link + + +def get_version_string(init_file): + """ + Read __version__ string for an init file. + """ + + with open(init_file, 'r') as fp: + content = fp.read() + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", + content, re.M) + if version_match: + return version_match.group(1) + + raise RuntimeError('Unable to find version string in %s.' % (init_file)) + + +# alias for get_version_string +parse_version_string = get_version_string diff --git a/st2common/tests/unit/test_dist_utils.py b/st2common/tests/unit/test_dist_utils.py index 0ea8d8b5be..f1bb066568 100644 --- a/st2common/tests/unit/test_dist_utils.py +++ b/st2common/tests/unit/test_dist_utils.py @@ -21,9 +21,10 @@ SCRIPTS_PATH = os.path.join(BASE_DIR, '../../../scripts/') # Add scripts/ which contain main dist_utils.py to PYTHONPATH -sys.path.append(SCRIPTS_PATH) +sys.path.insert(0, SCRIPTS_PATH) from dist_utils import fetch_requirements +from dist_utils_old import fetch_requirements as old_fetch_requirements __all__ = [ 'DistUtilsTestCase' @@ -53,12 +54,19 @@ def test_fetch_requirements(self): ] expected_links = [ 'git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper', - 'git+https://github.com/StackStorm/orquesta.git@224c1a589a6007eb0598a62ee99d674e7836d369#egg=orquesta', + 'git+https://github.com/StackStorm/orquesta.git@224c1a589a6007eb0598a62ee99d674e7836d369#egg=orquesta', # NOQA 'git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient', - 'git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file' + 'git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file' # NOQA ] reqs, links = fetch_requirements(REQUIREMENTS_PATH) - self.assertEqual(reqs, expected_reqs) self.assertEqual(links, expected_links) + + # Verify output of old and new function is the same + reqs_old, links_old = old_fetch_requirements(REQUIREMENTS_PATH) + + self.assertEqual(reqs_old, expected_reqs) + self.assertEqual(links_old, expected_links) + self.assertEqual(reqs_old, reqs) + self.assertEqual(links_old, links) From d713f384f6404b7c056d3c305b5c730249bb7d55 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 19:37:25 +0200 Subject: [PATCH 06/10] Copy over latest dist_utils.py. --- .../runners/action_chain_runner/dist_utils.py | 22 +++++++++++++++++-- .../runners/announcement_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/http_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/inquirer_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/local_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/mistral_v2/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/noop_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/orquesta_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/python_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/remote_runner/dist_utils.py | 22 +++++++++++++++++-- contrib/runners/winrm_runner/dist_utils.py | 22 +++++++++++++++++-- scripts/dist_utils_old.py | 7 ++++++ st2actions/dist_utils.py | 22 +++++++++++++++++-- st2api/dist_utils.py | 22 +++++++++++++++++-- st2auth/dist_utils.py | 22 +++++++++++++++++-- st2client/dist_utils.py | 22 +++++++++++++++++-- st2common/dist_utils.py | 22 +++++++++++++++++-- st2debug/dist_utils.py | 22 +++++++++++++++++-- st2exporter/dist_utils.py | 22 +++++++++++++++++-- st2reactor/dist_utils.py | 22 +++++++++++++++++-- st2stream/dist_utils.py | 22 +++++++++++++++++-- st2tests/dist_utils.py | 22 +++++++++++++++++-- 22 files changed, 427 insertions(+), 42 deletions(-) diff --git a/contrib/runners/action_chain_runner/dist_utils.py b/contrib/runners/action_chain_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/action_chain_runner/dist_utils.py +++ b/contrib/runners/action_chain_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/announcement_runner/dist_utils.py b/contrib/runners/announcement_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/announcement_runner/dist_utils.py +++ b/contrib/runners/announcement_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/http_runner/dist_utils.py b/contrib/runners/http_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/http_runner/dist_utils.py +++ b/contrib/runners/http_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/inquirer_runner/dist_utils.py b/contrib/runners/inquirer_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/inquirer_runner/dist_utils.py +++ b/contrib/runners/inquirer_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/local_runner/dist_utils.py b/contrib/runners/local_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/local_runner/dist_utils.py +++ b/contrib/runners/local_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/mistral_v2/dist_utils.py b/contrib/runners/mistral_v2/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/mistral_v2/dist_utils.py +++ b/contrib/runners/mistral_v2/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/noop_runner/dist_utils.py b/contrib/runners/noop_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/noop_runner/dist_utils.py +++ b/contrib/runners/noop_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/orquesta_runner/dist_utils.py b/contrib/runners/orquesta_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/orquesta_runner/dist_utils.py +++ b/contrib/runners/orquesta_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/python_runner/dist_utils.py b/contrib/runners/python_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/python_runner/dist_utils.py +++ b/contrib/runners/python_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/remote_runner/dist_utils.py b/contrib/runners/remote_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/remote_runner/dist_utils.py +++ b/contrib/runners/remote_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/contrib/runners/winrm_runner/dist_utils.py b/contrib/runners/winrm_runner/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/contrib/runners/winrm_runner/dist_utils.py +++ b/contrib/runners/winrm_runner/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/scripts/dist_utils_old.py b/scripts/dist_utils_old.py index 63b868b145..175a181f62 100644 --- a/scripts/dist_utils_old.py +++ b/scripts/dist_utils_old.py @@ -13,6 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +NOTE: This file is only used for backward compatibility tests with new dist_utils.py in +st2common/tests/unit/test_dist_utils.py. + +DO NOT USE THIS FILE ANYWHERE ELSE! +""" + from __future__ import absolute_import import os diff --git a/st2actions/dist_utils.py b/st2actions/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2actions/dist_utils.py +++ b/st2actions/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2api/dist_utils.py b/st2api/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2api/dist_utils.py +++ b/st2api/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2auth/dist_utils.py b/st2auth/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2auth/dist_utils.py +++ b/st2auth/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2client/dist_utils.py b/st2client/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2client/dist_utils.py +++ b/st2client/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2common/dist_utils.py b/st2common/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2common/dist_utils.py +++ b/st2common/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2debug/dist_utils.py b/st2debug/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2debug/dist_utils.py +++ b/st2debug/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2exporter/dist_utils.py b/st2exporter/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2exporter/dist_utils.py +++ b/st2exporter/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2reactor/dist_utils.py b/st2reactor/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2reactor/dist_utils.py +++ b/st2reactor/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2stream/dist_utils.py b/st2stream/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2stream/dist_utils.py +++ b/st2stream/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) diff --git a/st2tests/dist_utils.py b/st2tests/dist_utils.py index 1eb5afce3b..a9378867e0 100644 --- a/st2tests/dist_utils.py +++ b/st2tests/dist_utils.py @@ -68,6 +68,20 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] + def _is_link(line): + vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] + + for vcs_prefix in vcs_prefixes: + if line.startswith(vcs_prefix): + req_name = re.findall('.*#egg=(.+).*', line) + + if not req_name: + raise ValueError('Line "%s" is missing "#egg="' % (line)) + + return True, req_name[0] + + return False, None + with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): line = line.strip() @@ -75,10 +89,14 @@ def fetch_requirements(requirements_file_path): if line.startswith('#') or not line: continue - if line.startswith('git+'): + is_link, req_name = _is_link(line=line) + + if is_link: links.append(line) else: - reqs.append(line) + req_name = line + + reqs.append(req_name) return (reqs, links) From 1011b6be7eb31300b22584aa14b39c58adae605b Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 19:39:38 +0200 Subject: [PATCH 07/10] Add additional test case with top-level requirements.txt. --- st2common/tests/unit/test_dist_utils.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/st2common/tests/unit/test_dist_utils.py b/st2common/tests/unit/test_dist_utils.py index f1bb066568..230922c9fa 100644 --- a/st2common/tests/unit/test_dist_utils.py +++ b/st2common/tests/unit/test_dist_utils.py @@ -30,7 +30,8 @@ 'DistUtilsTestCase' ] -REQUIREMENTS_PATH = os.path.join(BASE_DIR, '../fixtures/requirements-used-for-tests.txt') +REQUIREMENTS_PATH_1 = os.path.join(BASE_DIR, '../fixtures/requirements-used-for-tests.txt') +REQUIREMENTS_PATH_2 = os.path.join(BASE_DIR, '../../../requirements.txt') class DistUtilsTestCase(unittest2.TestCase): @@ -59,14 +60,22 @@ def test_fetch_requirements(self): 'git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file' # NOQA ] - reqs, links = fetch_requirements(REQUIREMENTS_PATH) + reqs, links = fetch_requirements(REQUIREMENTS_PATH_1) self.assertEqual(reqs, expected_reqs) self.assertEqual(links, expected_links) # Verify output of old and new function is the same - reqs_old, links_old = old_fetch_requirements(REQUIREMENTS_PATH) + reqs_old, links_old = old_fetch_requirements(REQUIREMENTS_PATH_1) self.assertEqual(reqs_old, expected_reqs) self.assertEqual(links_old, expected_links) + + self.assertEqual(reqs_old, reqs) + self.assertEqual(links_old, links) + + # Also test it on requirements.txt in repo root + reqs, links = fetch_requirements(REQUIREMENTS_PATH_2) + reqs_old, links_old = old_fetch_requirements(REQUIREMENTS_PATH_2) + self.assertEqual(reqs_old, reqs) self.assertEqual(links_old, links) From 6d6384afa85e2e655a93a9682ef77f4df36edc7b Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 19:58:39 +0200 Subject: [PATCH 08/10] Add support for editable links and lines with &subdirectory=foo pragma. --- scripts/dist_utils.py | 22 ++++++++++++------- .../fixtures/requirements-used-for-tests.txt | 4 ++++ st2common/tests/unit/test_dist_utils.py | 10 ++++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/scripts/dist_utils.py b/scripts/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/scripts/dist_utils.py +++ b/scripts/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2common/tests/fixtures/requirements-used-for-tests.txt b/st2common/tests/fixtures/requirements-used-for-tests.txt index 1a9b94352e..58352b169c 100644 --- a/st2common/tests/fixtures/requirements-used-for-tests.txt +++ b/st2common/tests/fixtures/requirements-used-for-tests.txt @@ -11,6 +11,10 @@ git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper git+https://github.com/StackStorm/orquesta.git@224c1a589a6007eb0598a62ee99d674e7836d369#egg=orquesta git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file +-e git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper-editable +git+https://github.com/StackStorm/st2.git#egg=python_runner&subdirectory=contrib/runners/python_runner +hg+https://hg.repo/some_pkg.git#egg=SomePackageHq +svn+svn://svn.repo/some_pkg/trunk/@ma-branch#egg=SomePackageSvn gitpython==2.1.11 ose-timer==0.7.5 oslo.config<1.13,>=1.12.1 diff --git a/st2common/tests/unit/test_dist_utils.py b/st2common/tests/unit/test_dist_utils.py index 230922c9fa..72f7aeb694 100644 --- a/st2common/tests/unit/test_dist_utils.py +++ b/st2common/tests/unit/test_dist_utils.py @@ -46,6 +46,10 @@ def test_fetch_requirements(self): 'orquesta', 'python-mistralclient', 'st2-auth-backend-flat-file', + 'logshipper-editable', + 'python_runner', + 'SomePackageHq', + 'SomePackageSvn', 'gitpython==2.1.11', 'ose-timer==0.7.5', 'oslo.config<1.13,>=1.12.1', @@ -57,7 +61,11 @@ def test_fetch_requirements(self): 'git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper', 'git+https://github.com/StackStorm/orquesta.git@224c1a589a6007eb0598a62ee99d674e7836d369#egg=orquesta', # NOQA 'git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient', - 'git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file' # NOQA + 'git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file', # NOQA + 'git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper-editable', + 'git+https://github.com/StackStorm/st2.git#egg=python_runner&subdirectory=contrib/runners/python_runner', # NOQA + 'hg+https://hg.repo/some_pkg.git#egg=SomePackageHq', + 'svn+svn://svn.repo/some_pkg/trunk/@ma-branch#egg=SomePackageSvn' ] reqs, links = fetch_requirements(REQUIREMENTS_PATH_1) From 893b3058ed3dcb6682be133fea3ea9e4fc438443 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 20:01:35 +0200 Subject: [PATCH 09/10] Copy over latest dist_utils.py. --- .../runners/action_chain_runner/dist_utils.py | 22 ++++++++++++------- .../runners/announcement_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/http_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/inquirer_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/local_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/mistral_v2/dist_utils.py | 22 ++++++++++++------- contrib/runners/noop_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/orquesta_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/python_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/remote_runner/dist_utils.py | 22 ++++++++++++------- contrib/runners/winrm_runner/dist_utils.py | 22 ++++++++++++------- st2actions/dist_utils.py | 22 ++++++++++++------- st2api/dist_utils.py | 22 ++++++++++++------- st2auth/dist_utils.py | 22 ++++++++++++------- st2client/dist_utils.py | 22 ++++++++++++------- st2common/dist_utils.py | 22 ++++++++++++------- st2debug/dist_utils.py | 22 ++++++++++++------- st2exporter/dist_utils.py | 22 ++++++++++++------- st2reactor/dist_utils.py | 22 ++++++++++++------- st2stream/dist_utils.py | 22 ++++++++++++------- st2tests/dist_utils.py | 22 ++++++++++++------- 21 files changed, 294 insertions(+), 168 deletions(-) diff --git a/contrib/runners/action_chain_runner/dist_utils.py b/contrib/runners/action_chain_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/action_chain_runner/dist_utils.py +++ b/contrib/runners/action_chain_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/announcement_runner/dist_utils.py b/contrib/runners/announcement_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/announcement_runner/dist_utils.py +++ b/contrib/runners/announcement_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/http_runner/dist_utils.py b/contrib/runners/http_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/http_runner/dist_utils.py +++ b/contrib/runners/http_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/inquirer_runner/dist_utils.py b/contrib/runners/inquirer_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/inquirer_runner/dist_utils.py +++ b/contrib/runners/inquirer_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/local_runner/dist_utils.py b/contrib/runners/local_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/local_runner/dist_utils.py +++ b/contrib/runners/local_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/mistral_v2/dist_utils.py b/contrib/runners/mistral_v2/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/mistral_v2/dist_utils.py +++ b/contrib/runners/mistral_v2/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/noop_runner/dist_utils.py b/contrib/runners/noop_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/noop_runner/dist_utils.py +++ b/contrib/runners/noop_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/orquesta_runner/dist_utils.py b/contrib/runners/orquesta_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/orquesta_runner/dist_utils.py +++ b/contrib/runners/orquesta_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/python_runner/dist_utils.py b/contrib/runners/python_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/python_runner/dist_utils.py +++ b/contrib/runners/python_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/remote_runner/dist_utils.py b/contrib/runners/remote_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/remote_runner/dist_utils.py +++ b/contrib/runners/remote_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/contrib/runners/winrm_runner/dist_utils.py b/contrib/runners/winrm_runner/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/contrib/runners/winrm_runner/dist_utils.py +++ b/contrib/runners/winrm_runner/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2actions/dist_utils.py b/st2actions/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2actions/dist_utils.py +++ b/st2actions/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2api/dist_utils.py b/st2api/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2api/dist_utils.py +++ b/st2api/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2auth/dist_utils.py b/st2auth/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2auth/dist_utils.py +++ b/st2auth/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2client/dist_utils.py b/st2client/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2client/dist_utils.py +++ b/st2client/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2common/dist_utils.py b/st2common/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2common/dist_utils.py +++ b/st2common/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2debug/dist_utils.py b/st2debug/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2debug/dist_utils.py +++ b/st2debug/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2exporter/dist_utils.py b/st2exporter/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2exporter/dist_utils.py +++ b/st2exporter/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2reactor/dist_utils.py b/st2reactor/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2reactor/dist_utils.py +++ b/st2reactor/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2stream/dist_utils.py b/st2stream/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2stream/dist_utils.py +++ b/st2stream/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line diff --git a/st2tests/dist_utils.py b/st2tests/dist_utils.py index a9378867e0..6e9fbfcb52 100644 --- a/st2tests/dist_utils.py +++ b/st2tests/dist_utils.py @@ -68,19 +68,25 @@ def fetch_requirements(requirements_file_path): links = [] reqs = [] - def _is_link(line): + def _get_link(line): vcs_prefixes = ['git+', 'svn+', 'hg+', 'bzr+'] for vcs_prefix in vcs_prefixes: - if line.startswith(vcs_prefix): - req_name = re.findall('.*#egg=(.+).*', line) + if line.startswith(vcs_prefix) or line.startswith('-e %s' % (vcs_prefix)): + req_name = re.findall('.*#egg=(.+)([&|@]).*$', line) + + if not req_name: + req_name = re.findall('.*#egg=(.+?)$', line) + else: + req_name = req_name[0] if not req_name: raise ValueError('Line "%s" is missing "#egg="' % (line)) - return True, req_name[0] + link = line.replace('-e ', '').strip() + return link, req_name[0] - return False, None + return None, None with open(requirements_file_path, 'r') as fp: for line in fp.readlines(): @@ -89,10 +95,10 @@ def _is_link(line): if line.startswith('#') or not line: continue - is_link, req_name = _is_link(line=line) + link, req_name = _get_link(line=line) - if is_link: - links.append(line) + if link: + links.append(link) else: req_name = line From 9d63f852bfea9d237a994541590dc47264e5f556 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 28 Jul 2019 20:11:40 +0200 Subject: [PATCH 10/10] Include auto-generated warning in the copied over files. --- Makefile | 1 + contrib/runners/action_chain_runner/dist_utils.py | 1 + contrib/runners/announcement_runner/dist_utils.py | 1 + contrib/runners/http_runner/dist_utils.py | 1 + contrib/runners/inquirer_runner/dist_utils.py | 1 + contrib/runners/local_runner/dist_utils.py | 1 + contrib/runners/mistral_v2/dist_utils.py | 1 + contrib/runners/noop_runner/dist_utils.py | 1 + contrib/runners/orquesta_runner/dist_utils.py | 1 + contrib/runners/python_runner/dist_utils.py | 1 + contrib/runners/remote_runner/dist_utils.py | 1 + contrib/runners/winrm_runner/dist_utils.py | 1 + st2actions/dist_utils.py | 1 + st2api/dist_utils.py | 1 + st2auth/dist_utils.py | 1 + st2client/dist_utils.py | 1 + st2common/dist_utils.py | 1 + st2debug/dist_utils.py | 1 + st2exporter/dist_utils.py | 1 + st2reactor/dist_utils.py | 1 + st2stream/dist_utils.py | 1 + st2tests/dist_utils.py | 1 + 22 files changed, 22 insertions(+) diff --git a/Makefile b/Makefile index 3b6f5b5fba..f6880e1b79 100644 --- a/Makefile +++ b/Makefile @@ -847,6 +847,7 @@ debs: # Copy over shared dist utils module which is needed by setup.py @for component in $(COMPONENTS_WITH_RUNNERS); do\ cp -f ./scripts/dist_utils.py $$component/dist_utils.py;\ + sed -i -e '1s;^;# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY\n;' $$component/dist_utils.py;\ done # Copy over CHANGELOG.RST, CONTRIBUTING.RST and LICENSE file to each component directory diff --git a/contrib/runners/action_chain_runner/dist_utils.py b/contrib/runners/action_chain_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/action_chain_runner/dist_utils.py +++ b/contrib/runners/action_chain_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/announcement_runner/dist_utils.py b/contrib/runners/announcement_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/announcement_runner/dist_utils.py +++ b/contrib/runners/announcement_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/http_runner/dist_utils.py b/contrib/runners/http_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/http_runner/dist_utils.py +++ b/contrib/runners/http_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/inquirer_runner/dist_utils.py b/contrib/runners/inquirer_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/inquirer_runner/dist_utils.py +++ b/contrib/runners/inquirer_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/local_runner/dist_utils.py b/contrib/runners/local_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/local_runner/dist_utils.py +++ b/contrib/runners/local_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/mistral_v2/dist_utils.py b/contrib/runners/mistral_v2/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/mistral_v2/dist_utils.py +++ b/contrib/runners/mistral_v2/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/noop_runner/dist_utils.py b/contrib/runners/noop_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/noop_runner/dist_utils.py +++ b/contrib/runners/noop_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/orquesta_runner/dist_utils.py b/contrib/runners/orquesta_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/orquesta_runner/dist_utils.py +++ b/contrib/runners/orquesta_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/python_runner/dist_utils.py b/contrib/runners/python_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/python_runner/dist_utils.py +++ b/contrib/runners/python_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/remote_runner/dist_utils.py b/contrib/runners/remote_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/remote_runner/dist_utils.py +++ b/contrib/runners/remote_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/contrib/runners/winrm_runner/dist_utils.py b/contrib/runners/winrm_runner/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/contrib/runners/winrm_runner/dist_utils.py +++ b/contrib/runners/winrm_runner/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2actions/dist_utils.py b/st2actions/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2actions/dist_utils.py +++ b/st2actions/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2api/dist_utils.py b/st2api/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2api/dist_utils.py +++ b/st2api/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2auth/dist_utils.py b/st2auth/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2auth/dist_utils.py +++ b/st2auth/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2client/dist_utils.py b/st2client/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2client/dist_utils.py +++ b/st2client/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2common/dist_utils.py b/st2common/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2common/dist_utils.py +++ b/st2common/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2debug/dist_utils.py b/st2debug/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2debug/dist_utils.py +++ b/st2debug/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2exporter/dist_utils.py b/st2exporter/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2exporter/dist_utils.py +++ b/st2exporter/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2reactor/dist_utils.py b/st2reactor/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2reactor/dist_utils.py +++ b/st2reactor/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2stream/dist_utils.py b/st2stream/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2stream/dist_utils.py +++ b/st2stream/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. # diff --git a/st2tests/dist_utils.py b/st2tests/dist_utils.py index 6e9fbfcb52..370d5e0550 100644 --- a/st2tests/dist_utils.py +++ b/st2tests/dist_utils.py @@ -1,3 +1,4 @@ +# NOTE: This file is auto-generated - DO NOT EDIT MANUALLY # -*- coding: utf-8 -*- # Copyright 2019 Extreme Networks, Inc. #