Merged from trunk -r15790:15795
authorFabian Groffen <grobian@gentoo.org>
Tue, 9 Mar 2010 11:30:54 +0000 (11:30 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 9 Mar 2010 11:30:54 +0000 (11:30 -0000)
   | 15793   | Import 'email' and 'smtlib' locally since python ebuilds     |
   | zmedico | remove the 'email' module when built with USE=build.         |

   | 15795   | * Remove outdated profiles.desc sentence about "1 profile    |
   | zmedico | allowed per stable/dev/KEYWORD". Thanks to Torsten Veller    |
   |         | <tove@g.o> for reporting. * Add 'exp' to valid profiles.desc |
   |         | status values, and update the example.                       |

svn path=/main/branches/prefix/; revision=15800

man/portage.5
pym/portage/mail.py

index d81232f1c42cf3be0cb997b08edab5182e786f68..40bf89f4e64abb5af8954293e31a14ec949ca459 100644 (file)
@@ -752,23 +752,22 @@ package has been masked and WHO is doing the masking.
 .TP
 .BR profiles.desc
 List all the current stable and development profiles.  If a profile is listed 
-here, then it will be checked by repoman.  At the moment, only 1 profile is 
-allowed per stable/dev/KEYWORD; the last one found is the last one used.
-
+here, then it will be checked by repoman.
 .I Format:
 .nf
 \- comments begin with # (no inline comments)
 \- one profile list per line in format: arch dir status
 \- arch must be listed in arch.list
 \- dir is relative to profiles.desc
-\- status must be 'stable' or 'dev'
+\- status must be 'stable', 'dev', or 'exp'
 .fi
 
 .I Example:
 .nf
-alpha default-linux/alpha/2004.3 stable
-m68k  default-linux/m68k         dev
-x86   default-linux/x86/2004.3   stable
+alpha        default/linux/alpha/10.0    stable
+m68k         default/linux/m68k/10.0     dev
+x86          default/linux/x86/10.0      stable
+x86-linux    prefix/linux/x86            exp
 .fi
 .TP
 .BR repo_name
index 3836c187a4638cdd18b5f9cab3b7ee6c873563f1..722127c28df4473894de34d9f116d71ca21ab3b0 100644 (file)
@@ -3,11 +3,15 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-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
-import smtplib
+# Since python ebuilds remove the 'email' module when USE=build
+# is enabled, use a local import so that
+# portage.proxy.lazyimport._preload_portage_submodules()
+# can load this module even though the 'email' module is missing.
+# The elog mail modules won't work, but at least an ImportError
+# won't cause portage to crash during stage builds. Since the
+# 'smtlib' module imports the 'email' module, that's imported
+# locally as well.
+
 import socket
 import sys
 import time
@@ -21,16 +25,19 @@ import portage
 if sys.hexversion >= 0x3000000:
        basestring = str
 
-if sys.hexversion >= 0x3000000:
-       def TextMessage(_text):
-               mimetext = MIMEText(_text)
+def TextMessage(_text):
+       from email.mime.text import MIMEText
+       mimetext = MIMEText(_text)
+       if sys.hexversion >= 0x3000000:
                mimetext.set_charset("UTF-8")
-               return mimetext
-else:
-       TextMessage = MIMEText
+       return mimetext
 
 def create_message(sender, recipient, subject, body, attachments=None):
 
+       from email.header import Header
+       from email.mime.base import MIMEBase as BaseMessage
+       from email.mime.multipart import MIMEMultipart as MultipartMessage
+
        if sys.hexversion < 0x3000000:
                sender = _unicode_encode(sender,
                        encoding=_encodings['content'], errors='strict')
@@ -69,6 +76,9 @@ def create_message(sender, recipient, subject, body, attachments=None):
        return mymessage
 
 def send_mail(mysettings, message):
+
+       import smtplib
+
        mymailhost = "localhost"
        mymailport = 25
        mymailuser = ""