Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-29 Thread Thomas Heller
Am 29.03.2013 02:06, schrieb Gregory P. Smith: On Thu, Mar 28, 2013 at 9:09 AM, Brett Cannon mailto:br...@python.org>> wrote: On Thu, Mar 28, 2013 at 10:44 AM, Thomas Heller mailto:thel...@ctypes.org>> wrote: The zip-file itself could support importing compiled extensions w

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-28 Thread Gregory P. Smith
On Thu, Mar 28, 2013 at 9:09 AM, Brett Cannon wrote: > > > > On Thu, Mar 28, 2013 at 10:44 AM, Thomas Heller wrote: > >> Am 27.03.2013 20:38, schrieb Vinay Sajip: >> >> This quote is here to stop GMane complaining that I'm top-posting. Ignore. >>> >>> I've already posted this to distut

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-28 Thread Christian Heimes
Am 28.03.2013 17:09, schrieb Brett Cannon: > Which must be done carefully to prevent a security issue. It shouldn't > be unzipped anywhere but into a directory only writable by the process. Cleanup is going to be tricky or even impossible. Windows locks loaded DLLs and therefore prevents their re

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-28 Thread Brett Cannon
On Thu, Mar 28, 2013 at 10:44 AM, Thomas Heller wrote: > Am 27.03.2013 20:38, schrieb Vinay Sajip: > > This quote is here to stop GMane complaining that I'm top-posting. Ignore. >>> >> >> I've already posted this to distutils-sig, but thought that it might be of >> interest to readers here as it

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-28 Thread Thomas Heller
Am 27.03.2013 20:38, schrieb Vinay Sajip: This quote is here to stop GMane complaining that I'm top-posting. Ignore. I've already posted this to distutils-sig, but thought that it might be of interest to readers here as it relates to importing C extensions ... zipimport is great, but there can

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread PJ Eby
On Wed, Mar 27, 2013 at 5:19 PM, Bradley M. Froehle wrote: > I implemented just such a path hook zipimporter plus the magic required > for C extensions --- as a challenge to myself to learn more about the Python > import mechanisms. > > See https://github.com/bfroehle/pydzipimport. FYI, ther

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Bradley M. Froehle
On Wed, Mar 27, 2013 at 1:13 PM, Amaury Forgeot d'Arc wrote: > 2013/3/27 Vinay Sajip > >> When you mount a wheel, its absolute path name is added to >> sys.path, allowing the Python code in it to be imported. >> > > Better: just put the wheel path to sys.path > sys.path.append('/tmp/simplejso

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Vinay Sajip
Daniel Holth gmail.com> writes: > zipping from ever happening. This is an important reason why wheel is > billed as an installation format -- fewer users with pitchforks. It's > very cool that it works though. Debugging is slightly easier than it > was in the old days because pdb can now read the

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Vinay Sajip
Stefan Behnel behnel.de> writes: > I've always hated this setuptools misfeature of copying C extensions from > an installed archive into a user directory, one for each user. At least > during normal installation, they should be properly unpacked into normal > shared library files in the file sys

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Daniel Holth
Jim Fulton is right that weird failures are a characteristic of zipped eggs, so one of the #1 requests for setuptools is how to prohibit zipping from ever happening. This is an important reason why wheel is billed as an installation format -- fewer users with pitchforks. It's very cool that it work

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Vinay Sajip
Amaury Forgeot d'Arc gmail.com> writes: > Better: just put the wheel path to sys.path    sys.path.append('/tmp/simplejson-3.1.2-cp27-none-linux_x86_64.whl') > and let a sys.path_hook entry do the job. That's what the mount() actually does - adds the wheel to a registry that an import hook uses.

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Stefan Behnel
Vinay Sajip, 27.03.2013 20:38: > >>> w = Wheel('/tmp/simplejson-3.1.2-cp27-none-linux_x86_64.whl') > >>> w.mount() > >>> import simplejson._speedups > >>> dir(simplejson._speedups) > ['__doc__', '__file__', '__loader__', '__name__', '__package__', > 'encode_basestring_ascii', 'make_encoder', 'make

Re: [Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Amaury Forgeot d'Arc
2013/3/27 Vinay Sajip > When you mount a wheel, its absolute path name is added to > sys.path, allowing the Python code in it to be imported. > Better: just put the wheel path to sys.path sys.path.append('/tmp/simplejson-3.1.2-cp27-none-linux_x86_64.whl') and let a sys.path_hook entry do the

[Python-Dev] Safely importing zip files with C extensions

2013-03-27 Thread Vinay Sajip
> This quote is here to stop GMane complaining that I'm top-posting. Ignore. I've already posted this to distutils-sig, but thought that it might be of interest to readers here as it relates to importing C extensions ... zipimport is great, but there can be issues importing software that contains