Commit Graph

61 Commits

Author SHA1 Message Date
Brett Cannon 2e3155e2fe Merged revisions 74107 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r74107 | brett.cannon | 2009-07-19 20:19:18 -0700 (Sun, 19 Jul 2009) | 8 lines

  Importlib's documentation said that importlib.abc.PyLoader inherited from
  importlib.abc.ResourceLoader, when in fact it did not. Fixed the ABC to inherit
  as documented.

  This does in introduce an backwards-incompatiblity as the code in PyLoader
  already required the single method ResourceLoader defined as an abstract
  method.
........
2009-07-20 03:22:43 +00:00
Brett Cannon 10e35b30fb Backport of r74103. 2009-07-20 00:19:49 +00:00
Raymond Hettinger 554290d920 Fixup/simplify another nested context manager. 2009-06-12 11:25:59 +00:00
Brett Cannon 1262e7c746 Tests for case-senstivity were not being skipped for darwin when installed on a
case-sensitive filesystems -- which is not the default case. Along the way also
fixed the skipping of tests when sys.dont_write_bytecode is true.

Closes issue #5442 again.
2009-05-11 01:47:11 +00:00
Benjamin Peterson 3c33b833dd fix name again 2009-04-04 01:21:56 +00:00
Benjamin Peterson 3e0c9176fe fix name 2009-04-04 00:46:15 +00:00
Benjamin Peterson 309633db08 fix naming 2009-04-03 23:47:26 +00:00
Benjamin Peterson 8d55a9e8dd os.path.listdir -> os.listdir 2009-04-03 22:23:43 +00:00
Brett Cannon 5561982b64 importlib.test.source.test_abc_loader was making a bad assumption that all file
paths used '/' as a path separator.

Fixes issue #5646.
2009-04-02 17:54:43 +00:00
Brett Cannon f86213f6f2 Make a test in importlib have a more robust test value. 2009-04-02 15:35:09 +00:00
Brett Cannon 978259e9b3 Give a more informative message on an importlib test upon failure. 2009-04-02 15:32:07 +00:00
Brett Cannon a3d056ed95 Check that on a platform that is expected to have a case-insensitive filesystem
that is in fact the case.

Closes issue #5442.
2009-04-02 05:17:54 +00:00
Brett Cannon 8593a75688 Fix importlib.machinery.PathFinder.find_module() to essentially skip over None
entries in sys.path_importer_cache. While this differs from semantics in how
__import__ works, it prevents any implicit semantics from taking hold with
users.
2009-03-30 19:57:15 +00:00
Brett Cannon 6ae7a7d13d Add simple tests for __import__ for future optimizations to importlib. 2009-03-30 15:53:01 +00:00
Brett Cannon 8d11013169 Implement InspectLoader for FrozenImporter. 2009-03-15 02:20:16 +00:00
Brett Cannon a113ac58be Implement InspectLoader for BuiltinImporter. 2009-03-15 01:41:33 +00:00
Brett Cannon 7aa21f75c1 A few more docstring/API cleanups for importlib. 2009-03-15 00:53:05 +00:00
Brett Cannon f87e04d339 Finish properly hiding importlib implementation code. 2009-03-12 22:47:53 +00:00
Brett Cannon 2cf03a8204 Implement importlib.util.set_loader: a decorator to automatically set
__loader__ on modules.
2009-03-10 05:17:37 +00:00
Brett Cannon d43b30b046 Implement get_source for importlib.abc.PyLoader using source_path and get_data. 2009-03-10 03:29:23 +00:00
Brett Cannon 2a922ed6ad Introduce importlib.abc. The module contains various ABCs related to imports
(mostly stuff specified by PEP 302). There are two ABCs, PyLoader and
PyPycLoader, which help with implementing source and source/bytecode loaders by
implementing load_module in terms of other methods. This removes a lot of
gritty details loaders typically have to worry about.
2009-03-09 03:35:50 +00:00
Brett Cannon ba3fcf17c8 Remove a dead XXX comment. 2009-03-09 01:58:13 +00:00
Brett Cannon f2b55fb5ee Make importlib.test.source.util.write_bytecode reset sys.dont_write_bytecode. 2009-03-09 00:02:01 +00:00
Brett Cannon 79925fdbfe Skip case-sensitivity tests for extension modules if _testcapi cannot be found. 2009-03-08 20:50:32 +00:00
Brett Cannon 435aad878c Rename importlib.util.set___package__ to set_package. 2009-03-04 16:07:00 +00:00
Brett Cannon b5f03c6779 Add a test for importlib.import_module. 2009-03-04 01:02:54 +00:00
Brett Cannon 57b46f5b0e Expose importlib.util.set___package__. 2009-03-02 14:38:26 +00:00
Brett Cannon 91cf882b36 Refactor source and bytecode file loaders in importlib so that there
are source-only and source/bytecode loaders.
2009-02-21 05:41:15 +00:00
Brett Cannon 4afab6b30b Separate out finder for source and source/bytecode. 2009-02-21 03:31:35 +00:00
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 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 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 7bf8d4ed4d Add the missing importlib.test.extension.util. 2009-02-07 02:33:52 +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 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 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 939ea76b3c Begin writing tests for importlib.machinery.PathFinder. 2009-02-05 02:53:23 +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