[ros-wstool] 01/04: Imported Upstream version 0.1.13

Jochen Sprickerhof jspricke-guest at moszumanska.debian.org
Sat Jun 18 08:33:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

jspricke-guest pushed a commit to annotated tag debian/0.1.13-1
in repository ros-wstool.

commit e58d7e16e9cd7377f09f890393b210ce7487e4bf
Author: Jochen Sprickerhof <git at jochen.sprickerhof.de>
Date:   Sat Jun 18 10:27:06 2016 +0200

    Imported Upstream version 0.1.13
---
 doc/changelog.rst              |  8 ++++++++
 setup.py                       | 19 +++++++++++++++----
 src/wstool/__version__.py      |  2 +-
 src/wstool/cli_common.py       | 41 +++++++++++++++++++++--------------------
 src/wstool/multiproject_cli.py | 42 ++++++++++++++++++++++++++++++++++++------
 src/wstool/multiproject_cmd.py | 37 ++++++++++++++++++++++++++++---------
 stdeb.cfg                      |  2 +-
 7 files changed, 110 insertions(+), 41 deletions(-)

diff --git a/doc/changelog.rst b/doc/changelog.rst
index c9423e6..f525c99 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -1,3 +1,11 @@
+0.1.13
+------
+
+- Fix to avoid errors due to installing man pages with OS X's 10.11's new SIP settings.
+- Added option to show a simplified version info table.
+- Added the -m (timeout), -v (verbose), and -j (parallel jobs) options to each command.
+- Contributors: @NikolausDemmel, @wkentaro
+
 0.1.12
 ------
 
diff --git a/setup.py b/setup.py
index 2205607..16d6a3a 100644
--- a/setup.py
+++ b/setup.py
@@ -21,20 +21,23 @@ def get_version():
 
 
 def _resolve_prefix(prefix, type):
+    # install to outside of system if OS X to avoid issues caused by
+    # System Integrity Protection on El Caption
+    # issue: https://github.com/vcstools/wstool/issues/81
     osx_system_prefix = '/System/Library/Frameworks/Python.framework/Versions'
     if type == 'man':
         if prefix == '/usr':
             return '/usr/share'
         if sys.prefix.startswith(osx_system_prefix):
-            return '/usr/share'
+            return '/usr/local/share'
     elif type == 'bash_comp':
         if prefix == '/usr':
             return '/'
         if sys.prefix.startswith(osx_system_prefix):
-            return '/'
+            return '/usr/local'
     elif type == 'zsh_comp':
         if sys.prefix.startswith(osx_system_prefix):
-            return '/usr'
+            return '/usr/local'
     else:
         raise ValueError('not supported type')
     return prefix
@@ -96,6 +99,14 @@ if HAVE_SPHINX:
 else:
     cmdclass = {}
 
