Commit Graph

160 Commits

Author SHA1 Message Date
Brett Cannon 2dee597e05 Do some cleanup in importlib:
+ Ditch using arguments to super().
+ Ditch subclassing from object directly.
+ Move directory check out of chaining path hook to file path hook/finder.
+ Rename some classes to better reflect they are finders, not importers.
2009-02-21 03:15:37 +00:00
Brett Cannon a2fcb1d964 Add some notes about importlib and some API exposure cleanup. 2009-02-21 03:12:17 +00:00
Brett Cannon 22db67ed26 Minor NOTES changes for importlib. 2009-02-21 02:51:12 +00:00
Brett Cannon 33dbf46544 Outline a possible way to separate out source loading from bytecode loading. 2009-02-17 07:15:17 +00:00
Brett Cannon d2e7b33815 Implement the more specific PEP 302 semantics for loaders and what happens upon
load failure in relation to reloads. Also expose
importlib.util.module_for_loader to handle all of the details of this along
with making sure all current loaders behave nicely.
2009-02-17 02:45:03 +00:00
Brett Cannon debb98d91f Document importlib.machinery.PathFinder. 2009-02-16 04:18:01 +00:00
Brett Cannon 32732e3fbd Change importlib.machinery.PathFinder to not have implicit semantics (that's
not handled by importlib._bootstrap._DefaultPathFinder).
2009-02-15 05:48:13 +00:00
Brett Cannon 4b4a4a5922 Add a NOTE about the new specific semantics for failed loads. 2009-02-15 05:46:50 +00:00
Brett Cannon c1761b7cd5 Add a NOTE that alternative VMs should be supported by importlib in a nicer
fashion by factoring out bytecode support.
2009-02-09 21:51:29 +00:00
Brett Cannon 7bf8d4ed4d Add the missing importlib.test.extension.util. 2009-02-07 02:33:52 +00:00
Brett Cannon b2071f8684 Update NOTES for importlib now that a replacement for functools.wraps is
available.
2009-02-07 02:14:07 +00:00
Brett Cannon 51d8bfc837 Create a simple substitute for functools.wraps to use in importlib._bootstrap. 2009-02-07 02:13:28 +00:00
Brett Cannon 534b2cd176 Factor out helper code from importlib.test.extension.test_path_hook. 2009-02-07 02:06:43 +00:00
Brett Cannon 36d1f3eb41 Add a note for importlib about backporting some of functools.wraps functionality. 2009-02-07 01:57:14 +00:00
Brett Cannon 06c9d96b70 Move importlib completely over to using rpartition and accepting the empty
string for top-level modules.
2009-02-07 01:52:25 +00:00
Brett Cannon d94e558fdc Move importlib's built-in importer to use rpartition for __package__. 2009-02-07 01:40:19 +00:00
Brett Cannon eb2e0dd19d Move importlib's frozen importer over to rpartition for setting __package__. 2009-02-07 01:38:38 +00:00
Brett Cannon 2c318a1390 Rewrite the code implementing __import__ for importlib. Now it is much simpler
and relies much more on meta path finders to abstract out various parts of
import.

