[Distutils] Re: [PSA MEMBERS] packages in Python
Fred L. Drake
Fred L. Drake, Jr." <email@example.com
Fri, 21 May 1999 15:55:46 -0400 (EDT)
Perry A. Stoll writes:
> Good point. Can you recommend a concise place that the import mechanism (in
> all it's glory) is documented?
Documentation? Ha! I don't have no stinkin' documentation! ;-)
I think going over Python/import.c is the best bet. There's an
import_package() function (I think that's the name); probably the best
bet is to modify that to build the right __path__ value; at this point
we know it's a package, so we're not interfering with the performance
of importing non-packages, only the package/subpackages themselves.
> That should solve the problem, except for when freeze-ing or making a static
> python binary (as previously mentioned by Konrad).
I don't know enough about freezing, but I suspect that's not too
difficult; probably about the same as staticly linked package-ized
modules. ;-) I don't think those will actually be that difficult for
someone that has time to read the code; the only real problem is the
public symbol for the module init function.
> I was poking around in ihooks.py. It looks like it should be possible to
> cook up something approximating this using ihooks. What do you think?
That can probably be done, but places the import machinery in Python
rather than in C, so it'll be slow.
Fred L. Drake, Jr. <firstname.lastname@example.org>
Corporation for National Research Initiatives