+
+install_requires = ['vcstools>=0.1.38', 'pyyaml']
+try:
+    from collections import OrderedDict
+except ImportError:
+    install_requires.append('ordereddict')  # for python<=2.6
+
+
 setup(name='wstool',
       version=get_version(),
       packages=['wstool'],
@@ -103,7 +114,7 @@ setup(name='wstool',
       data_files=data_files,
       cmdclass=cmdclass,
       # rosinstall dependency to be kept in order not to break ros hydro install instructions
-      install_requires=['vcstools>=0.1.38', 'pyyaml'],
+      install_requires=install_requires,
       scripts=["scripts/wstool"],
       author="Tully Foote",
       author_email="tfoote at osrfoundation.org",
diff --git a/src/wstool/__version__.py b/src/wstool/__version__.py
index 54098e9..c4084fe 100644
--- a/src/wstool/__version__.py
+++ b/src/wstool/__version__.py
@@ -1 +1 @@
-version = '0.1.12'
+version = '0.1.13'
diff --git a/src/wstool/cli_common.py b/src/wstool/cli_common.py
index 73879af..d231dfa 100644
--- a/src/wstool/cli_common.py
+++ b/src/wstool/cli_common.py
@@ -32,6 +32,10 @@
 
 "Support for any command line interface (CLI) for wstool"
 
+try:
+    from collections import OrderedDict
+except:
+    from ordereddict import OrderedDict
 import os
 import re
 from optparse import OptionParser
@@ -277,32 +281,29 @@ def get_info_table_elements(basepath, entries, unmanaged=False):
     return outputs
 
 
-def get_info_table(basepath, entries, data_only=False, reverse=False, unmanaged=False):
+def get_info_table(basepath, entries, data_only=False, reverse=False,
+                   unmanaged=False, selected_headers=None):
     """
     return a refined textual representation of the entries. Provides
     column headers and processes data.
     """
+    headers = OrderedDict([
+        ('localname', "Localname"),
+        ('status', "S"),
+        ('scm', "SCM"),
+        ('version', "Version (Spec)"),
+        ('matching', "UID  (Spec)"),
+        ('uri', "URI  (Spec) [http(s)://...]"),
+    ])
+    # table design
     if unmanaged:
-        headers = {
-            'uri': "URI [http(s)://...]",
-            'scm': "SCM ",
-            'localname': "Localname"}
-
-        # table design
         selected_headers = ['localname', 'scm', 'uri']
-    else:
-
-        headers = {
-            'uri': "URI  (Spec) [http(s)://...]",
-            'scm': "SCM ",
-            'localname': "Localname",
-            'version': "Version (Spec)",
-            'matching': "UID  (Spec)",
-            'status': "S"}
-
-        # table design
-        selected_headers = ['localname', 'status', 'scm', 'version',
-                            'matching', 'uri']
+    elif selected_headers is None:
+        selected_headers = headers.keys()
+    # validate selected_headers
+    invalid_headers = [h for h in selected_headers if h not in headers.keys()]
+    if invalid_headers:
+        raise ValueError('Invalid headers are passed: %s' % invalid_headers)
 
     outputs = get_info_table_elements(
         basepath=basepath,
diff --git a/src/wstool/multiproject_cli.py b/src/wstool/multiproject_cli.py
index f3dbd21..2ea75e2 100644
--- a/src/wstool/multiproject_cli.py
+++ b/src/wstool/multiproject_cli.py
@@ -659,6 +659,18 @@ $ %(progname)s foreach --git 'git status'
         parser.add_option("--bzr", dest="bzr", default=False,
                           help="run command in bzr entries",
                           action="store_true")
+        parser.add_option("-m", "--timeout", dest="timeout",
+                          default=None,
+                          help="How long to wait for each repo before failing [seconds]",
+                          action="store", type=float)
+        parser.add_option("-j", "--parallel", dest="jobs",
+                          default=1,
+                          help="How many parallel threads to use for running the custom commands",
+                          action="store")
+        parser.add_option("-v", "--verbose", dest="verbose",
+                          default=False,
+                          help="Whether to print out more information",
+                          action="store_true")
         # -t option required here for help but used one layer above
         # see cli_common
         parser.add_option("-t", "--target-workspace", dest="workspace",
@@ -705,14 +717,18 @@ $ %(progname)s foreach --git 'git status'
         outputs = multiproject_cmd.cmd_foreach(config,
                                                command=command,
                                                localnames=localnames,
+                                               num_threads=int(options.jobs),
+                                               timeout=options.timeout,
                                                scm_types=scm_types,
-                                               shell=options.shell)
+                                               shell=options.shell,
+                                               verbose=options.verbose)
 
         def add_localname_prefix(localname, lines):
             return ['[%s] %s' % (localname, line) for line in lines]
 
         for output in outputs:
             localname = output['entry'].get_local_name()
+            rc = output['returncode']
             if options.show_stdout:
                 if output['stdout'] is None:
                     continue
@@ -721,13 +737,17 @@ $ %(progname)s foreach --git 'git status'
                 sys.stdout.write('\n'.join(lines))
                 sys.stdout.write('\n')
             if options.show_stderr:
-                if output['stderr'] is None:
+                lines = []
+                if output['stderr'] is not None:
+                    lines += output['stderr'].strip().split('\n')
+                if rc != 0:
+                    lines +=  ['Command failed with return code [%s]' % rc]
+                if not lines:
                     continue
-                lines = output['stderr'].strip().split('\n')
                 lines = add_localname_prefix(localname, lines)
                 sys.stderr.write('\n'.join(lines))
                 sys.stderr.write('\n')
-        return 0
+        return 0 if all([o['returncode'] == 0  for o in outputs]) else 1
 
     def cmd_status(self, target_path, argv, config=None):
         parser = OptionParser(usage="usage: %s status [localname]* " % self.progname,
@@ -1133,6 +1153,10 @@ $ %(prog)s info --only=path,cur_uri,cur_revision robot_model geometry
             help="Does not provide explanations",
             action="store_true")
         parser.add_option(
+            "-s", "--short", dest="short", default=False,
+            help="Shows simplified version info table.",
+            action="store_true")
+        parser.add_option(
             "--only", dest="only", default=False,
             help="Shows comma-separated lists of only given comma-separated attribute(s).",
             action="store")
@@ -1203,12 +1227,17 @@ $ %(prog)s info --only=path,cur_uri,cur_revision robot_model geometry
                                 options.data_only))
             return 0
 
+        columns = None
+        if options.short:
+            columns = ['localname', 'status', 'version']
+
         header = 'workspace: %s' % (target_path)
         print(header)
         table = get_info_table(config.get_base_path(),
                                outputs,
                                options.data_only,
-                               reverse=reverse)
+                               reverse=reverse,
+                               selected_headers=columns)
         if table is not None and table != '':
            print("\n%s" % table)
 
