From: Fabian Groffen Date: Wed, 11 Nov 2009 20:24:03 +0000 (-0000) Subject: Merged from trunk -r14803:14808 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d81911a0c2f0551c822635bd9285549ea0d818f0;p=portage.git Merged from trunk -r14803:14808 | 14804 | Restore support for bash-3. | | arfrever | | | 14805 | Bug #278336 - Use adjust_config to set PORTAGE_QUIET when | | zmedico | the config is reloaded after sync, so that PORTAGE_QUIET is | | | set when the post_sync script is executed. | | 14806 | Bug #292528 - Specify UTF-8 in the MIMEText constructor | | zmedico | arguments, in order to avoid conversiont to ascii and | | | subsequent UnicodeEncodeError when sending mail. The idea | | | comes from here: http://bugs.python.org/issue4403#msg76425. | | 14807 | Preserve previous usage of MIMEText constructor under | | zmedico | python2, since it's known to work this way. | | 14808 | Convert MIMEText body to string before sending. | | zmedico | | svn path=/main/branches/prefix/; revision=14812 --- diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index f1b73a701..50c9800e2 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -582,6 +582,9 @@ save_ebuild_env() { declare -p declare -fp + if [[ ${BASH_VERSINFO[0]} == 3 ]]; then + export + fi ) } diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index bbca25007..0e3a043d6 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -2192,6 +2192,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(trees=trees) + adjust_configs(myopts, trees) root_config = trees[settings["ROOT"]]["root_config"] portdb = trees[settings["ROOT"]]["porttree"].dbapi @@ -2206,6 +2207,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): mtimedb.commit() # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(trees=trees) + adjust_configs(myopts, trees) portdb = trees[settings["ROOT"]]["porttree"].dbapi root_config = trees[settings["ROOT"]]["root_config"] @@ -2338,6 +2340,13 @@ def action_uninstall(settings, trees, ldpath_mtimes, return rval +def adjust_configs(myopts, trees): + for myroot in trees: + mysettings = trees[myroot]["vartree"].settings + mysettings.unlock() + adjust_config(myopts, mysettings) + mysettings.lock() + def adjust_config(myopts, settings): """Make emerge specific adjustments to the config.""" diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 461b7060f..055ce4d37 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -38,7 +38,7 @@ from portage.sets import SETPREFIX from _emerge.actions import action_config, action_sync, action_metadata, \ action_regen, action_search, action_uninstall, action_info, action_build, \ - adjust_config, chk_updated_cfg_files, display_missing_pkg_set, \ + adjust_configs, chk_updated_cfg_files, display_missing_pkg_set, \ display_news_notification, getportageversion, load_emerge_config from _emerge.emergelog import emergelog from _emerge._flush_elog_mod_echo import _flush_elog_mod_echo @@ -1182,13 +1182,7 @@ def emerge_main(): settings, trees, mtimedb = load_emerge_config(trees=trees) portdb = trees[settings["ROOT"]]["porttree"].dbapi - for myroot in trees: - mysettings = trees[myroot]["vartree"].settings - mysettings.unlock() - adjust_config(myopts, mysettings) - mysettings.lock() - del myroot, mysettings - + adjust_configs(myopts, trees) apply_priorities(settings) spinner = stdout_spinner() diff --git a/pym/portage/mail.py b/pym/portage/mail.py index 9a69f9604..42ed43b83 100644 --- a/pym/portage/mail.py +++ b/pym/portage/mail.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from email.mime.text import MIMEText as TextMessage +from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart as MultipartMessage from email.mime.base import MIMEBase as BaseMessage from email.header import Header @@ -21,6 +21,12 @@ import portage if sys.hexversion >= 0x3000000: basestring = str +if sys.hexversion >= 0x3000000: + def TextMessage(_text): + return MIMEText(_text, _charset="UTF-8") +else: + TextMessage = MIMEText + def create_message(sender, recipient, subject, body, attachments=None): if sys.hexversion < 0x3000000: @@ -127,9 +133,7 @@ def send_mail(mysettings, message): myconn = smtplib.SMTP(mymailhost, mymailport) if mymailuser != "" and mymailpasswd != "": myconn.login(mymailuser, mymailpasswd) - msg = _unicode_encode(message.as_string(), - encoding=_encodings['content'], errors='backslashreplace') - myconn.sendmail(myfrom, myrecipient, msg) + myconn.sendmail(myfrom, myrecipient, message.as_string()) myconn.quit() except smtplib.SMTPException as e: raise portage.exception.PortageException(_("!!! An error occured while trying to send logmail:\n")+str(e))