[spambayes-dev] Mac OS X package

Sam Thorne sam at s-j-t.co.uk
Thu Feb 26 13:21:38 EST 2004

Ok, after a bit talking to the maintainer of the package list Thomas 
Juntunen pointed me to, and some exploration of my own I've discovered 
a few things.
One thing to clarify, when I say package, I mean an installer pkg for 
Mac OS X Installer; not a python package/module (I hadn't realised 
there were python packages and we might be talking at cross-purposes).

> Just for completeness, I thought I'd mention the MacPython 
> PackageManager contains a spambayes package (version 1.0a7, IIRC) that 
> will install automatically and try to satisfy any dependencies. The 
> maintainers may be interested in what you're doing.
> MacPython: http://homepages.cwi.nl/~jack/macpython/
> To get the spambayes package, you need to use Bob Ippolito's extended 
> package database: http://undefined.org/python/pimp/
> HTH,
> Thomas Juntunen

Briefly, Mac OS X has a layout where /System/Library is for system 
level installs, frameworks etc, the /Library which is for global user 
level installs, and finally each user has ~/Library for personal 
First off, the layout of Python on Mac OS X (10.3) seems insane to me; 
the framework for python is installed in /System/Library, which is fine 
for system level things, however instead of modifying Python's sys.path 
to include a user level install point in /Library (which would be the 
standard place) or just installing in /Library in the first place, 
they've symlinked site-packages in the lib directory in the 
/System/Library install point to /Library/Python/2.3/, so sys.path only 
contains references to /System/Library.
I don't understand why this has been done, when a .pth could have just 
used to map to a user level install dir in /Library for the search 
path, it seems to just make a confusing file structure.

> I read this issue a little differently than Tony, I think.  It sounded
> to me like you were having trouble with Python finding the imported
> modules, so I'll respond to that since Tony has already done a great 
> job
> describing the configuration and data file stuff.
> Every Python installation has a default location where it searches for
> all the standard library modules that come with the Python 
> distribution.
> Sounds like for you it is "/System/Library/Python.framework/".  One way
> to make sure that all SpamBayes apps can find the SB library modules is
> to install the "spambayes" folder and all of its contents under this
> default library path.  This is what the setup.py script in the root of
> the SpamBayes distribution does if you run "python setup.py install".

Anyway, I think what I'll do is keep the spambayes install where it is 
(/Library/SpamBayes) and put a .pth file into the system python install 
so the modules are accessible by everything else (and then the 
utilities should work).

> They should look for them wherever the config file says they are.  A
> question is where the config file should default, to, though.  On 
> Windows, a
> bayescustomize.ini file is created in the "Application Data" 
> directory, so
> everything defaults to being relative to that.  There has been some
> discussion (although it's not the case yet) of making Linux default to
> creating a .spambayesrc file in ~, or maybe ~/.spambayes.
> What's the "correct" place with OS X?  (Note that this includes the
> bayescustomize.ini file (prefs), as well as the two databases, and the 
> cache
> directories (user data), so it could be quite big).  Does anyone know 
> if
> there's a way to get the path to this, like the win32all function that
> provides the "Application Data" directory?

As for the config file, at the moment it defaults to 
/Library/SpamBayes, which is the install point for all user config 
files as well.
This was a work-around for the moment as I'm not sure how to get the 
data files for each user to be recognised by spambayes depending on who 
is logged in. spambayes is running as daemon as root, so how would the 
different user config files be loaded?
As for the actual install location, you could use ~/.spambayes or 
~/.spambayesrc. But it would probably be considered 'nicer' to put them 
somewhere easily accessible by non-commandline users though, so 
~/Library/SpamBayes would probably be a good place.
(p.s. Mac OS X is _not_ case sensitive like other unices, so don't mind 
my odd naming too much :0)

So long, and thanks for all the fish.

More information about the spambayes-dev mailing list