libsoup-01-python3-fix.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 74f27b8305cfbcf9324a07bea93829237c86e687 Mon Sep 17 00:00:00 2001
  2. From: Ross Lagerwall <rosslagerwall@gmail.com>
  3. Date: Tue, 18 Jun 2013 08:48:44 +0100
  4. Subject: tld-parser.py: Force file io to use utf-8
  5. This fixes an issue where the build would fail with a UnicodeDecodeError
  6. when run in a non-utf8 locale (which is typical in build environments)
  7. using Python 3.
  8. https://bugzilla.gnome.org/show_bug.cgi?id=702534
  9. Patch status: upstream
  10. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  11. diff --git a/libsoup/tld-parser.py b/libsoup/tld-parser.py
  12. index c1a0346..5d9d2ba 100755
  13. --- a/libsoup/tld-parser.py
  14. +++ b/libsoup/tld-parser.py
  15. @@ -5,13 +5,14 @@
  16. # Based on tld-parser.c Copyright (C) 2012 Igalia S.L.
  17. import sys
  18. +import codecs
  19. SOUP_TLD_RULE_NORMAL = 0
  20. SOUP_TLD_RULE_MATCH_ALL = 1 << 0
  21. SOUP_TLD_RULE_EXCEPTION = 1 << 1
  22. -tlds_file = open(sys.argv[1])
  23. -inc_file = open(sys.argv[2], 'w')
  24. +tlds_file = codecs.open(sys.argv[1], encoding='utf-8')
  25. +inc_file = codecs.open(sys.argv[2], 'w', encoding='utf-8')
  26. first = True
  27. for rule in tlds_file:
  28. --
  29. cgit v0.10.1