diff --git a/catkin_tools_fetch/cli.py b/catkin_tools_fetch/cli.py index 83a8ac6..7109f84 100644 --- a/catkin_tools_fetch/cli.py +++ b/catkin_tools_fetch/cli.py @@ -20,9 +20,9 @@ from catkin_tools.argument_parsing import add_context_args from catkin_tools.context import Context -from .fetcher.dependency_parser import Parser -from .fetcher.downloader import Downloader -from .fetcher.tools import Tools +from catkin_tools_fetch.fetcher.dependency_parser import Parser +from catkin_tools_fetch.fetcher.downloader import Downloader +from catkin_tools_fetch.fetcher.tools import Tools logging.basicConfig() log = logging.getLogger('fetch') @@ -146,7 +146,12 @@ def fetch(packages, workspace, context, default_url): package_folder = path.join(ws_path, package_path) deps_to_fetch.update(parser.get_dependencies(package_folder)) already_fetched.add(package.name) - downloader = Downloader(ws_path, available_pkgs, ignore_pkgs) + try: + downloader = Downloader(ws_path, available_pkgs, ignore_pkgs) + except ValueError as e: + log.critical(" Encountered error. Abort.") + log.critical(" Error message: %s", e.message) + return 1 error_code = downloader.download_dependencies(deps_to_fetch) if len(already_fetched) == initial_cloned_pkgs: log.info(" No new dependencies. Done.") diff --git a/catkin_tools_fetch/fetcher/__init__.py b/catkin_tools_fetch/fetcher/__init__.py index e1cc2cb..fb7dead 100644 --- a/catkin_tools_fetch/fetcher/__init__.py +++ b/catkin_tools_fetch/fetcher/__init__.py @@ -1,2 +1,2 @@ """Module for fetching dependencies.""" -__all__ = ["dependency_parser", "downloader"] +__all__ = ["dependency_parser", "downloader", "tools"] diff --git a/catkin_tools_fetch/fetcher/dependency_parser.py b/catkin_tools_fetch/fetcher/dependency_parser.py index c69f27d..3d1739a 100644 --- a/catkin_tools_fetch/fetcher/dependency_parser.py +++ b/catkin_tools_fetch/fetcher/dependency_parser.py @@ -8,7 +8,7 @@ from os import path from xml.dom import minidom -from .tools import Tools +from catkin_tools_fetch.fetcher.tools import Tools log = logging.getLogger('fetch') diff --git a/catkin_tools_fetch/fetcher/downloader.py b/catkin_tools_fetch/fetcher/downloader.py index 7b0499c..c2b104f 100644 --- a/catkin_tools_fetch/fetcher/downloader.py +++ b/catkin_tools_fetch/fetcher/downloader.py @@ -9,7 +9,7 @@ from os import path from subprocess import PIPE -from .tools import Tools +from catkin_tools_fetch.fetcher.tools import Tools log = logging.getLogger('fetch') @@ -41,11 +41,14 @@ def __init__(self, ws_path, available_pkgs, ignore_pkgs): Args: ws_path (str): Workspace path. This is where packages live. available_pkgs (iterable): dict of available packages in workspace. - ignore_pkgs (iterable): a set of packages to ignore (e.g. ROS ones). + ignore_pkgs (iterable): set of packages to ignore (e.g. ROS ones). """ super(Downloader, self).__init__() if not path.exists(ws_path): - raise ValueError("workspace '{}' does not exist".format(ws_path)) + raise ValueError(""" + Folder '{}' is missing. + Are you running 'fetch' from a catkin workspace? + """.format(ws_path)) self.ws_path = ws_path self.available_pkgs = available_pkgs self.ignore_pkgs = ignore_pkgs diff --git a/setup.py b/setup.py index e247917..40dc266 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from stat import ST_MODE from distutils import log from setuptools import setup +from setuptools import find_packages from setuptools.command.install import install # Setup installation dependencies @@ -36,12 +37,12 @@ def run(self): os.chmod(file, mode) -version_str = '0.0.4' +version_str = '0.0.5' github_url = 'https://github.com/niosus/catkin_tools_fetch' setup( name='catkin_tools_fetch', - packages=['catkin_tools_fetch'], + packages=find_packages(exclude=['tests', 'docs']), version=version_str, install_requires=install_requires, author='Igor Bogoslavskyi',