diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-05-08 20:31:11 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-05-08 20:31:11 (GMT) |
commit | 900ee3a07346ce12d5963ea531bf506daa1f5e46 (patch) | |
tree | b9e6e4991db920485112a2bd9a3ec29a57359f65 /Lib | |
parent | 0e87f0f74b489f5d8231dfdce819b6eac9a92350 (diff) | |
download | cpython-900ee3a07346ce12d5963ea531bf506daa1f5e46.zip cpython-900ee3a07346ce12d5963ea531bf506daa1f5e46.tar.gz cpython-900ee3a07346ce12d5963ea531bf506daa1f5e46.tar.bz2 |
Remove the user module.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_sundry.py | 4 | ||||
-rw-r--r-- | Lib/user.py | 45 |
2 files changed, 0 insertions, 49 deletions
diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py index ed46067..db7ed4e 100644 --- a/Lib/test/test_sundry.py +++ b/Lib/test/test_sundry.py @@ -77,10 +77,6 @@ class TestUntestedModules(unittest.TestCase): except ImportError: if test_support.verbose: print("skipping tty") - - # Can't test the "user" module -- if the user has a ~/.pythonrc.py, it - # can screw up all sorts of things (esp. if it prints!). - #import user import webbrowser import xml diff --git a/Lib/user.py b/Lib/user.py deleted file mode 100644 index 99efd2d..0000000 --- a/Lib/user.py +++ /dev/null @@ -1,45 +0,0 @@ -"""Hook to allow user-specified customization code to run. - -As a policy, Python doesn't run user-specified code on startup of -Python programs (interactive sessions execute the script specified in -the PYTHONSTARTUP environment variable if it exists). - -However, some programs or sites may find it convenient to allow users -to have a standard customization file, which gets run when a program -requests it. This module implements such a mechanism. A program -that wishes to use the mechanism must execute the statement - - import user - -The user module looks for a file .pythonrc.py in the user's home -directory and if it can be opened and read, exec()s it in its own global -namespace. Errors during this phase are not caught; that's up to the -program that imports the user module, if it wishes. - -The user's .pythonrc.py could conceivably test for sys.version if it -wishes to do different things depending on the Python version. - -""" - -import os - -home = os.curdir # Default -if 'HOME' in os.environ: - home = os.environ['HOME'] -elif os.name == 'posix': - home = os.path.expanduser("~/") -elif os.name == 'nt': # Contributed by Jeff Bauer - if 'HOMEPATH' in os.environ: - if 'HOMEDRIVE' in os.environ: - home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH'] - else: - home = os.environ['HOMEPATH'] - -pythonrc = os.path.join(home, ".pythonrc.py") -try: - f = open(pythonrc) -except IOError: - pass -else: - f.close() - exec(open(pythonrc).read()) |