@@ -1218,7 +1247,8 @@ $ %(prog)s info --only=path,cur_uri,cur_revision robot_model geometry
                                    outputs2,
                                    options.data_only,
                                    reverse=reverse,
-                                   unmanaged=True)
+                                   unmanaged=True,
+                                   selected_headers=columns)
             if table2 is not None and table2 != '':
                 print("\nAlso detected these repositories in the workspace, add using '%s scrape' or '%s set':\n\n%s" % (self.progname, self.progname, table2))
 
diff --git a/src/wstool/multiproject_cmd.py b/src/wstool/multiproject_cmd.py
index 58e291d..d6f720e 100644
--- a/src/wstool/multiproject_cmd.py
+++ b/src/wstool/multiproject_cmd.py
@@ -278,32 +278,51 @@ def cmd_diff(config, localnames=None):
     return outputs
 
 
-def cmd_foreach(config, command, localnames=None, scm_types=None, shell=False):
+def cmd_foreach(
+    config,
+    command,
+    localnames=None,
+    num_threads=1,
+    timeout=None,
+    scm_types=None,
+    shell=False,
+    verbose=False):
     """Run command in all SCM entries in config, relative to path"""
 
     class ForeachRetriever(object):
-        def __init__(self, element, command, shell):
+        def __init__(self, element, command, timeout, shell, verbose):
             self.element = element
             self.command = command
+            self.timeout = timeout
             self.shell = shell
+            self.verbose = verbose
 
         def do_work(self):
             command = self.command
             if not self.shell:
                 command = shlex.split(command)
-            _, stdout, stderr = run_shell_command(command,
-                                                  cwd=self.element.path,
-                                                  show_stdout=False,
-                                                  shell=self.shell)
-            return {'stdout': stdout, 'stderr': stderr}
+            returncode, stdout, stderr = run_shell_command(
+                command,
+                cwd=self.element.path,
+                timeout=self.timeout,
+                shell=self.shell,
+                show_stdout=self.verbose)
+            return {'returncode': returncode,
+                    'stdout': stdout,
+                    'stderr': stderr}
 
     elements = select_elements(config, localnames)
-    work = DistributedWork(capacity=len(elements))
+    work = DistributedWork(capacity=len(elements),
+                           num_threads=num_threads)
     for element in elements:
         if ((scm_types is not None) and
                 (element.get_vcs_type_name() not in scm_types)):
             continue
-        work.add_thread(ForeachRetriever(element, command, shell))
+        work.add_thread(ForeachRetriever(element,
+                                         command,
+                                         timeout,
+                                         shell,
+                                         verbose))
     outputs = work.run()
     return outputs
 
diff --git a/stdeb.cfg b/stdeb.cfg
index c1573d5..12dd4bf 100644
--- a/stdeb.cfg
+++ b/stdeb.cfg
@@ -3,5 +3,5 @@ Depends: subversion, mercurial, git-core, bzr, python-yaml, python-vcstools (>=
 Depends3: subversion, mercurial, git-core, bzr, python3-yaml, python3-vcstools (>= 0.1.38)
 Conflicts: python3-wstool
 Conflicts3: python-wstool
-Suite: oneiric precise quantal raring saucy trusty utopic vivid wheezy jessie
+Suite: oneiric precise quantal raring saucy trusty utopic vivid wily xenial wheezy jessie
 X-Python3-Version: >= 3.2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ros/ros-wstool.git



More information about the debian-science-commits mailing list