[pypy-commit] pypy stdlib-2.7.4: Made import site work. Also cleaned up some code that predated sets
alex_gaynor
noreply at buildbot.pypy.org
Mon Aug 19 00:37:50 CEST 2013
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: stdlib-2.7.4
Changeset: r66199:679f3facaae0
Date: 2013-08-18 15:37 -0700
http://bitbucket.org/pypy/pypy/changeset/679f3facaae0/
Log: Made import site work. Also cleaned up some code that predated sets
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -13,68 +13,67 @@
and p.join('__init__.py').check()
and not p.basename.startswith('test')]
-essential_modules = dict.fromkeys(
- ["exceptions", "_file", "sys", "__builtin__", "posix", "_warnings"]
-)
+essential_modules = set([
+ "exceptions", "_file", "sys", "__builtin__", "posix", "_warnings",
+ "itertools"
+])
default_modules = essential_modules.copy()
-default_modules.update(dict.fromkeys(
- ["_codecs", "gc", "_weakref", "marshal", "errno", "imp",
- "math", "cmath", "_sre", "_pickle_support", "operator",
- "parser", "symbol", "token", "_ast", "_io", "_random", "__pypy__",
- "_testing"]))
+default_modules.update([
+ "_codecs", "gc", "_weakref", "marshal", "errno", "imp", "math", "cmath",
+ "_sre", "_pickle_support", "operator", "parser", "symbol", "token", "_ast",
+ "_io", "_random", "__pypy__", "_testing"
+])
# --allworkingmodules
working_modules = default_modules.copy()
-working_modules.update(dict.fromkeys(
- ["_socket", "unicodedata", "mmap", "fcntl", "_locale", "pwd",
- "rctime" , "select", "zipimport", "_lsprof",
- "crypt", "signal", "_rawffi", "termios", "zlib", "bz2",
- "struct", "_hashlib", "_md5", "_sha", "_minimal_curses", "cStringIO",
- "thread", "itertools", "pyexpat", "_ssl", "cpyext", "array",
- "binascii", "_multiprocessing", '_warnings',
- "_collections", "_multibytecodec", "micronumpy", "_ffi",
- "_continuation", "_cffi_backend", "_csv", "cppyy", "_pypyjson"]
-))
+working_modules.update([
+ "_socket", "unicodedata", "mmap", "fcntl", "_locale", "pwd", "rctime" ,
+ "select", "zipimport", "_lsprof", "crypt", "signal", "_rawffi", "termios",
+ "zlib", "bz2", "struct", "_hashlib", "_md5", "_sha", "_minimal_curses",
+ "cStringIO", "thread", "itertools", "pyexpat", "_ssl", "cpyext", "array",
+ "binascii", "_multiprocessing", '_warnings', "_collections",
+ "_multibytecodec", "micronumpy", "_ffi", "_continuation", "_cffi_backend",
+ "_csv", "cppyy", "_pypyjson"
+])
translation_modules = default_modules.copy()
-translation_modules.update(dict.fromkeys(
- ["fcntl", "rctime", "select", "signal", "_rawffi", "zlib",
- "struct", "_md5", "cStringIO", "array", "_ffi",
- "binascii",
- # the following are needed for pyrepl (and hence for the
- # interactive prompt/pdb)
- "termios", "_minimal_curses",
- ]))
+translation_modules.update([
+ "fcntl", "rctime", "select", "signal", "_rawffi", "zlib", "struct", "_md5",
+ "cStringIO", "array", "_ffi", "binascii",
+ # the following are needed for pyrepl (and hence for the
+ # interactive prompt/pdb)
+ "termios", "_minimal_curses",
+])
# XXX this should move somewhere else, maybe to platform ("is this posixish"
# check or something)
if sys.platform == "win32":
- working_modules["_winreg"] = None
+ working_modules.add("_winreg")
# unix only modules
- del working_modules["crypt"]
- del working_modules["fcntl"]
- del working_modules["pwd"]
- del working_modules["termios"]
- del working_modules["_minimal_curses"]
+ working_modules.remove("crypt")
+ working_modules.remove("fcntl")
+ working_modules.remove("pwd")
+ working_modules.remove("termios")
+ working_modules.remove("_minimal_curses")
if "cppyy" in working_modules:
- del working_modules["cppyy"] # not tested on win32
+ working_modules.remove("cppyy") # not tested on win32
# The _locale module is needed by site.py on Windows
- default_modules["_locale"] = None
+ default_modules.add("_locale")
if sys.platform == "sunos5":
- del working_modules['mmap'] # depend on ctypes, can't get at c-level 'errono'
- del working_modules['rctime'] # depend on ctypes, missing tm_zone/tm_gmtoff
- del working_modules['signal'] # depend on ctypes, can't get at c-level 'errono'
- del working_modules['fcntl'] # LOCK_NB not defined
- del working_modules["_minimal_curses"]
- del working_modules["termios"]
- del working_modules["_multiprocessing"] # depends on rctime
+ working_modules.remove('mmap') # depend on ctypes, can't get at c-level 'errono'
+ working_modules.remove('rctime') # depend on ctypes, missing tm_zone/tm_gmtoff
+ working_modules.remove('signal') # depend on ctypes, can't get at c-level 'errono'
+ working_modules.remove('fcntl') # LOCK_NB not defined
+ working_modules.remove("_minimal_curses")
+ working_modules.remove("termios")
+ working_modules.remove("_multiprocessing") # depends on rctime
if "cppyy" in working_modules:
- del working_modules["cppyy"] # depends on ctypes
+ working_modules.remove("cppyy") # depends on ctypes
module_dependencies = {
@@ -300,11 +299,6 @@
"""Apply PyPy-specific optimization suggestions on the 'config'.
The optimizations depend on the selected level and possibly on the backend.
"""
- # warning: during some tests, the type_system and the backend may be
- # unspecified and we get None. It shouldn't occur in translate.py though.
- type_system = config.translation.type_system
- backend = config.translation.backend
-
# all the good optimizations for PyPy should be listed here
if level in ['2', '3', 'jit']:
config.objspace.opcodes.suggest(CALL_METHOD=True)
More information about the pypy-commit
mailing list