[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.39,1.40 manager.py,1.36,1.37

Mark Hammond mhammond@users.sourceforge.net
Wed Nov 27 05:49:58 2002


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv29012

Modified Files:
	addin.py manager.py 
Log Message:
First steps to stand-alone filter - check sys.frozen, and use sys.argv[0]
rather than __file__ to determine where we are.  Apparently this will work
with Gordon's installer <wink>


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** addin.py	24 Nov 2002 22:43:43 -0000	1.39
--- addin.py	27 Nov 2002 05:49:52 -0000	1.40
***************
*** 349,353 ****
      # this, we can not simply perform this load once and reuse the image.
      if not os.path.isabs(fname):
!         fname = os.path.join( os.path.dirname(__file__), "images", fname)
      if not os.path.isfile(fname):
          print "WARNING - Trying to use image '%s', but it doesn't exist" % (fname,)
--- 349,359 ----
      # this, we can not simply perform this load once and reuse the image.
      if not os.path.isabs(fname):
!         if hasattr(sys, "frozen"):
!             # images relative to the executable.
!             fname = os.path.join(os.path.dirname(sys.argv[0]),
!                                  "images", fname)
!         else:
!             # Ensure references are relative to this .py file
!             fname = os.path.join( os.path.dirname(__file__), "images", fname)
      if not os.path.isfile(fname):
          print "WARNING - Trying to use image '%s', but it doesn't exist" % (fname,)

Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** manager.py	24 Nov 2002 22:43:43 -0000	1.36
--- manager.py	27 Nov 2002 05:49:53 -0000	1.37
***************
*** 19,24 ****
  
  try:
!     this_filename = os.path.abspath(__file__)
! except NameError:
      this_filename = os.path.abspath(sys.argv[0])
  
--- 19,27 ----
  
  try:
!     if hasattr(sys, "frozen"):
!         this_filename = os.path.abspath(sys.argv[0])
!     else:
!         this_filename = os.path.abspath(__file__)
! except NameError: # no __file__
      this_filename = os.path.abspath(sys.argv[0])
  





More information about the Spambayes-checkins mailing list