annotate PC/testpy.py @ 80661:94de77bd0b4b 2.7

Issue #16194: document imp.load_dynamic problems when read several extension modules from the same binary object file.
author Andrew Svetlov <andrew.svetlov@gmail.com>
date Thu, 29 Nov 2012 19:51:28 +0200
parents 4727f260f6f8
children 87a0fdcaa84a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36763
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
1 import sys
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
2
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
3 # This is a test module for Python. It looks in the standard
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
4 # places for various *.py files. If these are moved, you must
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
5 # change this module too.
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
6
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
7 try:
37021
4727f260f6f8 Remove regsub, reconvert, regex, regex_syntax and everything under lib-old.
Neal Norwitz <nnorwitz@gmail.com>
parents: 36763
diff changeset
8 import os
36763
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
9 except:
37021
4727f260f6f8 Remove regsub, reconvert, regex, regex_syntax and everything under lib-old.
Neal Norwitz <nnorwitz@gmail.com>
parents: 36763
diff changeset
10 print """Could not import the standard "os" module.
36763
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
11 Please check your PYTHONPATH environment variable."""
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
12 sys.exit(1)
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
13
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
14 try:
37021
4727f260f6f8 Remove regsub, reconvert, regex, regex_syntax and everything under lib-old.
Neal Norwitz <nnorwitz@gmail.com>
parents: 36763
diff changeset
15 import symbol
36763
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
16 except:
37021
4727f260f6f8 Remove regsub, reconvert, regex, regex_syntax and everything under lib-old.
Neal Norwitz <nnorwitz@gmail.com>
parents: 36763
diff changeset
17 print """Could not import the standard "symbol" module. If this is
36763
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
18 a PC, you should add the dos_8x3 directory to your PYTHONPATH."""
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
19 sys.exit(1)
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
20
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
21 import os
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
22
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
23 for dir in sys.path:
37021
4727f260f6f8 Remove regsub, reconvert, regex, regex_syntax and everything under lib-old.
Neal Norwitz <nnorwitz@gmail.com>
parents: 36763
diff changeset
24 file = os.path.join(dir, "os.py")
36763
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
25 if os.path.isfile(file):
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
26 test = os.path.join(dir, "test")
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
27 if os.path.isdir(test):
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
28 # Add the "test" directory to PYTHONPATH.
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
29 sys.path = sys.path + [test]
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
30
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
31 import regrtest # Standard Python tester.
5e463ae70707 Remove svn:mime-type (inexplicably set to a binary type),
Tim Peters <tim.peters@gmail.com>
parents: 32737
diff changeset
32 regrtest.main()