From 1f42d344fe4222305b02dc7d8e81925d18048036 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 20 Nov 2016 14:05:29 +0900 Subject: [PATCH 1/2] add --skip-pip options --- bloom/commands/release.py | 5 +++++ bloom/generators/common.py | 7 +++++++ bloom/generators/debian/generator.py | 5 ++++- bloom/generators/rpm/generator.py | 5 ++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bloom/commands/release.py b/bloom/commands/release.py index d6c33caa..049147ef 100644 --- a/bloom/commands/release.py +++ b/bloom/commands/release.py @@ -1259,6 +1259,8 @@ def get_argument_parser(): help="Pretends to push and release") add('--no-web', default=False, action='store_true', help="prevents a web browser from being opened at the end") + add('--skip-pip', default=False, action='store_true', + help="skip all pip rosdep keys") add('--pull-request-only', '-p', default=False, action='store_true', help="skips the release actions and only tries to open a pull request") add('--override-release-repository-url', default=None, @@ -1285,6 +1287,9 @@ def main(sysargs=None): if args.no_web: os.environ['BLOOM_NO_WEBBROWSER'] = '1' + if args.skip_pip: + os.environ['BLOOM_SKIP_PIP'] = '1' + try: os.environ['BLOOM_TRACK'] = args.track disable_git_clone(True) diff --git a/bloom/generators/common.py b/bloom/generators/common.py index 034001d1..b3c148da 100644 --- a/bloom/generators/common.py +++ b/bloom/generators/common.py @@ -32,6 +32,7 @@ from __future__ import print_function +from os import environ import pkg_resources import sys import traceback @@ -39,6 +40,7 @@ from bloom.logging import debug from bloom.logging import error from bloom.logging import info +from bloom.logging import warning from bloom.util import code from bloom.util import maybe_continue @@ -114,6 +116,11 @@ def resolve_more_for_os(rosdep_key, view, installer, os_name, os_version): os_installers, default_os_installer) assert inst_key in os_installers + if 'BLOOM_SKIP_PIP' in environ and environ['BLOOM_SKIP_PIP'] == '1' and inst_key == 'pip': + warning("Key '{0}' resolved to '{1}' with installer '{2}' for os '{3}' '{4}', " + "but with the 'BLOOM_SKIP_PIP' environment variable set, this key is intentionally skipped." + .format(rosdep_key, installer.resolve(rule), inst_key, os_name, os_version)) + return [], inst_key, default_os_installer return installer.resolve(rule), inst_key, default_os_installer diff --git a/bloom/generators/debian/generator.py b/bloom/generators/debian/generator.py index c6e3f268..51d91554 100644 --- a/bloom/generators/debian/generator.py +++ b/bloom/generators/debian/generator.py @@ -611,7 +611,10 @@ def _check_all_keys_are_valid(self, peer_packages): retry=False) if rule is None: continue - if installer_key != default_installer_key: + if 'BLOOM_SKIP_PIP' in os.environ and os.environ['BLOOM_SKIP_PIP'] == '1' and \ + installer_key == 'pip': + pass + elif installer_key != default_installer_key: error("Key '{0}' resolved to '{1}' with installer '{2}', " "which does not match the default installer '{3}'." .format(key, rule, installer_key, default_installer_key)) diff --git a/bloom/generators/rpm/generator.py b/bloom/generators/rpm/generator.py index 9ba05c0d..3b37841a 100644 --- a/bloom/generators/rpm/generator.py +++ b/bloom/generators/rpm/generator.py @@ -511,7 +511,10 @@ def _check_all_keys_are_valid(self, peer_packages): retry=False) if rule is None: continue - if installer_key != default_installer_key: + if 'BLOOM_SKIP_PIP' in os.environ and os.environ['BLOOM_SKIP_PIP'] == '1' and \ + installer_key == 'pip': + pass + elif installer_key != default_installer_key: error("Key '{0}' resolved to '{1}' with installer '{2}', " "which does not match the default installer '{3}'." .format(key, rule, installer_key, default_installer_key)) From 77a891114b8878c8c193822f746a2579ccc0fa63 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Fri, 16 Aug 2024 17:49:47 +0900 Subject: [PATCH 2/2] add --skip-pip option to generators/debian/generate_cmd.py, for bloom-generate rosdebian --- bloom/generators/debian/generate_cmd.py | 3 +++ bloom/generators/rpm/generate_cmd.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bloom/generators/debian/generate_cmd.py b/bloom/generators/debian/generate_cmd.py index 19d036d3..1b26b9ca 100644 --- a/bloom/generators/debian/generate_cmd.py +++ b/bloom/generators/debian/generate_cmd.py @@ -67,6 +67,7 @@ def prepare_arguments(parser): help="path to or containing the package.xml of a package") action = parser.add_mutually_exclusive_group(required=False) add = action.add_argument + add('--skip-pip', default=False, action='store_true', help="skip all pip rosdep keys") add('--place-template-files', action='store_true', help="places debian/* template files only") add('--process-template-files', action='store_true', @@ -107,6 +108,8 @@ def main(args=None, get_subs_fn=None): os_data = create_default_installer_context().get_os_name_and_version() os_name, os_version = os_data ros_distro = os.environ.get('ROS_DISTRO', 'indigo') + if args.skip_pip: + os.environ['BLOOM_SKIP_PIP'] = '1' # Allow args overrides os_name = args.os_name or os_name diff --git a/bloom/generators/rpm/generate_cmd.py b/bloom/generators/rpm/generate_cmd.py index b219d4c3..30cdd029 100644 --- a/bloom/generators/rpm/generate_cmd.py +++ b/bloom/generators/rpm/generate_cmd.py @@ -67,6 +67,7 @@ def prepare_arguments(parser): help="path to or containing the package.xml of a package") action = parser.add_mutually_exclusive_group(required=False) add = action.add_argument + add('--skip-pip', default=False, action='store_true', help="skip all pip rosdep keys") add('--place-template-files', action='store_true', help="places rpm/* template file(s) only") add('--process-template-files', action='store_true', @@ -107,6 +108,8 @@ def main(args=None, get_subs_fn=None): os_data = create_default_installer_context().get_os_name_and_version() os_name, os_version = os_data ros_distro = os.environ.get('ROS_DISTRO', 'indigo') + if args.skip_pip: + os.environ['BLOOM_SKIP_PIP'] = '1' # Allow args overrides os_name = args.os_name or os_name