[python-pydns] fix encoding issues (rhbz 620265)

dmalcolm dmalcolm at fedoraproject.org
Sun Aug 1 22:05:51 UTC 2010


commit 571f2aa366dfc1648d95048765d388e91f94ddbb
Author: David Malcolm <dmalcolm at redhat.com>
Date:   Sun Aug 1 18:08:22 2010 -0400

    fix encoding issues (rhbz 620265)

 python-pydns.spec |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/python-pydns.spec b/python-pydns.spec
index 196451f..e75cc90 100644
--- a/python-pydns.spec
+++ b/python-pydns.spec
@@ -2,7 +2,7 @@
 
 Name:           python-pydns
 Version:        2.3.3
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Python module for DNS (Domain Name Service)
 
 Group:          Development/Languages
@@ -26,16 +26,17 @@ symbolic constants used by DNS (dnstype, dnsclass, dnsopcode).
 %define namewithoutpythonprefix %(echo %{name} | sed 's/^python-//')
 %prep
 %setup -q -n %{namewithoutpythonprefix}-%{version}
-#  fix encoding of files
-for file in DNS/*.py;
-do
-	echo '# -*- coding: latin-1 -*-' >"${file}".new
-	cat "${file}" >>"${file}".new
-	cat "${file}".new >"${file}"
-	rm "${file}".new
-	head "${file}" #@@@
-done
 
+# Some files are latin-1 encoded but are incorrectly labelled as UTF-8 by
+# upstream (see rhbz:620265)
+#
+# Convert them to actually be UTF-8, preserving the (now-correct) encoding
+# declaration (preserving timestamps):
+for file in DNS/Lib.py DNS/Type.py ; do
+    iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
+    touch -r $file $file.new && \
+    mv $file.new $file
+done
 
 %build
 %{__python} setup.py build
@@ -58,6 +59,9 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitelib}/pydns-%{version}-py*.egg-info
 
 %changelog
+* Sun Aug  1 2010 David Malcolm <dmalcolm at redhat.com> - 2.3.3-6
+- fix encoding issues (rhbz 620265)
+
 * Thu Jul 22 2010 David Malcolm <dmalcolm at redhat.com> - 2.3.3-5
 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
 


More information about the scm-commits mailing list