Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions bloom/commands/export_upstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@
from bloom.util import handle_global_arguments
from bloom.util import temporary_directory

try:
from vcstools.vcs_abstraction import get_vcs_client
except ImportError:
debug(traceback.format_exc())
error("vcstools was not detected, please install it.", file=sys.stderr,
exit=True)
from bloom.vcs import get_vcs_client


def get_argument_parser():
Expand Down
7 changes: 1 addition & 6 deletions bloom/commands/git/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@
from bloom.util import quiet_git_clone_warning
from bloom.util import safe_input

try:
from vcstools.vcs_abstraction import get_vcs_client
except ImportError:
debug(traceback.format_exc())
error("vcstools was not detected, please install it.", file=sys.stderr,
exit=True)
from bloom.vcs import get_vcs_client

upstream_repos = {}

Expand Down
16 changes: 6 additions & 10 deletions bloom/commands/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,9 @@
from bloom.util import temporary_directory
from bloom.util import to_unicode

try:
import vcstools
except ImportError:
debug(traceback.format_exc())
error("vcstools was not detected, please install it.", file=sys.stderr,
exit=True)
import vcstools.__version__
from vcstools.vcs_abstraction import get_vcs_client
from bloom.vcs import get_vcs_client
from bloom.vcs import vcs_name
from bloom.vcs import vcs_version

from rosdistro import DistributionFile
from rosdistro import get_distribution_files
Expand Down Expand Up @@ -854,7 +849,7 @@ def update_summary(track, repository, distro):
- catkin_pkg version: `{catkin_pkg_v}`
- rosdep version: `{rosdep_v}`
- rosdistro version: `{rosdistro_v}`
- vcstools version: `{vcstools_v}`
- {vcs_n} version: `{vcs_v}`
""".format(
repo=repository,
upstream_repo_url=track_dict['vcs_uri'],
Expand All @@ -867,7 +862,8 @@ def update_summary(track, repository, distro):
# Until https://github.com/ros-infrastructure/rosdistro/issues/16
rosdistro_v=pkg_resources.require("rosdistro")[0].version,
rosdep_v=rosdep2.__version__,
vcstools_v=vcstools.__version__.version
vcs_n=vcs_name,
vcs_v=vcs_version
)
summary_file.write(msg)

Expand Down
71 changes: 71 additions & 0 deletions bloom/vcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Software License Agreement (BSD License)
#
# Copyright (c) 2022, Open Source Robotics Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of Open Source Robotics Foundation, Inc. nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from bloom.logging import debug
from bloom.logging import error

try:
from vcstool import __version__ as vcs_version
from vcstool.clients import vcstool_clients
from vcstool.commands.import_ import ImportCommand
except ImportError:
try:
from vcstools import __version__ as vcs_version
from vcstools.vcs_abstraction import get_vcs_client
except ImportError:
debug(traceback.format_exc())
error("vcstool nor vcstools were detected, please install one.",
file=sys.stderr, exit=True)
else:
vcs_name = 'vcstools'
else:
vcs_name = 'vcstool'

from argparse import Namespace

def _checkout_adapter(self, url, version=None,
verbose=False, shallow=False, timeout=None):
args = Namespace(force=False, retry=2, skip_existing=False, path=self.path)
command = ImportCommand(args, url, version, True, shallow)
return self.import_(command)['returncode'] == 0

def get_vcs_client(vcs_type, path):
vcs_class = [c for c in vcstool_clients if c.type == vcs_type]
if not vcs_class:
raise ValueError(
'No Client type registered for vcs type "%s"' % vcs_type)

client = vcs_class[0](path)
client.checkout = lambda *args, **kwargs: _checkout_adapter(client, *args, **kwargs)
client.get_path = lambda: client.path
return client
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'PyYAML',
'rosdep >= 0.15.0',
'rosdistro >= 0.8.0',
'vcstools >= 0.1.22',
'vcstool >= 0.3.0',
],
extras_require={
'test': [
Expand Down
8 changes: 2 additions & 6 deletions test/system_tests/test_catkin_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
import re
import sys

try:
from vcstools.vcs_abstraction import get_vcs_client
except ImportError:
print("vcstools was not detected, please install it.", file=sys.stderr)
sys.exit(1)

from .common import create_release_repo

from ..utils.common import bloom_answer
Expand All @@ -34,6 +28,8 @@

from bloom.generators.debian.generator import sanitize_package_name

from bloom.vcs import get_vcs_client


def create_upstream_repository(packages, directory=None, format_versions=None):
upstream_dir = 'upstream_repo_melodic'
Expand Down
Loading