[Webkit-unassigned] [Bug 35163] autoinstall: should unzip downloaded zip files prior to importing

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 19 14:36:41 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=35163


Chris Jerdonek <cjerdonek at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cjerdonek at webkit.org




--- Comment #2 from Chris Jerdonek <cjerdonek at webkit.org>  2010-02-19 14:36:41 PST ---
(In reply to comment #0)
> Also, it seems like autoinstall's code should modify sys.path rather than using
> zipimport directly, as described in the following example:
> 
> http://docs.python.org/library/zipimport.html#examples

Just to expand on this a little bit.  Based on the notes and sample code from
the link above, I think the following might be a somewhat more natural flow for
autoinstall:

If autoinstall(location) is called from __file__ on a particular URL location,
then autoinstall would download the location's contents to an
"autoinstalled_packages" directory in the same directory as __file__ (if it
hasn't already been downloaded).  It would also unzip the contents if necessary
(and unzip and extract the contents in the case of a gzipped tar archive).  The
final step would be to add the unzipped and extracted folder to Python's
sys.path.

Once this is done, any calls to "import" will now also search all
autoinstalled_packages directories.

Some advantages of this approach are that--

(1) it uses Python's usual import process, without having to call zipimport
explicitly or using custom import hooks of the type described here:

http://www.python.org/dev/peps/pep-0302/

(2) it allows .pyc files to be generated.

(2) it generalizes to tar files, etc. with no change.

(3) it allows the downloaded packages to be located inside the packages in
which they are actually used if we want -- instead of requiring them all to be
in a global autoinstall folder.  For example, if the style sub-package of
webkitpy needs to autoinstall pep8, then we could put the
autoinstall(<url_to_pep8>) line in webkitpy.style's __init__.py.  Then pep8
would get downloaded into the style folder.  Or if we wanted pep8 to be
installed in the top-level autoinstall folder, we would simply call
autoinstall() from webkitpy's __init__.py.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list