Update of /cvsroot/tmda/tmda/bin
In directory usw-pr-cvs1:/tmp/cvs-serv3532/bin

Modified Files:
        ChangeLog paths.py tmda-address tmda-check-address tmda-filter 
        tmda-inject tmda-keygen tmda-ofmipd tmda-pending tmda-rfilter 
        tmda-sendmail 
Log Message:
Add Barry Warsaw's `email' package version 2.3 to the distribution.
email is covered by the "good" Python license which is compatible with
the GPL, so this is all kosher.  

email is a new Python package for parsing, handling, and generating
email messages and other RFC 2822 style documents.  It is intended to
replace several older modules in the standard distribution, such as
rfc822, mimetools, multifile, mimify, and MIMEWriter, and such
non-standard modules as mimecntl.

Using email within TMDA should provide additional performance,
robustness, and make new features such as MIME and multi-lingual
support much easier to implement.

We include the package so we don't have to require a minimum of Python
2.3 in order to run TMDA (which is too restrictive at this point).
Instead, only a minimum of Python 2.1 will be required.  This
flexibility comes at the expense of adding an additional 144K to TMDA.

NOTE to developers:

The email package is designed to be a top level package.  So, pure
Python programs like TMDA should always import through "email" as the
top level package.

This means we can't do relative imports from the email package.  e.g,
we must use:

from email import Parser

rather than:

from TMDA.pythonlib.email import Parser

The latter will not work.

email is installed underneath the TMDA module directory:

TMDA/
    pythonlib/
             email/

But we still must add TMDA/pythonlib to the front of sys.path
regardless of whether we are running TMDA from a self-contained
directory, or a package installation like an RPM.

Accordingly, code was added to each bin/tmda-foo program (for package
installation) as well as to bin/paths.py (for directory installation).


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -r1.227 -r1.228
--- ChangeLog   4 Sep 2002 03:08:51 -0000       1.227
+++ ChangeLog   11 Sep 2002 22:35:59 -0000      1.228
@@ -1,3 +1,10 @@
+2002-09-11  Jason R. Mastaler  <[EMAIL PROTECTED]>
+
+       * tmda-*: Prepend prefix/site-packages/TMDA/pythonlib if the
+       import of paths fails in order to support package installations.
+       
+       * paths.py: Prepend prefix/TMDA/pythonlib to the sys.path.
+       
 2002-09-03  Jason R. Mastaler  <[EMAIL PROTECTED]>
 
        * tmda-ofmipd (run_remoteauth): Add support for APOP

Index: paths.py
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/paths.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- paths.py    27 Feb 2002 22:01:42 -0000      1.5
+++ paths.py    11 Sep 2002 22:35:59 -0000      1.6
@@ -19,16 +19,14 @@
 # along with TMDA; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-"""
-Hack the path to include the parent directory of the $prefix/TMDA
-package directory.
-"""
+"""Fixup sys.path."""
 
 import os
 import sys
 
 progpath = os.path.abspath(sys.argv[0])
 
+# Handle symbolic links.
 if os.path.islink(progpath):
     progdir = os.path.dirname(progpath)
     linkpath = os.readlink(progpath)
@@ -37,6 +35,11 @@
     else:
         progpath = os.path.normpath(progdir + '/' + linkpath)
 
-prefix = os.path.split(os.path.dirname(progpath))[0] # '../'
+# Hack the path to include the parent directory ('../')
+prefix = os.path.split(os.path.dirname(progpath))[0]
+sys.path.insert(0, prefix)
 
-sys.path.insert(1, prefix)
+# We also need the TMDA/pythonlib directory on the path to pick up any
+# overrides of standard modules and packages.  Note that these must go
+# at the very front of the path for this reason.
+sys.path.insert(0, os.path.join(prefix, 'TMDA', 'pythonlib'))

Index: tmda-address
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-address,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- tmda-address        16 Jun 2002 01:58:36 -0000      1.6
+++ tmda-address        11 Sep 2002 22:35:59 -0000      1.7
@@ -68,7 +68,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Version
 

Index: tmda-check-address
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-check-address,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- tmda-check-address  7 Jun 2002 01:42:10 -0000       1.9
+++ tmda-check-address  11 Sep 2002 22:35:59 -0000      1.10
@@ -54,7 +54,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Defaults
 from TMDA import Cookie

Index: tmda-filter
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-filter,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- tmda-filter 27 Jun 2002 17:55:44 -0000      1.111
+++ tmda-filter 11 Sep 2002 22:35:59 -0000      1.112
@@ -43,7 +43,10 @@
     try:
         import paths
     except ImportError:
-        pass
+        # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+        sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                               'site-packages', 'TMDA', 'pythonlib')
+        sys.path.insert(0, sitedir)
 
     program = sys.argv[0]
     execdir = os.path.dirname(os.path.abspath(program))

Index: tmda-inject
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-inject,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- tmda-inject 9 Aug 2002 22:34:33 -0000       1.66
+++ tmda-inject 11 Sep 2002 22:35:59 -0000      1.67
@@ -69,7 +69,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Version
 

Index: tmda-keygen
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-keygen,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- tmda-keygen 14 May 2002 16:47:04 -0000      1.17
+++ tmda-keygen 11 Sep 2002 22:35:59 -0000      1.18
@@ -51,7 +51,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Version
 

Index: tmda-ofmipd
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-ofmipd,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- tmda-ofmipd 4 Sep 2002 23:54:36 -0000       1.16
+++ tmda-ofmipd 11 Sep 2002 22:35:59 -0000      1.17
@@ -113,7 +113,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Util
 from TMDA import Version

Index: tmda-pending
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-pending,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- tmda-pending        27 Jun 2002 03:17:57 -0000      1.28
+++ tmda-pending        11 Sep 2002 22:35:59 -0000      1.29
@@ -152,7 +152,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Version
 

Index: tmda-rfilter
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-rfilter,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- tmda-rfilter        24 Aug 2002 00:53:10 -0000      1.62
+++ tmda-rfilter        11 Sep 2002 22:35:59 -0000      1.63
@@ -64,7 +64,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Version
 

Index: tmda-sendmail
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-sendmail,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tmda-sendmail       27 Feb 2002 22:01:42 -0000      1.7
+++ tmda-sendmail       11 Sep 2002 22:35:59 -0000      1.8
@@ -32,7 +32,10 @@
 try:
     import paths
 except ImportError:
-    pass
+    # Prepend /usr/lib/python2.x/site-packages/TMDA/pythonlib
+    sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
+                           'site-packages', 'TMDA', 'pythonlib')
+    sys.path.insert(0, sitedir)
 
 from TMDA import Version
 

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to