[121365] branches/gsoc14-pip2port
gaurav at macports.org
gaurav at macports.org
Tue Jun 24 00:09:21 PDT 2014
Revision: 121365
https://trac.macports.org/changeset/121365
Author: gaurav at macports.org
Date: 2014-06-24 00:09:20 -0700 (Tue, 24 Jun 2014)
Log Message:
-----------
Updated the encoding to only printable strings
Modified Paths:
--------------
branches/gsoc14-pip2port/license.py
branches/gsoc14-pip2port/pypi2port.py
Modified: branches/gsoc14-pip2port/license.py
===================================================================
--- branches/gsoc14-pip2port/license.py 2014-06-24 03:46:27 UTC (rev 121364)
+++ branches/gsoc14-pip2port/license.py 2014-06-24 07:09:20 UTC (rev 121365)
@@ -5,6 +5,7 @@
import xmlrpclib
import sys
+import string
#import pdb
#from datetime import datetime
@@ -25,12 +26,8 @@
if data:
# pdb.set_trace()
license = data['license']
- try:
- license = license.decode('utf-8','ignore')
- license = license.encode('utf-8','ignore')
- print package_name,vers,license
- except:
- print package_name,vers
+ license = filter(lambda x: x in string.printable, license)
+ print package_name,vers,license
else:
print package_name,vers
else:
Modified: branches/gsoc14-pip2port/pypi2port.py
===================================================================
--- branches/gsoc14-pip2port/pypi2port.py 2014-06-24 03:46:27 UTC (rev 121364)
+++ branches/gsoc14-pip2port/pypi2port.py 2014-06-24 07:09:20 UTC (rev 121365)
@@ -219,6 +219,7 @@
license = dict['license']
if license and not license == "UNKNOWN":
license = license.encode('utf-8')
+ license = filter(lambda x: x in string.printable, license)
license = license.split('\n')[0]
license = re.sub(r'[\[\]\{\}\;\:\$\t\"\'\`\=(--)]+', ' ', license)
license = re.sub(r'\s(\s)+', ' ', license)
@@ -261,6 +262,7 @@
description = dict['description']
if description:
description = description.encode('utf-8')
+ description = filter(lambda x: x in string.printable, description)
description = re.sub(r'[\[\]\{\}\;\:\$\t\"\'\`\=(--)]+',
' ', description)
description = re.sub(r'\s(\s)+', ' ', description)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140624/f0dd6d30/attachment.html>
More information about the macports-changes
mailing list