Skip to content

Commit

Permalink
better package management
Browse files Browse the repository at this point in the history
niosus committed Nov 21, 2016
1 parent 82d3038 commit 2276e07
Showing 5 changed files with 20 additions and 11 deletions.
13 changes: 9 additions & 4 deletions catkin_tools_fetch/cli.py
Original file line number Diff line number Diff line change
@@ -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.")
2 changes: 1 addition & 1 deletion catkin_tools_fetch/fetcher/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Module for fetching dependencies."""
__all__ = ["dependency_parser", "downloader"]
__all__ = ["dependency_parser", "downloader", "tools"]
2 changes: 1 addition & 1 deletion catkin_tools_fetch/fetcher/dependency_parser.py
Original file line number Diff line number Diff line change
@@ -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')

9 changes: 6 additions & 3 deletions catkin_tools_fetch/fetcher/downloader.py
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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',

0 comments on commit 2276e07

Please sign in to comment.