[python-subunit] initial import (#908842)

Pádraig Brady pbrady at fedoraproject.org
Tue Jun 4 13:49:32 UTC 2013


commit 3d6afeb2f309e6f626074d3f71703dd0cf9883a2
Author: Pádraig Brady <P at draigBrady.com>
Date:   Tue Jun 4 14:49:02 2013 +0100

    initial import (#908842)

 .gitignore             |    1 +
 python-subunit.spec    |   72 ++++++++++++
 sources                |    1 +
 unbundle-iso8601.patch |  286 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 360 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..5342802 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/python-subunit-0.0.12.tar.gz
diff --git a/python-subunit.spec b/python-subunit.spec
new file mode 100644
index 0000000..d42768a
--- /dev/null
+++ b/python-subunit.spec
@@ -0,0 +1,72 @@
+# Created by pyp2rpm-1.0.1
+%global pypi_name python-subunit
+
+Name:           %{pypi_name}
+Version:        0.0.12
+Release:        5%{?dist}
+Summary:        Python implementation of subunit test streaming protocol
+
+License:        ASL 2.0
+URL:            http://launchpad.net/subunit
+Source0:        http://pypi.python.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
+Patch0:         unbundle-iso8601.patch
+BuildArch:      noarch
+
+BuildRequires:  python2-devel
+BuildRequires:  python-testtools >= 0.9.30
+BuildRequires:  python-iso8601
+BuildRequires:  python-extras
+
+Requires:       python-testtools >= 0.9.30
+Requires:       python-iso8601
+Requires:       python-extras
+
+%description
+A streaming protocol for test results
+
+
+%prep
+%setup -q -n %{pypi_name}-%{version}
+
+%patch0 -p1
+
+# Remove bundled egg-info
+rm -rf %{pypi_name}.egg-info
+
+# Remove interpreter for non exec scripts
+find python/subunit -name \*.py \! -perm /111 -exec \
+  sed -i '1{/\/usr\/bin\/.*python/d}' {} +
+
+%build
+%{__python} setup.py build
+
+%install
+%{__python} setup.py install --skip-build --root %{buildroot}
+# Reinstate +x for this script to avoid lint warning
+chmod a+x %{buildroot}%{python_sitelib}/subunit/run.py
+
+%check
+PYTHONPATH=%{buildroot}%{python_sitelib} \
+%{__python} -m testtools.run discover python/subunit/tests
+# Don't distribute the tests
+rm -fr %{buildroot}%{python_sitelib}/subunit/tests
+
+%files
+%doc README NEWS
+%{_bindir}/subunit2gtk
+%{_bindir}/subunit2junitxml
+%{_bindir}/subunit2pyunit
+%{_bindir}/subunit-filter
+%{_bindir}/subunit-ls
+%{_bindir}/subunit-notify
+%{_bindir}/subunit-stats
+%{_bindir}/subunit-tags
+%{_bindir}/tap2subunit
+%{_bindir}/subunit-1to2
+%{_bindir}/subunit-2to1
+%{python_sitelib}/subunit
+%{python_sitelib}/python_subunit-%{version}-py?.?.egg-info
+
+%changelog
+* Thu May 30 2013 Padraig Brady <P at draigBrady.com> - 0.0.12-5
+- Initial package.
diff --git a/sources b/sources
index e69de29..c4bf86f 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+04f1518800f6cdb5d87ca04731175755  python-subunit-0.0.12.tar.gz
diff --git a/unbundle-iso8601.patch b/unbundle-iso8601.patch
new file mode 100644
index 0000000..a33e7b6
--- /dev/null
+++ b/unbundle-iso8601.patch
@@ -0,0 +1,286 @@
+diff -Naur python-subunit-0.0.12.orig/PKG-INFO python-subunit-0.0.12/PKG-INFO
+--- python-subunit-0.0.12.orig/PKG-INFO	2013-05-12 22:50:21.000000000 +0000
++++ python-subunit-0.0.12/PKG-INFO	2013-05-18 00:08:37.609112627 +0000
+@@ -23,9 +23,6 @@
+         
+           See the COPYING file for full details on the licensing of Subunit.
+         
+-          subunit reuses iso8601 by Michael Twomey, distributed under an MIT style
+-          licence - see python/iso8601/LICENSE for details.
+-        
+         Subunit
+         -------
+         
+diff -Naur python-subunit-0.0.12.orig/README python-subunit-0.0.12/README
+--- python-subunit-0.0.12.orig/README	2013-04-08 10:28:36.000000000 +0000
++++ python-subunit-0.0.12/README	2013-05-18 00:09:00.072205362 +0000
+@@ -15,9 +15,6 @@
+ 
+   See the COPYING file for full details on the licensing of Subunit.
+ 
+-  subunit reuses iso8601 by Michael Twomey, distributed under an MIT style
+-  licence - see python/iso8601/LICENSE for details.
+-
+ Subunit
+ -------
+ 
+diff -Naur python-subunit-0.0.12.orig/python/subunit/__init__.py python-subunit-0.0.12/python/subunit/__init__.py
+--- python-subunit-0.0.12.orig/python/subunit/__init__.py	2013-05-18 00:01:50.264690963 +0000
++++ python-subunit-0.0.12/python/subunit/__init__.py	2013-05-18 00:06:29.456581055 +0000
+@@ -120,6 +120,7 @@
+ import re
+ import subprocess
+ import sys
++from iso8601 import iso8601
+ import unittest
+ try:
+     from io import UnsupportedOperation as _UnsupportedOperation
+@@ -145,7 +146,7 @@
+         "_StringException, check your version.")
+ from testtools import testresult, CopyStreamResult
+ 
+-from subunit import chunked, details, iso8601, test_results
++from subunit import chunked, details, test_results
+ from subunit.v2 import ByteStreamToStreamResult, StreamResultToBytes
+ 
+ # same format as sys.version_info: "A tuple containing the five components of
+diff -Naur python-subunit-0.0.12.orig/python/subunit/iso8601.py python-subunit-0.0.12/python/subunit/iso8601.py
+--- python-subunit-0.0.12.orig/python/subunit/iso8601.py	2013-05-18 00:01:50.259690949 +0000
++++ python-subunit-0.0.12/python/subunit/iso8601.py	1970-01-01 00:00:00.000000000 +0000
+@@ -1,133 +0,0 @@
+-# Copyright (c) 2007 Michael Twomey
+-# 
+-# Permission is hereby granted, free of charge, to any person obtaining a
+-# copy of this software and associated documentation files (the
+-# "Software"), to deal in the Software without restriction, including
+-# without limitation the rights to use, copy, modify, merge, publish,
+-# distribute, sublicense, and/or sell copies of the Software, and to
+-# permit persons to whom the Software is furnished to do so, subject to
+-# the following conditions:
+-# 
+-# The above copyright notice and this permission notice shall be included
+-# in all copies or substantial portions of the Software.
+-# 
+-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+-
+-"""ISO 8601 date time string parsing
+-
+-Basic usage:
+->>> import iso8601
+->>> iso8601.parse_date("2007-01-25T12:00:00Z")
+-datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.iso8601.Utc ...>)
+->>>
+-
+-"""
+-
+-from datetime import datetime, timedelta, tzinfo
+-import re
+-import sys
+-
+-__all__ = ["parse_date", "ParseError"]
+-
+-# Adapted from http://delete.me.uk/2005/03/iso8601.html
+-ISO8601_REGEX_PATTERN = (r"(?P<year>[0-9]{4})(-(?P<month>[0-9]{1,2})(-(?P<day>[0-9]{1,2})"
+-    r"((?P<separator>.)(?P<hour>[0-9]{2}):(?P<minute>[0-9]{2})(:(?P<second>[0-9]{2})(\.(?P<fraction>[0-9]+))?)?"
+-    r"(?P<timezone>Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?"
+-)
+-TIMEZONE_REGEX_PATTERN = "(?P<prefix>[+-])(?P<hours>[0-9]{2}).(?P<minutes>[0-9]{2})"
+-ISO8601_REGEX = re.compile(ISO8601_REGEX_PATTERN.encode('utf8'))
+-TIMEZONE_REGEX = re.compile(TIMEZONE_REGEX_PATTERN.encode('utf8'))
+-
+-zulu = "Z".encode('latin-1')
+-minus = "-".encode('latin-1')
+-
+-if sys.version_info < (3, 0):
+-    bytes = str
+-
+-
+-class ParseError(Exception):
+-    """Raised when there is a problem parsing a date string"""
+-
+-# Yoinked from python docs
+-ZERO = timedelta(0)
+-class Utc(tzinfo):
+-    """UTC
+-    
+-    """
+-    def utcoffset(self, dt):
+-        return ZERO
+-
+-    def tzname(self, dt):
+-        return "UTC"
+-
+-    def dst(self, dt):
+-        return ZERO
+-UTC = Utc()
+-
+-class FixedOffset(tzinfo):
+-    """Fixed offset in hours and minutes from UTC
+-    
+-    """
+-    def __init__(self, offset_hours, offset_minutes, name):
+-        self.__offset = timedelta(hours=offset_hours, minutes=offset_minutes)
+-        self.__name = name
+-
+-    def utcoffset(self, dt):
+-        return self.__offset
+-
+-    def tzname(self, dt):
+-        return self.__name
+-
+-    def dst(self, dt):
+-        return ZERO
+-    
+-    def __repr__(self):
+-        return "<FixedOffset %r>" % self.__name
+-
+-def parse_timezone(tzstring, default_timezone=UTC):
+-    """Parses ISO 8601 time zone specs into tzinfo offsets
+-    
+-    """
+-    if tzstring == zulu:
+-        return default_timezone
+-    # This isn't strictly correct, but it's common to encounter dates without
+-    # timezones so I'll assume the default (which defaults to UTC).
+-    # Addresses issue 4.
+-    if tzstring is None:
+-        return default_timezone
+-    m = TIMEZONE_REGEX.match(tzstring)
+-    prefix, hours, minutes = m.groups()
+-    hours, minutes = int(hours), int(minutes)
+-    if prefix == minus:
+-        hours = -hours
+-        minutes = -minutes
+-    return FixedOffset(hours, minutes, tzstring)
+-
+-def parse_date(datestring, default_timezone=UTC):
+-    """Parses ISO 8601 dates into datetime objects
+-    
+-    The timezone is parsed from the date string. However it is quite common to
+-    have dates without a timezone (not strictly correct). In this case the
+-    default timezone specified in default_timezone is used. This is UTC by
+-    default.
+-    """
+-    if not isinstance(datestring, bytes):
+-        raise ParseError("Expecting bytes %r" % datestring)
+-    m = ISO8601_REGEX.match(datestring)
+-    if not m:
+-        raise ParseError("Unable to parse date string %r" % datestring)
+-    groups = m.groupdict()
+-    tz = parse_timezone(groups["timezone"], default_timezone=default_timezone)
+-    if groups["fraction"] is None:
+-        groups["fraction"] = 0
+-    else:
+-        groups["fraction"] = int(float("0.%s" % groups["fraction"].decode()) * 1e6)
+-    return datetime(int(groups["year"]), int(groups["month"]), int(groups["day"]),
+-        int(groups["hour"]), int(groups["minute"]), int(groups["second"]),
+-        int(groups["fraction"]), tz)
+diff -Naur python-subunit-0.0.12.orig/python/subunit/test_results.py python-subunit-0.0.12/python/subunit/test_results.py
+--- python-subunit-0.0.12.orig/python/subunit/test_results.py	2013-05-18 00:01:50.287691024 +0000
++++ python-subunit-0.0.12/python/subunit/test_results.py	2013-05-18 00:07:57.744947730 +0000
+@@ -27,7 +27,7 @@
+     )
+ from testtools import StreamResult
+ 
+-from subunit import iso8601
++from iso8601 import iso8601
+ import subunit
+ 
+ 
+diff -Naur python-subunit-0.0.12.orig/python/subunit/tests/test_subunit_filter.py python-subunit-0.0.12/python/subunit/tests/test_subunit_filter.py
+--- python-subunit-0.0.12.orig/python/subunit/tests/test_subunit_filter.py	2013-05-18 00:01:50.282691012 +0000
++++ python-subunit-0.0.12/python/subunit/tests/test_subunit_filter.py	2013-05-18 00:07:44.592893238 +0000
+@@ -20,7 +20,7 @@
+ import os
+ import subprocess
+ import sys
+-from subunit import iso8601
++from iso8601 import iso8601
+ import unittest
+ 
+ from testtools import TestCase
+diff -Naur python-subunit-0.0.12.orig/python/subunit/tests/test_test_protocol.py python-subunit-0.0.12/python/subunit/tests/test_test_protocol.py
+--- python-subunit-0.0.12.orig/python/subunit/tests/test_test_protocol.py	2013-05-18 00:01:50.274690989 +0000
++++ python-subunit-0.0.12/python/subunit/tests/test_test_protocol.py	2013-05-18 00:07:02.384718054 +0000
+@@ -37,7 +37,7 @@
+ 
+ import subunit
+ from subunit import _remote_exception_str, _remote_exception_str_chunked
+-import subunit.iso8601 as iso8601
++from iso8601 import iso8601
+ 
+ 
+ def details_to_str(details):
+diff -Naur python-subunit-0.0.12.orig/python/subunit/tests/test_test_protocol2.py python-subunit-0.0.12/python/subunit/tests/test_test_protocol2.py
+--- python-subunit-0.0.12.orig/python/subunit/tests/test_test_protocol2.py	2013-05-18 00:01:50.280691007 +0000
++++ python-subunit-0.0.12/python/subunit/tests/test_test_protocol2.py	2013-05-18 00:07:32.000841024 +0000
+@@ -23,7 +23,7 @@
+ from testtools.testresult.doubles import StreamResult
+ 
+ import subunit
+-import subunit.iso8601 as iso8601
++from iso8601 import iso8601
+ 
+ CONSTANT_ENUM = b'\xb3)\x01\x0c\x03foo\x08U_\x1b'
+ CONSTANT_INPROGRESS = b'\xb3)\x02\x0c\x03foo\x8e\xc1-\xb5'
+diff -Naur python-subunit-0.0.12.orig/python/subunit/tests/test_test_results.py python-subunit-0.0.12/python/subunit/tests/test_test_results.py
+--- python-subunit-0.0.12.orig/python/subunit/tests/test_test_results.py	2013-05-18 00:01:50.279691004 +0000
++++ python-subunit-0.0.12/python/subunit/tests/test_test_results.py	2013-05-18 00:07:18.376784484 +0000
+@@ -28,7 +28,7 @@
+ from testtools.testresult.doubles import ExtendedTestResult
+ 
+ import subunit
+-import subunit.iso8601 as iso8601
++from iso8601 import iso8601
+ import subunit.test_results
+ 
+ import testtools
+diff -Naur python-subunit-0.0.12.orig/python/subunit/v2.py python-subunit-0.0.12/python/subunit/v2.py
+--- python-subunit-0.0.12.orig/python/subunit/v2.py	2013-05-18 00:01:50.265690966 +0000
++++ python-subunit-0.0.12/python/subunit/v2.py	2013-05-18 00:06:47.120654583 +0000
+@@ -25,7 +25,7 @@
+ from extras import safe_hasattr
+ 
+ import subunit
+-import subunit.iso8601 as iso8601
++from iso8601 import iso8601
+ 
+ __all__ = [
+     'ByteStreamToStreamResult',
+diff -Naur python-subunit-0.0.12.orig/python_subunit.egg-info/PKG-INFO python-subunit-0.0.12/python_subunit.egg-info/PKG-INFO
+--- python-subunit-0.0.12.orig/python_subunit.egg-info/PKG-INFO	2013-05-12 22:50:21.000000000 +0000
++++ python-subunit-0.0.12/python_subunit.egg-info/PKG-INFO	2013-05-18 00:08:48.328156893 +0000
+@@ -23,9 +23,6 @@
+         
+           See the COPYING file for full details on the licensing of Subunit.
+         
+-          subunit reuses iso8601 by Michael Twomey, distributed under an MIT style
+-          licence - see python/iso8601/LICENSE for details.
+-        
+         Subunit
+         -------
+         
+diff -Naur python-subunit-0.0.12.orig/python_subunit.egg-info/SOURCES.txt python-subunit-0.0.12/python_subunit.egg-info/SOURCES.txt
+--- python-subunit-0.0.12.orig/python_subunit.egg-info/SOURCES.txt	2013-05-12 22:50:21.000000000 +0000
++++ python-subunit-0.0.12/python_subunit.egg-info/SOURCES.txt	2013-05-18 00:04:41.953145552 +0000
+@@ -17,7 +17,6 @@
+ python/subunit/chunked.py
+ python/subunit/details.py
+ python/subunit/filters.py
+-python/subunit/iso8601.py
+ python/subunit/progress_model.py
+ python/subunit/run.py
+ python/subunit/test_results.py
+@@ -41,4 +40,4 @@
+ python_subunit.egg-info/SOURCES.txt
+ python_subunit.egg-info/dependency_links.txt
+ python_subunit.egg-info/requires.txt
+-python_subunit.egg-info/top_level.txt
+\ No newline at end of file
++python_subunit.egg-info/top_level.txt


More information about the scm-commits mailing list