[python-catkin_tools/el6] Add upstream terminal width patch to enable tests

Scott K Logan cottsay at fedoraproject.org
Sat Oct 25 20:01:39 UTC 2014


commit c72d29cb14463772d22f1d29119f73d23990afaa
Author: Scott K Logan <logans at cottsay.net>
Date:   Sat Oct 25 12:55:55 2014 -0700

    Add upstream terminal width patch to enable tests

 python-catkin_tools-0.2.0-terminal-width.patch |   50 ++++++++++++++++++++++++
 python-catkin_tools.spec                       |   10 +++-
 2 files changed, 57 insertions(+), 3 deletions(-)
---
diff --git a/python-catkin_tools-0.2.0-terminal-width.patch b/python-catkin_tools-0.2.0-terminal-width.patch
new file mode 100644
index 0000000..a39bb9d
--- /dev/null
+++ b/python-catkin_tools-0.2.0-terminal-width.patch
@@ -0,0 +1,50 @@
+From 95a08b38b8e6b0b21903a59339fe0739da10bab5 Mon Sep 17 00:00:00 2001
+From: William Woodall <william at osrfoundation.org>
+Date: Wed, 22 Oct 2014 11:58:12 -0700
+Subject: [PATCH] context: use terminal width function in common.py
+
+---
+ catkin_tools/context.py | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/catkin_tools/context.py b/catkin_tools/context.py
+index 65de558..ffe93f2 100644
+--- a/catkin_tools/context.py
++++ b/catkin_tools/context.py
+@@ -22,8 +22,9 @@
+ 
+ from . import metadata
+ 
+-from .common import remove_ansi_escape
+ from .common import printed_fill
++from .common import remove_ansi_escape
++from .common import terminal_width
+ 
+ from .metadata import find_enclosing_workspace
+ 
+@@ -34,8 +35,6 @@
+ color_mapper = ColorMapper()
+ clr = color_mapper.clr
+ 
+-# TODO: extend builtin prototype to handle locking
+-
+ 
+ class Context(object):
+ 
+@@ -393,14 +392,13 @@ def summary(self, notes=[]):
+         }
+         subs.update(**self.__dict__)
+         # Get the width of the shell
+-        _, term_cols = os.popen('stty size', 'r').read().split()
+-        term_cols = int(term_cols)
++        width = terminal_width()
+         max_length = 0
+         groups = []
+         for group in summary:
+             for index, line in enumerate(group):
+                 group[index] = line.format(**subs)
+-                max_length = min(term_cols, max(max_length, len(remove_ansi_escape(group[index]))))
++                max_length = min(width, max(max_length, len(remove_ansi_escape(group[index]))))
+             groups.append("\n".join(group))
+         divider = clr('@{pf}' + ('-' * max_length) + '@|')
+         warning_divider = clr('@{rf}' + ('-' * max_length) + '@|')
diff --git a/python-catkin_tools.spec b/python-catkin_tools.spec
index ff4212b..ff55a64 100644
--- a/python-catkin_tools.spec
+++ b/python-catkin_tools.spec
@@ -11,13 +11,15 @@
 
 Name:           python-%{module}
 Version:        0.2.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Command line tools for working with catkin
 
 Group:          Development/Tools
 License:        ASL 2.0
 URL:            http://catkin-tools.readthedocs.org
 Source0:        https://github.com/catkin/%{module}/archive/%{commit}/%{module}-%{commit}.tar.gz
+# Upstream patch
+Patch0:         %{name}-0.2.0-terminal-width.patch
 
 BuildArch:      noarch
 
@@ -72,6 +74,7 @@ Provides command line tools for working with catkin
 
 %prep
 %setup -qn %{module}-%{commit}
+%patch0 -p1
 
 %if 0%{?with_python3}
 rm -rf %{py3dir}
@@ -123,7 +126,6 @@ rm -rf %{buildroot}%{python3_sitelib}/tests
 popd
 %endif
 
-%if 0
 %if 0%{?fedora} > 19 || 0%{?rhel} > 6
 %check
 # The tests depend on "catkin" being in PATH.
@@ -137,7 +139,6 @@ ln -s %{buildroot}%{_bindir}/python3-catkin tmpbin3/catkin
 PYTHONPATH=%{buildroot}%{python2_sitelib} PATH=`pwd`/tmpbin3:$PATH nosetests-%{python3_version} -w tests -e test_build_*
 %endif
 %endif
-%endif
 
 %files
 %doc LICENSE README.md docs/_build/html
@@ -156,6 +157,9 @@ PYTHONPATH=%{buildroot}%{python2_sitelib} PATH=`pwd`/tmpbin3:$PATH nosetests-%{p
 %endif
 
 %changelog
+* Wed Oct 22 2014 Scott K Logan <logans at cottsay.net> - 0.2.0-2
+- Add upstream terminal width patch to enable tests
+
 * Sat Oct 18 2014 Scott K Logan <logans at cottsay.net> - 0.2.0-1
 - Update to 0.2.0
 - Add python3 package


More information about the scm-commits mailing list