summaryrefslogtreecommitdiff
path: root/games-strategy/0ad/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-03-20 00:40:44 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-03-20 00:40:44 +0000
commit4cbcc855382a06088e2f016f62cafdbcb7e40665 (patch)
tree356496503d52354aa6d9f2d36126302fed5f3a73 /games-strategy/0ad/files
parentfcc5224904648a8e6eb528d7603154160a20022f (diff)
gentoo resync : 20.03.2022
Diffstat (limited to 'games-strategy/0ad/files')
-rw-r--r--games-strategy/0ad/files/0ad-0.0.24_alpha_pre20210116040036-build.patch105
-rw-r--r--games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch98
-rw-r--r--games-strategy/0ad/files/0ad-0.0.24b_alpha-rust-1.50.patch82
-rw-r--r--games-strategy/0ad/files/0ad-0.0.25b_alpha-fix-setuptools.patch188
4 files changed, 188 insertions, 285 deletions
diff --git a/games-strategy/0ad/files/0ad-0.0.24_alpha_pre20210116040036-build.patch b/games-strategy/0ad/files/0ad-0.0.24_alpha_pre20210116040036-build.patch
deleted file mode 100644
index 1e643adb41a9..000000000000
--- a/games-strategy/0ad/files/0ad-0.0.24_alpha_pre20210116040036-build.patch
+++ /dev/null
@@ -1,105 +0,0 @@
---- /build/premake/premake5/build/gmake2.bsd/Premake5.make
-+++ /build/premake/premake5/build/gmake2.bsd/Premake5.make
-@@ -36,19 +36,19 @@
- TARGET = $(TARGETDIR)/premake5
- OBJDIR = obj/Release/Premake5
- DEFINES += -DPREMAKE_COMPRESSION -DCURL_STATICLIB -DPREMAKE_CURL -DNDEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
--ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra
--ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra -fno-stack-protector
-+ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
-+ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra -fno-stack-protector
- LIBS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a bin/Release/libmbedtls-lib.a -lm
- LDDEPS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a bin/Release/libmbedtls-lib.a
--ALL_LDFLAGS += $(LDFLAGS) -s -rdynamic
-+ALL_LDFLAGS += $(LDFLAGS) -rdynamic
-
- else ifeq ($(config),debug)
- TARGETDIR = ../../bin/debug
- TARGET = $(TARGETDIR)/premake5
- OBJDIR = obj/Debug/Premake5
- DEFINES += -DPREMAKE_COMPRESSION -DCURL_STATICLIB -DPREMAKE_CURL -D_DEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
--ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra
--ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra
-+ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
-+ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
- LIBS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a bin/Debug/libmbedtls-lib.a -lm
- LDDEPS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a bin/Debug/libmbedtls-lib.a
- ALL_LDFLAGS += $(LDFLAGS) -rdynamic
---- /build/premake/premake5/build/gmake2.macosx/Premake5.make
-+++ /build/premake/premake5/build/gmake2.macosx/Premake5.make
-@@ -45,8 +45,8 @@
- TARGET = $(TARGETDIR)/premake5
- OBJDIR = obj/Release/Premake5
- DEFINES += -DPREMAKE_COMPRESSION -DCURL_STATICLIB -DPREMAKE_CURL -DNDEBUG -DLUA_USE_MACOSX
--ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra
--ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra -fno-stack-protector
-+ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
-+ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra -fno-stack-protector
- LIBS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a -framework CoreServices -framework Foundation -framework Security -lreadline
- LDDEPS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a
-
-@@ -55,8 +55,8 @@
- TARGET = $(TARGETDIR)/premake5
- OBJDIR = obj/Debug/Premake5
- DEFINES += -DPREMAKE_COMPRESSION -DCURL_STATICLIB -DPREMAKE_CURL -D_DEBUG -DLUA_USE_MACOSX
--ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra
--ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra
-+ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
-+ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
- LIBS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a -framework CoreServices -framework Foundation -framework Security -lreadline
- LDDEPS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a
-
---- /build/premake/premake5/build/gmake2.unix/Premake5.make
-+++ /build/premake/premake5/build/gmake2.unix/Premake5.make
-@@ -36,19 +36,19 @@
- TARGET = $(TARGETDIR)/premake5
- OBJDIR = obj/Release/Premake5
- DEFINES += -DPREMAKE_COMPRESSION -DCURL_STATICLIB -DPREMAKE_CURL -DNDEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
--ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra
--ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra -fno-stack-protector
-+ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
-+ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra -fno-stack-protector
- LIBS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a bin/Release/libmbedtls-lib.a -lm -ldl -lrt
- LDDEPS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a bin/Release/libmbedtls-lib.a
--ALL_LDFLAGS += $(LDFLAGS) -s -rdynamic
-+ALL_LDFLAGS += $(LDFLAGS) -rdynamic
-
- else ifeq ($(config),debug)
- TARGETDIR = ../../bin/debug
- TARGET = $(TARGETDIR)/premake5
- OBJDIR = obj/Debug/Premake5
- DEFINES += -DPREMAKE_COMPRESSION -DCURL_STATICLIB -DPREMAKE_CURL -D_DEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
--ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra
--ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra
-+ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
-+ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wall -Wextra
- LIBS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a bin/Debug/libmbedtls-lib.a -lm -ldl -lrt
- LDDEPS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a bin/Debug/libmbedtls-lib.a
- ALL_LDFLAGS += $(LDFLAGS) -rdynamic
---- /build/premake/premake5/src/tools/gcc.lua
-+++ /build/premake/premake5/src/tools/gcc.lua
-@@ -346,8 +346,7 @@
- --
-
- function gcc.ldsymbols(cfg)
-- -- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html
-- return iif(table.contains(os.getSystemTags(cfg.system), "darwin"), "-Wl,-x", "-s")
-+ return ""
- end
-
- gcc.ldflags = {
---- /libraries/source/fcollada/src/Makefile
-+++ /libraries/source/fcollada/src/Makefile
-@@ -9,9 +9,9 @@
-
- CXX ?= g++
- CXXFLAGS += -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function $(OS_DEFINE) $(PIC_FLAGS) $(CPPFLAGS)
--CXXFLAGS_DEBUG := -O0 -g -D_DEBUG -DRETAIL
--CXXFLAGS_RELEASE := -O2 -DNDEBUG -DRETAIL
--CXXFLAGS_TEST := -O0 -g -D_DEBUG
-+CXXFLAGS_DEBUG := -D_DEBUG -DRETAIL
-+CXXFLAGS_RELEASE := -DNDEBUG -DRETAIL
-+CXXFLAGS_TEST := -D_DEBUG
- LDFLAGS_TEST= -ldl
- LIBS += `pkg-config libxml-2.0 --libs`
- INCLUDES += -IFCollada `pkg-config libxml-2.0 --cflags`
diff --git a/games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch b/games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch
deleted file mode 100644
index fe054eccac51..000000000000
--- a/games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-# Nils Freydank <holgersson@posteo.de> (2021-06-17)
-Apply the patch from upstream with minor adoption.
-
-Gentoo bug: https://bugs.gentoo.org/779757
-Upstream Bug: https://trac.wildfiregames.com/ticket/6107
-Upstream Patch: https://trac.wildfiregames.com/changeset/25766
-
---- a/source/graphics/TextureConverter.cpp (revision 25765)
-+++ b/source/graphics/TextureConverter.cpp (revision 25766)
-@@ -294,9 +294,8 @@
- m_VFS(vfs), m_HighQuality(highQuality), m_Shutdown(false)
- {
-+#if CONFIG2_NVTT
- // Verify that we are running with at least the version we were compiled with,
- // to avoid bugs caused by ABI changes
--#if CONFIG2_NVTT
- ENSURE(nvtt::version() >= NVTT_VERSION);
--#endif
-
- m_WorkerThread = std::thread(Threading::HandleExceptions<RunThread>::Wrapper, this);
-@@ -304,8 +303,10 @@
- // Maybe we should share some centralised pool of worker threads?
- // For now we'll just stick with a single thread for this specific use.
-+#endif // CONFIG2_NVTT
- }
-
- CTextureConverter::~CTextureConverter()
- {
-+#if CONFIG2_NVTT
- // Tell the thread to shut down
- {
-@@ -327,4 +328,5 @@
- // Wait for it to shut down cleanly
- m_WorkerThread.join();
-+#endif // CONFIG2_NVTT
- }
-
-@@ -477,8 +479,8 @@
- return true;
-
--#else
-+#else // CONFIG2_NVTT
- LOGERROR("Failed to convert texture \"%s\" (NVTT not available)", src.string8());
- return false;
--#endif
-+#endif // !CONFIG2_NVTT
- }
-
-@@ -529,22 +531,24 @@
- return true;
-
--#else // #if CONFIG2_NVTT
-+#else // CONFIG2_NVTT
- return false;
--#endif
-+#endif // !CONFIG2_NVTT
- }
-
- bool CTextureConverter::IsBusy()
- {
-+#if CONFIG2_NVTT
- std::lock_guard<std::mutex> lock(m_WorkerMutex);
- return !m_RequestQueue.empty();
-+#else // CONFIG2_NVTT
-+ return false;
-+#endif // !CONFIG2_NVTT
- }
-
- void CTextureConverter::RunThread(CTextureConverter* textureConverter)
- {
-+#if CONFIG2_NVTT
- debug_SetThreadName("TextureConverter");
- g_Profiler2.RegisterCurrentThread("texconv");
--
--#if CONFIG2_NVTT
--
- // Wait until the main thread wakes us up
- while (true)
-@@ -596,4 +600,4 @@
- std::lock_guard<std::mutex> wait_lock(textureConverter->m_WorkerMutex);
- textureConverter->m_Shutdown = false;
--#endif
--}
-+#endif // CONFIG2_NVTT
-+}
-
---- a/source/graphics/TextureConverter.h (revision 25765)
-+++ b/source/graphics/TextureConverter.h (revision 25766)
-@@ -208,7 +208,9 @@
- bool m_HighQuality;
-
-+#if CONFIG2_NVTT
- std::thread m_WorkerThread;
- std::mutex m_WorkerMutex;
- std::condition_variable m_WorkerCV;
-+#endif // CONFIG2_NVTT
-
- struct ConversionRequest;
diff --git a/games-strategy/0ad/files/0ad-0.0.24b_alpha-rust-1.50.patch b/games-strategy/0ad/files/0ad-0.0.24b_alpha-rust-1.50.patch
deleted file mode 100644
index f4436a7b92c4..000000000000
--- a/games-strategy/0ad/files/0ad-0.0.24b_alpha-rust-1.50.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-https://bugs.gentoo.org/773493
---- a/libraries/source/spidermonkey/FixRust150.diff
-+++ b/libraries/source/spidermonkey/FixRust150.diff
-@@ -0,0 +1,65 @@
-+
-+# HG changeset patch
-+# User Emilio Cobos Álvarez <emilio@crisal.io>
-+# Date 1609006565 0
-+# Node ID 0e8f444683cb9c4079d3b2250f32f986043ea582
-+# Parent 55097a5cf353f1b2a2228820bdf26bb69a1372a0
-+Bug 1684261 - Fix build with rust nightly. r=jrmuizel, a=RyanVM
-+
-+Fixes errors like:
-+
-+ dependency (nix) specification is ambiguous. Only one of `branch`, `tag` or `rev` is allowed.
-+
-+I've left the most specific dependency, but for wgpu the rev is not
-+right, so I've kept the branch which effectively preserves behavior.
-+
-+Differential Revision: https://phabricator.services.mozilla.com/D100485
-+
-+diff --git a/.cargo/config.in b/.cargo/config.in
-+--- a/.cargo/config.in
-++++ b/.cargo/config.in
-+@@ -1,16 +1,16 @@
-+ # This file contains vendoring instructions for cargo.
-+ # It was generated by `mach vendor rust`.
-+ # Please do not edit.
-+
-+ [source."https://github.com/shravanrn/nix/"]
-+-branch = "r0.13.1"
-+ git = "https://github.com/shravanrn/nix/"
-+ replace-with = "vendored-sources"
-++rev = "4af6c367603869a30fddb5ffb0aba2b9477ba92e"
-+
-+ [source."https://github.com/mozilla/rkv"]
-+ git = "https://github.com/mozilla/rkv"
-+ replace-with = "vendored-sources"
-+ rev = "e3c3388e6632cf55e08d773b32e58b1cab9b2731"
-+
-+ [source."https://github.com/mozilla/neqo"]
-+ git = "https://github.com/mozilla/neqo"
-+diff --git a/Cargo.lock b/Cargo.lock
-+--- a/Cargo.lock
-++++ b/Cargo.lock
-+@@ -3200,7 +3200,7 @@
-+ [[package]]
-+ name = "nix"
-+ version = "0.13.1"
-+-source = "git+https://github.com/shravanrn/nix/?branch=r0.13.1#4af6c367603869a30fddb5ffb0aba2b9477ba92e"
-++source = "git+https://github.com/shravanrn/nix/?rev=4af6c367603869a30fddb5ffb0aba2b9477ba92e#4af6c367603869a30fddb5ffb0aba2b9477ba92e"
-+ dependencies = [
-+ "bitflags",
-+ "cc",
-+diff --git a/Cargo.toml b/Cargo.toml
-+--- a/Cargo.toml
-++++ b/Cargo.toml
-+@@ -60,8 +60,8 @@
-+ [patch.crates-io]
-+ packed_simd = { git = "https://github.com/hsivonen/packed_simd", rev="3541e3818fdc7c2a24f87e3459151a4ce955a67a" }
-+ rlbox_lucet_sandbox = { git = "https://github.com/PLSysSec/rlbox_lucet_sandbox/", rev="d510da5999a744c563b0acd18056069d1698273f" }
-+-nix = { git = "https://github.com/shravanrn/nix/", branch = "r0.13.1", rev="4af6c367603869a30fddb5ffb0aba2b9477ba92e" }
-+-spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu3", rev = "20191ad2f370afd6d247edcb9ff9da32d3bedb9c" }
-++nix = { git = "https://github.com/shravanrn/nix/", rev="4af6c367603869a30fddb5ffb0aba2b9477ba92e" }
-++spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu3" }
-+ # failure's backtrace feature might break our builds, see bug 1608157.
-+ failure = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }
-+ failure_derive = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }
-+
---- a/libraries/source/spidermonkey/patch.sh
-+++ b/libraries/source/spidermonkey/patch.sh
-@@ -39,6 +39,10 @@
- # https://bugzilla.mozilla.org/show_bug.cgi?id=1536491
- patch -p1 < ../FixRpiUnalignedFpAccess.diff
-
-+# Bug 1684261 upstreamed from 78.8: https://hg.mozilla.org/releases/mozilla-esr78/rev/0e8f444683cb
-+# Note that this isn't quite the upstream patch to match our version.
-+patch -p1 < ../FixRust150.diff
-+
- # Patch those separately, as they might interfere with normal behaviour.
- if [ "$(uname -s)" = "FreeBSD" ];
- then
diff --git a/games-strategy/0ad/files/0ad-0.0.25b_alpha-fix-setuptools.patch b/games-strategy/0ad/files/0ad-0.0.25b_alpha-fix-setuptools.patch
new file mode 100644
index 000000000000..ea0626fadadd
--- /dev/null
+++ b/games-strategy/0ad/files/0ad-0.0.25b_alpha-fix-setuptools.patch
@@ -0,0 +1,188 @@
+https://bugs.gentoo.org/826762
+https://bugzilla.mozilla.org/show_bug.cgi?id=1665675
+https://phabricator.services.mozilla.com/D90627
+--- a/libraries/source/spidermonkey/patch.sh
++++ b/libraries/source/spidermonkey/patch.sh
+@@ -51,5 +51,7 @@ then
+ # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-third__party_rust_cc_.cargo-checksum.json?view=log
+ patch -p1 < ../FixFreeBSDCargoChecksum.diff
+ # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-third__party_rust_cc_src_lib.rs?view=log
+ patch -p1 < ../FixFreeBSDRustThirdPartyOSDetection.diff
+ fi
++
++patch -p1 < ../FixSysconfigImport.diff
+--- a/libraries/source/spidermonkey/FixSysconfigImport.diff
++++ b/libraries/source/spidermonkey/FixSysconfigImport.diff
+@@ -0,0 +1,171 @@
++diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py
++--- a/python/mozbuild/mozbuild/configure/__init__.py
+++++ b/python/mozbuild/mozbuild/configure/__init__.py
++@@ -877,17 +877,56 @@
++
++ def _apply_imports(self, func, glob):
++ for _from, _import, _as in self._imports.pop(func, ()):
++- _from = '%s.' % _from if _from else ''
++- if _as:
++- glob[_as] = self._get_one_import('%s%s' % (_from, _import))
+++ self._get_one_import(_from, _import, _as, glob)
+++
+++ def _handle_wrapped_import(self, _from, _import, _as, glob):
+++ """Given the name of a module, "import" a mocked package into the glob
+++ iff the module is one that we wrap (either for the sandbox or for the
+++ purpose of testing). Applies if the wrapped module is exposed by an
+++ attribute of `self`.
+++
+++ For example, if the import statement is `from os import environ`, then
+++ this function will set
+++ glob['environ'] = self._wrapped_os.environ.
+++
+++ Iff this function handles the given import, return True.
+++ """
+++ module = (_from or _import).split('.')[0]
+++ attr = '_wrapped_' + module
+++ wrapped = getattr(self, attr, None)
+++ if wrapped:
+++ if _as or _from:
+++ obj = self._recursively_get_property(
+++ module, (_from + '.' if _from else '') + _import, wrapped)
+++ glob[_as or _import] = obj
++ else:
++- what = _import.split('.')[0]
++- glob[what] = self._get_one_import('%s%s' % (_from, what))
+++ glob[module] = wrapped
+++ return True
+++ else:
+++ return False
+++
+++ def _recursively_get_property(self, module, what, wrapped):
+++ """Traverse the wrapper object `wrapped` (which represents the module
+++ `module`) and return the property represented by `what`, which may be a
+++ series of nested attributes.
+++
+++ For example, if `module` is 'os' and `what` is 'os.path.join',
+++ return `wrapped.path.join`.
+++ """
+++ if what == module:
+++ return wrapped
+++ assert what.startswith(module + '.')
+++ attrs = what[len(module + '.'):].split('.')
+++ for attr in attrs:
+++ wrapped = getattr(wrapped, attr)
+++ return wrapped
++
++ @memoized_property
++ def _wrapped_os(self):
++ wrapped_os = {}
++ exec_('from os import *', {}, wrapped_os)
+++ # Special case os and os.environ so that os.environ is our copy of
+++ # the environment.
++ wrapped_os['environ'] = self._environ
++ return ReadOnlyNamespace(**wrapped_os)
++
++@@ -913,57 +952,62 @@
++
++ return ReadOnlyNamespace(**wrapped_subprocess)
++
++- def _get_one_import(self, what):
++- # The special `__sandbox__` module gives access to the sandbox
++- # instance.
++- if what == '__sandbox__':
++- return self
+++ @memoized_property
+++ def _wrapped_six(self):
+++ if six.PY3:
+++ return six
+++ wrapped_six = {}
+++ exec_('from six import *', {}, wrapped_six)
+++ wrapped_six_moves = {}
+++ exec_('from six.moves import *', {}, wrapped_six_moves)
+++ wrapped_six_moves_builtins = {}
+++ exec_('from six.moves.builtins import *', {},
+++ wrapped_six_moves_builtins)
+++
++ # Special case for the open() builtin, because otherwise, using it
++ # fails with "IOError: file() constructor not accessible in
++ # restricted mode". We also make open() look more like python 3's,
++ # decoding to unicode strings unless the mode says otherwise.
++- if what == '__builtin__.open' or what == 'builtins.open':
++- if six.PY3:
++- return open
+++ def wrapped_open(name, mode=None, buffering=None):
+++ args = (name,)
+++ kwargs = {}
+++ if buffering is not None:
+++ kwargs['buffering'] = buffering
+++ if mode is not None:
+++ args += (mode,)
+++ if 'b' in mode:
+++ return open(*args, **kwargs)
+++ kwargs['encoding'] = system_encoding
+++ return codecs.open(*args, **kwargs)
+++
+++ wrapped_six_moves_builtins['open'] = wrapped_open
+++ wrapped_six_moves['builtins'] = ReadOnlyNamespace(
+++ **wrapped_six_moves_builtins)
+++ wrapped_six['moves'] = ReadOnlyNamespace(**wrapped_six_moves)
++
++- def wrapped_open(name, mode=None, buffering=None):
++- args = (name,)
++- kwargs = {}
++- if buffering is not None:
++- kwargs['buffering'] = buffering
++- if mode is not None:
++- args += (mode,)
++- if 'b' in mode:
++- return open(*args, **kwargs)
++- kwargs['encoding'] = system_encoding
++- return codecs.open(*args, **kwargs)
++- return wrapped_open
++- # Special case os and os.environ so that os.environ is our copy of
++- # the environment.
++- if what == 'os.environ':
++- return self._environ
++- if what == 'os':
++- return self._wrapped_os
++- # And subprocess, so that its functions use our os.environ
++- if what == 'subprocess':
++- return self._wrapped_subprocess
++- if what in ('subprocess.call', 'subprocess.check_call',
++- 'subprocess.check_output', 'subprocess.Popen'):
++- return getattr(self._wrapped_subprocess, what[len('subprocess.'):])
+++ return ReadOnlyNamespace(**wrapped_six)
+++
+++ def _get_one_import(self, _from, _import, _as, glob):
+++ """Perform the given import, placing the result into the dict glob."""
+++ if not _from and _import == '__builtin__':
+++ glob[_as or '__builtin__'] = __builtin__
+++ return
+++ if _from == '__builtin__':
+++ _from = 'six.moves.builtins'
+++ # The special `__sandbox__` module gives access to the sandbox
+++ # instance.
+++ if not _from and _import == '__sandbox__':
+++ glob[_as or _import] = self
+++ return
+++ if self._handle_wrapped_import(_from, _import, _as, glob):
+++ return
+++ # If we've gotten this far, we should just do a normal import.
++ # Until this proves to be a performance problem, just construct an
++ # import statement and execute it.
++- import_line = ''
++- if '.' in what:
++- _from, what = what.rsplit('.', 1)
++- if _from == '__builtin__' or _from.startswith('__builtin__.'):
++- _from = _from.replace('__builtin__', 'six.moves.builtins')
++- import_line += 'from %s ' % _from
++- if what == '__builtin__':
++- what = 'six.moves.builtins'
++- import_line += 'import %s as imported' % what
++- glob = {}
+++ import_line = '%simport %s%s' % (
+++ ('from %s ' % _from) if _from else '', _import,
+++ (' as %s' % _as) if _as else '')
++ exec_(import_line, {}, glob)
++- return glob['imported']
++
++ def _resolve_and_set(self, data, name, value, when=None):
++ # Don't set anything when --help was on the command line
+