Fix typos

Remove compat layers
Do not catch KeyboardInterrupt in kitchen.text.converters
This commit is contained in:
Simon Chopin 2013-04-30 17:21:15 +00:00
parent b73d7428d5
commit e8b3362167
9 changed files with 294 additions and 52 deletions

4
debian/README vendored Normal file
View file

@ -0,0 +1,4 @@
The compatibility modules have been removed from the Debian package as they aim
to bring new features to old versions of Python, while we have the newer
versions available in our repositories, and did so by using modules from stdlib,
thus were difficult to support.

1
debian/clean vendored Normal file
View file

@ -0,0 +1 @@
@test* kitchen.egg-info/*

7
debian/control vendored
View file

@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Uploaders: Simon Chopin <chopin.simon@gmail.com>
Build-Depends:
debhelper (>= 8),
debhelper (>= 8.1),
python-all (>= 2.6.6-3~),
locales (>= 0),
python-nose,
@ -18,12 +18,11 @@ Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/kitchen/trunk
Package: python-kitchen
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}
Description: Mix of useful Python code
Description: mix of useful Python code
The kitchen Python package aims at gathering in one place all the snippets of
code that the author originally carried around from project to project to ease
the development.
.
A non-exhaustive list of the features provided by kitchen:
* helpers for text and specifically unicode handling i18n support
* Compatibility layers from 2.3 'til 2.7.
* A dictionary that treats unicode and str strings as different values
* a dictionary that treats unicode and str strings as different values

28
debian/copyright vendored
View file

@ -10,8 +10,8 @@ Files: kitchen/text/utf8.py kitchen/text/display.py
Copyright: 2012 Red Hat, Inc
2010 Ville Skyttä
2009 Tim Lauridsen
2007 Marcus Kuhn
License: LGPL
2007 Markus Kuhn
License: LGPL and Kuhn
Files: kitchen/text/misc.py
Copyright: 2012 Red Hat, Inc
@ -24,8 +24,28 @@ Copyright: 2010-2012 Red Hat, Inc
2008 Tim Lauridsen
License: LGPL
Files: kitchen/pycompat27/subprocess/_subprocess.py
Copyright: 2003-2005 Peter Astrand <astrand@lysator.liu.se>
License: Python
Files: kitchen/pycompat24/base64/_base64.py
Copyright: 1995 Jack Jensen
2003 Barry Warsaw
License: Python
Files: kitchen/pycompat25/collections/_defaultdict.py
Copyright: 2007 Justin Kirkland
License: Python
Files: debian/*
Copyright: 2011-2013 Simon Chopin <chopin.simon@gmail.com>
License: LGPL
License: Kuhn
Permission to use, copy, modify, and distribute this software
for any purpose and without fee is hereby granted. The author
disclaims all warranties with regard to this software.
License: Python
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"),
and the Individual or Organization ("Licensee") accessing and otherwise
@ -71,10 +91,6 @@ License: Python
8. By copying, installing or otherwise using Python, Licensee agrees to be
bound by the terms and conditions of this License Agreement.
Files: debian/*
Copyright: 2011-2013 Simon Chopin <chopin.simon@gmail.com>
License: LGPL
License: LGPL
kitchen is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free

View file

@ -0,0 +1,36 @@
From f2639ec4f393da7c790000b29525e331c81f2789 Mon Sep 17 00:00:00 2001
From: Simon Chopin <chopin.simon@gmail.com>
Date: Tue, 30 Apr 2013 18:27:15 +0200
Subject: [PATCH] Make kitchen.text.converters.exception_to_* not swallow
general errors such as KeyboardInterrupt
Bug: https://fedorahosted.org/kitchen/ticket/9
---
kitchen/text/converters.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kitchen/text/converters.py b/kitchen/text/converters.py
index 8b5aac6..0fb882f 100644
--- a/kitchen/text/converters.py
+++ b/kitchen/text/converters.py
@@ -502,7 +502,7 @@ def exception_to_unicode(exc, converters=EXCEPTION_CONVERTERS):
for func in converters:
try:
msg = func(exc)
- except:
+ except Exception:
pass
else:
break
@@ -534,7 +534,7 @@ def exception_to_bytes(exc, converters=EXCEPTION_CONVERTERS):
for func in converters:
try:
msg = func(exc)
- except:
+ except Exception:
pass
else:
break
--
1.7.10.4

141
debian/patches/fix_typos vendored Normal file
View file

@ -0,0 +1,141 @@
From 9a6c2b3ee1be305e6260b3f1e1fc15abc1249656 Mon Sep 17 00:00:00 2001
From: Simon Chopin <chopin.simon@gmail.com>
Date: Tue, 30 Apr 2013 17:28:27 +0200
Subject: [PATCH] Fix several typos
Bug: https://fedorahosted.org/kitchen/ticket/8
---
docs/api-pycompat27.rst | 2 +-
docs/designing-unicode-apis.rst | 2 +-
docs/hacking.rst | 2 +-
docs/unicode-frustrations.rst | 4 ++--
kitchen/i18n/__init__.py | 6 +++---
kitchen/pycompat25/collections/_defaultdict.py | 2 +-
kitchen/text/display.py | 6 +++---
releaseutils.py | 2 +-
8 files changed, 13 insertions(+), 13 deletions(-)
--- a/docs/api-pycompat27.rst
+++ b/docs/api-pycompat27.rst
@@ -31,5 +31,5 @@
.. seealso::
- The stdlib :mod:`subprocess` documenation
+ The stdlib :mod:`subprocess` documentation
For complete documentation on how to use subprocess
--- a/docs/designing-unicode-apis.rst
+++ b/docs/designing-unicode-apis.rst
@@ -581,7 +581,7 @@
that you may not have thought of. Corner cases in these other places may
mean that processing bytes is desirable.
2. In python2, byte :class:`str` and :class:`unicode` are often used
- interchangably with each other. That means that people programming against
+ interchangeably with each other. That means that people programming against
your API may have received :class:`str` from some other API and it would be
most convenient for their code if your API accepted it.
--- a/docs/hacking.rst
+++ b/docs/hacking.rst
@@ -272,7 +272,7 @@
Criteria for subpackages in kitchen
===================================
-Supackages within kitchen should meet these criteria:
+Subpackages within kitchen should meet these criteria:
* Generally useful or needed for other pieces of kitchen.
--- a/docs/unicode-frustrations.rst
+++ b/docs/unicode-frustrations.rst
@@ -33,7 +33,7 @@
with byte :class:`str` as those devices are going to need to deal with
concrete implementations of what bytes represent your abstract characters.
-In the python2 world many APIs use these two classes interchangably but there
+In the python2 world many APIs use these two classes interchangeably but there
are several important APIs where only one or the other will do the right
thing. When you give the wrong type of string to an API that wants the other
type, you may end up with an exception being raised (:exc:`UnicodeDecodeError`
@@ -122,7 +122,7 @@
So that was simple, right? Well... there's one gotcha that makes things a bit
harder to debug sometimes. When you attempt to write non-:term:`ASCII`
-:class:`unicode` strings to a file-like object you get a traceback everytime.
+:class:`unicode` strings to a file-like object you get a traceback every time.
But what happens when you use :func:`print`? The terminal is a file-like object
so it should raise an exception right? The answer to that is....
*sometimes*:
--- a/kitchen/i18n/__init__.py
+++ b/kitchen/i18n/__init__.py
@@ -251,8 +251,8 @@
def _reencode_if_necessary(self, message, output_encoding):
'''Return a byte string that's valid in a specific charset.
- .. warning:: This method may mangle the message if the inpput encoding
- is not known or the message isn't represntable in the chosen
+ .. warning:: This method may mangle the message if the input encoding
+ is not known or the message isn't representable in the chosen
output encoding.
'''
valid = False
@@ -668,7 +668,7 @@
objects by default. These are superior to the
:class:`gettext.GNUTranslations` and :class:`gettext.NullTranslations`
objects because they are consistent in the string type they return and
- they fix several issues that can causethe |stdlib|_ objects to throw
+ they fix several issues that can cause the |stdlib|_ objects to throw
:exc:`UnicodeError`.
2. This function takes multiple directories to search for
:term:`message catalogs`.
--- a/kitchen/pycompat25/collections/_defaultdict.py
+++ b/kitchen/pycompat25/collections/_defaultdict.py
@@ -73,7 +73,7 @@
# Pylint disabled messages
#
-# :C0103: We're defnining a compatible class name therefore we need to match
+# :C0103: We're defining a compatible class name therefore we need to match
# the format of that name.
import types
--- a/kitchen/text/display.py
+++ b/kitchen/text/display.py
@@ -3,7 +3,7 @@
# Copyright (c) 2010 Red Hat, Inc.
# Copyright (c) 2010 Ville Skyttä
# Copyright (c) 2009 Tim Lauridsen
-# Copyright (c) 2007 Marcus Kuhn
+# Copyright (c) 2007 Markus Kuhn
#
# kitchen is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
@@ -20,7 +20,7 @@
#
# Authors:
# James Antill <james@fedoraproject.org>
-# Marcus Kuhn
+# Markus Kuhn
# Toshio Kuratomi <toshio@fedoraproject.org>
# Tim Lauridsen
# Ville Skyttä
@@ -210,7 +210,7 @@
This is used to generate the :data:`~kitchen.text.display._COMBINING`
table.
'''
- # Marcus Kuhn's sorted list of non-overlapping intervals of non-spacing
+ # Markus Kuhn's sorted list of non-overlapping intervals of non-spacing
# characters generated ifrom Unicode 5.0 data by:
# "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c"
markus_kuhn_combining_5_0 = (
--- a/releaseutils.py
+++ b/releaseutils.py
@@ -35,7 +35,7 @@
shutil.rmtree('locale')
except OSError, e:
# If the error is that locale does not exist, we're okay. We're
- # deleting it here, afterall
+ # deleting it here, after all
if e.errno != 2:
raise

39
debian/patches/remove_compat_layers vendored Normal file
View file

@ -0,0 +1,39 @@
Description: Remove the pycompat* submodules
Those are not needed in Debian as we already ship the latest runtime version.
Author: Simon Chopin <chopin.simon@gmail.com>
Forwarded: not-needed
Last-Update: 2013-04-30
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/setup.py
+++ b/setup.py
@@ -52,6 +52,6 @@
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing :: General',
],
- packages=find_packages(),
+ packages=find_packages(exclude=['*pycompat*']),
data_files=[],
)
--- a/kitchen/text/converters.py
+++ b/kitchen/text/converters.py
@@ -53,7 +53,7 @@
# We need to access b_() for localizing our strings but we'll end up with
# a circular import if we import it directly.
import kitchen as k
-from kitchen.pycompat24 import sets
+import sets
sets.add_builtin_set()
from kitchen.text.exceptions import ControlCharError, XmlEncodeError
--- a/kitchen/text/misc.py
+++ b/kitchen/text/misc.py
@@ -40,7 +40,7 @@
# We need to access b_() for localizing our strings but we'll end up with
# a circular import if we import it directly.
import kitchen as k
-from kitchen.pycompat24 import sets
+import sets
from kitchen.text.exceptions import ControlCharError
sets.add_builtin_set()

View file

@ -1 +1,4 @@
normalize_test_unicode_name
fix_typos
remove_compat_layers
explicit_Exception_catching

9
debian/rules vendored
View file

@ -1,7 +1,13 @@
#!/usr/bin/make -f
UPSTREAM= $(shell dpkg-parsechangelog | egrep '^Version: ' | sed -r 's/Version: (.*)-[0-9a-zA-Z~+.]+/\1/')
%:
dh $@ --with python2
override_dh_install:
dh_install
for py in $(shell pyversions -r); do \
rm -f debian/python-kitchen/usr/lib/$$py/dist-packages/kitchen-$(UPSTREAM).egg-info/SOURCES.txt; \
done
override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
@ -15,6 +21,3 @@ ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
done
endif
override_dh_auto_clean:
rm -rf @test* kitchen.egg-info
dh_auto_clean