trying to cope with license encoding issues

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1305 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2008-02-26 11:12:48 +00:00
parent 9c2efe45d4
commit 3157b9fb08
2 changed files with 6 additions and 10 deletions
+4 -5
View File
@@ -2501,14 +2501,13 @@ class etpDatabase:
licname = licname.strip()
if not entropyTools.is_valid_string(licname):
continue
self.connection.text_factory = lambda x: unicode(x, "raw_unicode_escape")
self.cursor.execute('SELECT text FROM licensedata WHERE licensename = (?)', (licname,))
lictext = self.cursor.fetchone()
if lictext != None:
lictext = lictext[0]
if type(lictext) is unicode: # should always be a buffer btw
licdata[licname] = lictext
else:
licdata[licname] = unicode(lictext, "raw_unicode_escape")
licdata[licname] = lictext[0]
self.storeInfoCache(idpackage,'retrieveLicensedata',licdata)
return licdata
+2 -5
View File
@@ -2117,11 +2117,8 @@ def extractPkgData(package, etpBranch = etpConst['branch'], silent = False, inje
licfile = os.path.join(licenses_dir,mylicense)
if os.access(licfile,os.R_OK):
if istextfile(licfile):
f = open(licfile,"rb")
f.seek(0,2)
size = f.tell()
f.seek(0)
data['licensedata'][mylicense] = f.read(size)
f = open(licfile)
data['licensedata'][mylicense] = f.read()
f.close()
if not silent: print_info(yellow(" * ")+red(info_package+"Getting package mirrors list..."),back = True)