As part of this the semantics for import_module tightened up and now follow
__import__ much more closely (biggest thing is that the 'package' argument must
now already be imported, else a SystemError is raised).
2009-02-07 01:15:27 +00:00
Brett Cannon 7f9876c0da Initial, untested stab at writing a common denominator function for __import__
and import_module.
2009-02-06 02:47:33 +00:00
Brett Cannon 6411aa5dd4 Finish implementing tests for importlib.machinery.PathFinder by testing that
implicit hooks are handled properly.
2009-02-06 00:07:49 +00:00
Brett Cannon 1f9bcd38a9 Add tests for using sys.path_hooks by importlib.machinery.PathFinder. 2009-02-05 23:36:02 +00:00
Brett Cannon 48f5c4eec6 Implement test for sys.path_importer_cache having None for
importlib.machinery.PathFinder.
2009-02-05 22:02:03 +00:00
Brett Cannon 64a3a65c26 Update NOTES for importlib about PathFinder. 2009-02-05 02:53:47 +00:00
Brett Cannon 939ea76b3c Begin writing tests for importlib.machinery.PathFinder. 2009-02-05 02:53:23 +00:00
Brett Cannon fa3d1fc6a3 Check in the fact that importlib.machinery.PathFinder now exists. 2009-02-05 02:52:57 +00:00
Brett Cannon f7e5a8c724 Rename importlib._bootstrap.SysPathFinder to PathFinder and expose off of
importlib.machinery. Also make the methods either class or staticmethods.
2009-02-05 02:52:18 +00:00
Brett Cannon 438cecd3de Add some notes for importlib to package up what is in Python 2.7 as well as modules that can probably get replaced by importlib at some point. 2009-02-02 20:32:29 +00:00
Brett Cannon 1d376687b7 To prevent another screw-up on my part where my prototype gets lost thanks to
an ``svn revert`` (gee, maybe more atomic commits by use of something like a
DVCS would help with this? Wish someone would get on that ...), I am checking
in an untested, work-in-progress meta path finder to handle sys.path.
2009-02-02 19:19:36 +00:00
Brett Cannon 02a6888d91 Note to move __package__ stuff over to rpartition to make Nick happy. Also make
sure that accepting the empty string for top-level modules is okay.
2009-02-02 05:58:30 +00:00
Brett Cannon 776e7014e9 Simplify write_bytecode for importlib. 2009-02-01 06:07:57 +00:00
Brett Cannon 20b56e1a1c Update importlib notes. 2009-02-01 05:55:23 +00:00
Brett Cannon ba96f0f89a Ditch read_source() and read_bytecode() and replace with *_path() and
get_data().
2009-02-01 05:43:31 +00:00
Brett Cannon 51c502689c Expose source_path and bytecode_path on _PyFileLoader. 2009-02-01 05:33:17 +00:00
Brett Cannon 6c3aaf3276 Remove an outdated todo item from importlib. 2009-02-01 05:04:06 +00:00
Brett Cannon d720b36248 Move import semantic util code to importlib.test.import_.util. 2009-02-01 04:28:04 +00:00
Brett Cannon bcb26c53c0 Rename importlib.test.support to importlib.test.util. 2009-02-01 04:00:05 +00:00
Brett Cannon ae9ad186d0 Do not execute the .pyc/.pyo files as well as the .py files. 2009-02-01 03:51:54 +00:00
Brett Cannon 4ee2cdaf65 Split out support code that is specific to source tests out of
importlib.test.support to importlib.test.source.util.
2009-02-01 03:08:31 +00:00
Brett Cannon 30b047dc35 Move source loader tests (including reload tests) over to
importlib.test.abc.LoaderTests.
2009-02-01 02:05:11 +00:00
Brett Cannon 223a19d8b1 Fix importlib.machinery.FrozenImporter.load_module() to set __package__
properly. Discovered by also moving the loader tests over to
importlib.test.abc.LoaderTests.
2009-02-01 01:34:13 +00:00
Brett Cannon e70485e7c1 Move extension module loader tests over to importlib.test.abc.LoaderTests. 2009-02-01 00:49:41 +00:00
Brett Cannon d98a6a014d Move built-in loader tests to importlib.test.abc.LoaderTests. 2009-02-01 00:37:13 +00:00
Brett Cannon f254a75176 Merge testing ABCs for importlib into importlib.test.abc. 2009-01-30 00:22:35 +00:00
Brett Cannon a74ccea968 Initial take on importlib.test.loader_tests. 2009-01-27 02:39:33 +00:00
Brett Cannon dd827c403f Update importlib NOTES. 2009-01-27 01:46:04 +00:00
Brett Cannon d197a2b136 Move importlib.test.frozen.test_finder over to importlib.test.finder_tests. 2009-01-27 01:44:50 +00:00
Brett Cannon 1d0b43d24e Move importlib.test.builtin.test_finder over to importlib.test.finder_tests. 2009-01-27 01:41:57 +00:00
Brett Cannon 97c8a07f1d Make importlib.test.finder_tests an ABC. 2009-01-27 01:34:30 +00:00
Brett Cannon c49715f682 Move importlib.test.extension.test_finder over to importlib.test.finder_tests. 2009-01-27 01:33:54 +00:00
Brett Cannon d0005ff41f Update NOTES for importlib. 2009-01-26 01:54:40 +00:00
Brett Cannon 78246b6b45 Document both importlib.machinery.BuiltinImporter and FrozenImporter. 2009-01-25 04:56:30 +00:00
Brett Cannon 7f400e1366 Add some comment markers to more clearly delineate what different parts of the
code are for. Also add a note that the import * at the end of the file should
eventually go away.
2009-01-22 22:44:04 +00:00
Brett Cannon 5abdc93eb8 Add importlib.machinery with its first tenants, BuitinImporter and
FrozenImporter. Docs forthcoming.

I plan on all finders and loaders (and most likely hooks) to live
in imoprtlib.machinery. Utility stuff will end up in importlib.util.
Higher-level API stuff will stay on imoprtlib directly (e.g. import_module).
2009-01-22 22:43:07 +00:00
Brett Cannon afccd63ac9 Document the (very small) public API for importlib. As time goes on and some
key refactorings occur more of the API will be exposed and documented.
2009-01-20 02:21:27 +00:00
Brett Cannon d994864d54 Remove a debugging print statement that accidentally got left in. 2009-01-19 07:07:58 +00:00
Brett Cannon b4a1b8c541 Fix a typo in some code that is not tested or supported yet.
Closes issue 4993. Thanks Antoine Pitrou for the catch.
2009-01-19 06:56:16 +00:00
Brett Cannon 2c5c79cfc4 Tests of case-sensitivity were being executed on OSs which did not have a
case-insensitive file system, leading to test failures. This was due to using
the TestCase objects directly instead of the guard in the test_main() function.
Move over to a class decorator instead to control if the tests should be run.
2009-01-18 06:55:05 +00:00
Brett Cannon 24b6a2cf38 NOTES for importlib should mention the ultimate end-goal for the package. 2009-01-18 00:36:55 +00:00
Brett Cannon 7044d6b848 Skip over any file or folder that starts with a dot (e.g. .svn). 2009-01-18 00:36:22 +00:00
Brett Cannon 23cbd8a656 Add initial implementation of importlib. See the NOTES files for what is
planned for the package.

There are no docs yet, but they are coming once the API for the first new
function, importlib.import_module() is finalized.
2009-01-18 00:24:28 +00:00