[Python-modules-commits] r16107 - in packages/objgraph/trunk/debian/patches (2 files)
stefanor at users.alioth.debian.org
stefanor at users.alioth.debian.org
Sat Mar 12 15:17:25 UTC 2011
Date: Saturday, March 12, 2011 @ 15:17:12
Author: stefanor
Revision: 16107
Update non-UTF-8 locale patches with accepted versions
Modified:
packages/objgraph/trunk/debian/patches/quoting-py3k-utf8.patch
packages/objgraph/trunk/debian/patches/utf8-changes.patch
Modified: packages/objgraph/trunk/debian/patches/quoting-py3k-utf8.patch
===================================================================
--- packages/objgraph/trunk/debian/patches/quoting-py3k-utf8.patch 2011-03-11 21:51:32 UTC (rev 16106)
+++ packages/objgraph/trunk/debian/patches/quoting-py3k-utf8.patch 2011-03-12 15:17:12 UTC (rev 16107)
@@ -15,25 +15,21 @@
import gc
import re
import inspect
-@@ -508,11 +509,20 @@
+@@ -508,11 +509,16 @@
if not isinstance(objs, (list, tuple)):
objs = [objs]
if filename and filename.endswith('.dot'):
- f = open(filename, 'w')
-+ try:
-+ f = open(filename, 'w', encoding='UTF-8')
-+ except TypeError:
-+ # Python 2.x compatibility
-+ f = codecs.open(filename, 'w', encoding='UTF-8')
++ f = codecs.open(filename, 'w', encoding='utf-8')
dot_filename = filename
else:
fd, dot_filename = tempfile.mkstemp('.dot', text=True)
f = os.fdopen(fd, "w")
+ if f.encoding != None:
+ # Python 3 will wrap the file in the user's preferred encoding
-+ # Re-wrap it for UTF-8
++ # Re-wrap it for utf-8
+ import io
-+ f = io.TextIOWrapper(f.detach(), 'UTF-8')
++ f = io.TextIOWrapper(f.detach(), 'utf-8')
f.write('digraph ObjectGraph {\n'
' node[shape=box, style=filled, fillcolor=white];\n')
queue = []
Modified: packages/objgraph/trunk/debian/patches/utf8-changes.patch
===================================================================
--- packages/objgraph/trunk/debian/patches/utf8-changes.patch 2011-03-11 21:51:32 UTC (rev 16106)
+++ packages/objgraph/trunk/debian/patches/utf8-changes.patch 2011-03-12 15:17:12 UTC (rev 16107)
@@ -7,25 +7,32 @@
--- a/setup.py
+++ b/setup.py
-@@ -10,9 +10,9 @@
+@@ -1,5 +1,5 @@
+ #!/usr/bin/python
+-import os, re, sys, unittest, doctest
++import codecs, os, re, sys, unittest, doctest
+ from distutils.core import setup
+@@ -10,7 +10,7 @@
+
+
def read(filename):
- f = open(relative(filename))
-+ f = open(relative(filename), 'rb')
++ f = codecs.open(relative(filename), 'r', 'utf-8')
try:
-- return f.read()
-+ return f.read().decode('utf-8')
+ return f.read()
finally:
- f.close()
-
-@@ -34,7 +34,9 @@
+@@ -34,7 +34,12 @@
def get_description():
readme = read('README.txt')
changelog = read('CHANGES.txt')
- return unsphinx(readme + '\n\n\n' + changelog)
+ description = unsphinx(readme + '\n\n\n' + changelog)
-+ description = description.encode('ascii', 'replace').decode('ascii')
++ if '--unicode-description' in sys.argv:
++ sys.argv.remove('--unicode-description')
++ else:
++ description = description.encode('ascii', 'replace').decode('ascii')
+ return description
More information about the Python-modules-commits
mailing list