[Twisted-Python] mktap searchpath

Andrew Bennetts andrew-twisted at puzzling.org
Tue Jun 10 02:07:26 EDT 2003


On Tue, Jun 10, 2003 at 01:15:54AM -0400, Jp Calderone wrote:
> On Tue, Jun 10, 2003 at 01:29:28PM +1000, Andre Perry wrote:
> > When calling mktap with a twisted dir in the current directory the real
> > twisted dir is not searched for plugins.tml.  The twisted dir in the
> > current directory does not contain a plugins.tml file.
> > 
> > Is this the desired behaviour or a bug?
> 
>   This is the desired behavior.  You cannot have them both searched, or you
> will end up with doubly registered plugins, each of which refer to whatever
> modules come first in the python import search path -- which means we should
> pick up the information from whichever plugins.tml file we find first too,
> and ignore anything found later.

You're assuming his ~/twisted directory contains the Twisted source, rather
than just being a directory with random stuff in it.  If that directory
contained a __init__.py file, then it would be a Python package and
presumably Python would then be unable to import the real Twisted, so that's
not a problem with mktap.  But if the directory *doesn't* contain
__init__.py, then there's no ambiguity in Python's import search path, but
mktap still will check ~/twisted for plugins.tml, but not
os.path.basename(twisted.__file__).

So mktap will treat the search path differently to Python's import
mechanisms, at least in the case where a directory has a name that conflicts
with a later python package, but doesn't have an __init__.py.

This smells like a bug to me, but I could be wrong.

-Andrew.





More information about the Twisted-Python mailing list