* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/
@ 2011-02-08 20:48 Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-02-08 20:48 UTC (permalink / raw
To: gentoo-commits
commit: 4bb602539fc3e87961d06c447a7d7e1adf9252c5
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 8 09:32:09 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 8 20:45:45 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4bb60253
portage.debug: handle threading ImportError
---
pym/portage/debug.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/pym/portage/debug.py b/pym/portage/debug.py
index e18d02c..ce642fe 100644
--- a/pym/portage/debug.py
+++ b/pym/portage/debug.py
@@ -1,7 +1,13 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-import os, sys, threading
+import os
+import sys
+
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
import portage.const
from portage.util import writemsg
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/
@ 2011-02-20 0:04 Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-02-20 0:04 UTC (permalink / raw
To: gentoo-commits
commit: d77e649b6a53500fcca87b1b02ecf18846d917ac
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 18 08:03:10 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Feb 20 00:01:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d77e649b
mail: handle unicode in subject for python3
---
pym/portage/mail.py | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/pym/portage/mail.py b/pym/portage/mail.py
index f87efe2..598c1f9 100644
--- a/pym/portage/mail.py
+++ b/pym/portage/mail.py
@@ -67,9 +67,19 @@ def create_message(sender, recipient, subject, body, attachments=None):
mymessage.set_unixfrom(sender)
mymessage["To"] = recipient
mymessage["From"] = sender
- # Use Header as a workaround so that long subject lines are wrapped
- # correctly by <=python-2.6 (gentoo bug #263370, python issue #1974).
- mymessage["Subject"] = Header(subject)
+
+ if sys.hexversion >= 0x3000000:
+ # Avoid UnicodeEncodeError in python3 with non-ascii characters.
+ # File "/usr/lib/python3.1/email/header.py", line 189, in __init__
+ # self.append(s, charset, errors)
+ # File "/usr/lib/python3.1/email/header.py", line 262, in append
+ # input_bytes = s.encode(input_charset, errors)
+ #UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
+ mymessage["Subject"] = subject
+ else:
+ # Use Header as a workaround so that long subject lines are wrapped
+ # correctly by <=python-2.6 (gentoo bug #263370, python issue #1974).
+ mymessage["Subject"] = Header(subject)
mymessage["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S %z")
return mymessage
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/
@ 2011-02-20 0:04 Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-02-20 0:04 UTC (permalink / raw
To: gentoo-commits
commit: 9db88c62b9c610f26abc129116ff1f90810eb643
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 18 08:32:27 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Feb 20 00:01:47 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9db88c62
mail: handle unicode in subject more for python3
---
pym/portage/mail.py | 48 ++++++++++++++++++++++++++----------------------
1 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/pym/portage/mail.py b/pym/portage/mail.py
index 598c1f9..7268398 100644
--- a/pym/portage/mail.py
+++ b/pym/portage/mail.py
@@ -24,6 +24,20 @@ import portage
if sys.hexversion >= 0x3000000:
basestring = str
+ def _force_ascii_if_necessary(s):
+ # Force ascii encoding in order to avoid UnicodeEncodeError
+ # from smtplib.sendmail with python3 (bug #291331).
+ s = _unicode_encode(s,
+ encoding='ascii', errors='backslashreplace')
+ s = _unicode_decode(s,
+ encoding='ascii', errors='replace')
+ return s
+
+else:
+
+ def _force_ascii_if_necessary(s):
+ return s
+
def TextMessage(_text):
from email.mime.text import MIMEText
mimetext = MIMEText(_text)
@@ -68,18 +82,16 @@ def create_message(sender, recipient, subject, body, attachments=None):
mymessage["To"] = recipient
mymessage["From"] = sender
- if sys.hexversion >= 0x3000000:
- # Avoid UnicodeEncodeError in python3 with non-ascii characters.
- # File "/usr/lib/python3.1/email/header.py", line 189, in __init__
- # self.append(s, charset, errors)
- # File "/usr/lib/python3.1/email/header.py", line 262, in append
- # input_bytes = s.encode(input_charset, errors)
- #UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
- mymessage["Subject"] = subject
- else:
- # Use Header as a workaround so that long subject lines are wrapped
- # correctly by <=python-2.6 (gentoo bug #263370, python issue #1974).
- mymessage["Subject"] = Header(subject)
+ # Use Header as a workaround so that long subject lines are wrapped
+ # correctly by <=python-2.6 (gentoo bug #263370, python issue #1974).
+ # Also, need to force ascii for python3, in order to avoid
+ # UnicodeEncodeError with non-ascii characters:
+ # File "/usr/lib/python3.1/email/header.py", line 189, in __init__
+ # self.append(s, charset, errors)
+ # File "/usr/lib/python3.1/email/header.py", line 262, in append
+ # input_bytes = s.encode(input_charset, errors)
+ #UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
+ mymessage["Subject"] = Header(_force_ascii_if_necessary(subject))
mymessage["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S %z")
return mymessage
@@ -138,7 +150,7 @@ def send_mail(mysettings, message):
# user wants to use a sendmail binary instead of smtp
if mymailhost[0] == os.sep and os.path.exists(mymailhost):
fd = os.popen(mymailhost+" -f "+myfrom+" "+myrecipient, "w")
- fd.write(message.as_string())
+ fd.write(_force_ascii_if_necessary(message.as_string()))
if fd.close() != None:
sys.stderr.write(_("!!! %s returned with a non-zero exit code. This generally indicates an error.\n") % mymailhost)
else:
@@ -155,15 +167,7 @@ def send_mail(mysettings, message):
if mymailuser != "" and mymailpasswd != "":
myconn.login(mymailuser, mymailpasswd)
- message_str = message.as_string()
- if sys.hexversion >= 0x3000000:
- # Force ascii encoding in order to avoid UnicodeEncodeError
- # from smtplib.sendmail with python3 (bug #291331).
- message_str = _unicode_encode(message_str,
- encoding='ascii', errors='backslashreplace')
- message_str = _unicode_decode(message_str,
- encoding='ascii', errors='replace')
-
+ message_str = _force_ascii_if_necessary(message.as_string())
myconn.sendmail(myfrom, myrecipient, message_str)
myconn.quit()
except smtplib.SMTPException as e:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/
@ 2011-03-14 16:24 Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-03-14 16:24 UTC (permalink / raw
To: gentoo-commits
commit: 1e4cde5799c281bc4541e2f8f4e3def7ad335fc5
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 6 00:41:00 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 16:21:57 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1e4cde57
eclass_cache: remove deprecated methods
---
pym/portage/eclass_cache.py | 17 ++---------------
1 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py
index 878df4e..1374f1d 100644
--- a/pym/portage/eclass_cache.py
+++ b/pym/portage/eclass_cache.py
@@ -1,6 +1,6 @@
-# Copyright: 2005,2010 Gentoo Foundation
+# Copyright 2005-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
# Author(s): Nicholas Carpaski (carpaski@gentoo.org), Brian Harring (ferringb@gentoo.org)
-# License: GPL2
__all__ = ["cache"]
@@ -61,19 +61,6 @@ class cache(object):
self.eclasses.update(other.eclasses)
self._eclass_locations.update(other._eclass_locations)
- def close_caches(self):
- import traceback
- traceback.print_stack()
- print("%s close_cache is deprecated" % self.__class__)
- self.eclasses.clear()
-
- def flush_cache(self):
- import traceback
- traceback.print_stack()
- print("%s flush_cache is deprecated" % self.__class__)
-
- self.update_eclasses()
-
def update_eclasses(self):
self.eclasses = {}
self._eclass_locations = {}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/
@ 2011-05-04 20:03 Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-05-04 20:03 UTC (permalink / raw
To: gentoo-commits
commit: 22b50e4d2502bc01d6133e1252e9d49ce447e5e9
Author: Mike Gilbert <floppymaster <AT> gmail <DOT> com>
AuthorDate: Wed May 4 03:28:21 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 4 19:54:41 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=22b50e4d
Fix Manifest.updateAllHashes()
---
pym/portage/manifest.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index ec801a3..de7540f 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -481,7 +481,7 @@ class Manifest(object):
def updateAllHashes(self, checkExisting=False, ignoreMissingFiles=True):
""" Regenerate all hashes for all files in this Manifest. """
- for ftype in portage.const.MANIFEST2_IDENTIFIERS:
+ for idtype in portage.const.MANIFEST2_IDENTIFIERS:
self.updateTypeHashes(idtype, fname, checkExisting)
def updateCpvHashes(self, cpv, ignoreMissingFiles=True):
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-04 20:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-20 0:04 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2011-05-04 20:03 Zac Medico
2011-03-14 16:24 Zac Medico
2011-02-20 0:04 Zac Medico
2011-02-08 20:48 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox