[PATCH 3 of 8] import-checker: add socket for virtualenv
timeless
timeless at mozdev.org
Wed Mar 30 05:24:03 EDT 2016
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1459325194 0
# Wed Mar 30 08:06:34 2016 +0000
# Node ID b051243155761ace5b23e98f8dd7a1b527ed1077
# Parent 044a54c5a3b80596f4c0c3625905248b7557691a
import-checker: add socket for virtualenv
zlib and BaseHTTPServer were within the virtualenv, but
socket and ctypes were in global space...
Adding socket seems to be enough to satisfy my virtualenv
diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -5,6 +5,7 @@
import ast
import collections
import os
+import socket
import sys
# Import a minimal set of stdlib modules needed for list_stdlib_modules()
@@ -158,6 +159,9 @@
>>> 'BaseHTTPServer' in mods
True
+ >>> 'socket' in mods
+ True
+
os.path isn't really a module, so it's missing:
>>> 'os.path' in mods
@@ -177,6 +181,7 @@
"""
for m in sys.builtin_module_names:
yield m
+ modules = [socket, zlib]
# These modules only exist on windows, but we should always
# consider them stdlib.
for m in ['msvcrt', '_winreg']:
@@ -187,7 +192,7 @@
stdlib_prefixes = set([sys.prefix, sys.exec_prefix])
# We need to supplement the list of prefixes for the search to work
# when run from within a virtualenv.
- for mod in (BaseHTTPServer, zlib):
+ for mod in (modules):
try:
# Not all module objects have a __file__ attribute.
filename = mod.__file__
More information about the Mercurial-devel
mailing list