Hey Jim,

Yeah, was thinking about something similar a while ago. The temp directory approach may not work in all places, but should work for >80%

Darjus

On Mon, Oct 27, 2014 at 3:55 AM, Jim Baker <report@bugs.jython.org> wrote:

Jim Baker added the comment:

I just worked on standalone support for #2196, and this gave me some fresh insight.

The best approach likely is to provide a new Clamp-specific runner similar to org.python.util.JarRunner. Let's assume a name like org.python.tools.ClampRunner. Clamp currently packs Lib files under /Lib in the jar so they can be used by existing but limited standalone support (see PySystemState#isStandalone for some specifics). Instead ClampRunner will unpack these files to a temporary directory (using the Java 7 support, Files#createTempDirectory), ensuring these are all deleted upon exit (File#deleteOnExit). Then it will call PySystemState#initialize with python.path property set to this unpacked directory.

Because it's a true directory, we will get standard file introspection that caused this bug to be submitted in the frist place.

Note that will also make it feasible to support the package cache using a similar scheme (python.cachedir property setting).

Lastly, this can be done completely outside of the Jython 2.7 dev cycle, but instead in Clamp instead. (Still need to verify that package cache can be constructed without such changes, but it can certainly be used without.)

----------
nosy: +darjus

_______________________________________
Jython tracker <report@bugs.jython.org>
<http://bugs.jython.org/issue2143>
_______________________________________