开发者

Is there a way to load python scripts from a zipfile in ironpython

I want to have extensions to my application written in IronPython. Part of those extensions will use decorators, and so I wish to include the decorator module in the package.

The issue is that the decorator depends on several modules existing in the IronPython distribution, and those modules depend on other modules and so on.

The easiest solution would be to include the entire Lib folder in the application, but that would increase the fo开发者_如何学JAVAotprint by 500 files and 12 mb.

To avoid that I'm trying to zip the modules and load them from the zip file instead of directly from the filesystem, but I haven't found a straightforward way to do so.

I've spotted the importer mechanism for loading modules via a "path_hooks" global , which seems to give me access to something similar to the imp mechanism in Python, but I'm not sure of how to use it.

Is there a hook for the import mechanism in IronPython that I'm missing? How should I go about implementing this?


What you want is zipimport support, which isn't implemented yet. If you'd like to help out with that I can put you in touch with the guy who's working on it.

Otherwise, it looks like you might just need to stub out the bits of inspect.py that decorator.py needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