aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg_resources.py8
-rwxr-xr-xsetuptools/sandbox.py5
2 files changed, 7 insertions, 6 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index 5aeafc9f..be8c6c57 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -22,6 +22,8 @@ import zipfile
import zipimport
import warnings
import stat
+import functools
+
try:
from urlparse import urlparse, urlunparse
except ImportError:
@@ -44,8 +46,6 @@ except NameError:
if locs is None:
locs = globs
exec(compile(open(fn).read(), fn, 'exec'), globs, locs)
- import functools
- reduce = functools.reduce
# capture these to bypass sandboxing
from os import utime
@@ -1178,11 +1178,11 @@ def evaluate_marker(text, extra=None, _ops={}):
def and_test(nodelist):
# MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
- return reduce(operator.and_, [interpret(nodelist[i]) for i in range(1,len(nodelist),2)])
+ return functools.reduce(operator.and_, [interpret(nodelist[i]) for i in range(1,len(nodelist),2)])
def test(nodelist):
# MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
- return reduce(operator.or_, [interpret(nodelist[i]) for i in range(1,len(nodelist),2)])
+ return functools.reduce(operator.or_, [interpret(nodelist[i]) for i in range(1,len(nodelist),2)])
def atom(nodelist):
t = nodelist[1][0]
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 29fc07b8..27914f2e 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -1,4 +1,5 @@
import os, sys, tempfile, operator, pkg_resources
+import functools
if os.name == "java":
import org.python.modules.posix.PosixModule as _os
else:
@@ -11,7 +12,7 @@ _open = open
from distutils.errors import DistutilsError
from pkg_resources import working_set
-from setuptools.compat import builtins, execfile, reduce
+from setuptools.compat import builtins, execfile
__all__ = [
"AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup",
@@ -276,7 +277,7 @@ class DirectorySandbox(AbstractSandbox):
self._violation("os.open", file, flags, mode, *args, **kw)
return _os.open(file,flags,mode, *args, **kw)
-WRITE_FLAGS = reduce(
+WRITE_FLAGS = functools.reduce(
operator.or_, [getattr(_os, a, 0) for a in
"O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()]
)