classification
Title: PEP 338 implementation
Type: Stage:
Components: None Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ncoghlan
Priority: normal Keywords: patch

Created on 2006-02-11 09:04 by ncoghlan, last changed 2006-03-17 10:06 by ncoghlan. This issue is now closed.

Files
File name Uploaded Description Edit
runpy_demo.zip ncoghlan, 2006-02-12 03:29 Demo hierarchy for trying out runpy
pep338_switch.diff ncoghlan, 2006-02-12 03:33 Integrate -m switch with runpy module (version 2)
runpy.py ncoghlan, 2006-02-18 17:52 PEP 338 implementation (version 6)
test_runpy.py ncoghlan, 2006-02-18 17:56 Version 2 of unit tests for runpy.py
Messages (13)
msg49457 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-11 09:04
This PEP implementation contains three parts - a
separate Python module (runpy.py) that implements the
PEP 338 functionality, a corresponding test module
(test_runpy.py) and a patch against current subversion
to integrate the module with the -m command line switch.

The documentation for the new module will be submitted
as a separate patch (since the review cycle is a bit
different).
msg49458 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-11 14:28
Logged In: YES 
user_id=1038590

Updated to avoid trying to hide exec's quirks.
msg49459 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-11 15:29
Logged In: YES 
user_id=1038590

Version 3 of implementation. Fixed emulator to generate an
ImportError for non-packages (instead of an AttributeError
in some cases).

Removed extraneous print statements from emulator.
msg49460 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-11 15:35
Logged In: YES 
user_id=1038590

Added basic test suite. Could use beefing up in the area of
actually checking that running modules inside packages works
correctly (I'm currently checking that bit manually).
msg49461 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-11 16:50
Logged In: YES 
user_id=1038590

Version 4 of implementation. Fixes problem with not handling
nested packages and raises ImportError in run_module when no
loader is found.
msg49462 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-12 02:12
Logged In: YES 
user_id=1038590

Version 5. Removed an import that is now redundant, added a
comment header with author information.
msg49463 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-12 03:12
Logged In: YES 
user_id=1038590

Added patch to main.c for integration with command line switch.
msg49464 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-12 03:29
Logged In: YES 
user_id=1038590

I've attached a zip archive of the directory tree I've been
using to check that the runpy module works correctly. For
each of these command lines:

python -m runpy_demo.test
python -m runpy_demo.pkg.test
python -m runpy_demo.pkg.pkg.test
python -m runpy_demo.pkg.zip_pkg.test

The message "Running runpy_demo.test" should then print to
the console (with the second part of the message changing as
appropriate for the other 3 modules).

The last one obviously won't work if zlib isn't installed,
and all 4 require that both runpy and runpy_demo be on
sys.path (e.g in site-packages, or in the Lib directory).

On older Python versions (or without applying the patch),
invoking runpy directly is enough to make it work

python -m runpy runpy_demo.test
python -m runpy runpy_demo.pkg.test
python -m runpy runpy_demo.pkg.pkg.test
python -m runpy runpy_demo.pkg.zip_pkg.test

msg49465 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-12 03:33
Logged In: YES 
user_id=1038590

Fixed error handling in main.c when the function call
results in an exception. (version 2 of integration diff).
msg49466 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-17 15:19
Logged In: YES 
user_id=1038590

PEP 338 has been updated as of 18-Feb-2006. Those changes
are still to be incorporated into this implementation.
msg49467 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-18 17:52
Logged In: YES 
user_id=1038590

Updated module to match Feb 18 version of PEP (version 6 of
module)
msg49468 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-02-18 17:56
Logged In: YES 
user_id=1038590

Updated unit tests to match Feb 18 version of PEP and to
cover executing both source and compiled files from the file
system.

(version 2 of test_runpy module)
msg49469 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-03-17 10:06
Logged In: YES 
user_id=1038590

Slightly updated version of patch committed in SVN
History
Date User Action Args
2006-02-11 09:04:49ncoghlancreate