diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2019-12-29 15:50:38 +0100 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2019-12-29 15:50:38 +0100 | 
| commit | c7ed3af5765539e212ecd5f93bd7ea5f9785bc25 (patch) | |
| tree | 586ea369a93cb817c45c47dc2609ab58648f94ab /src/engine/SCons/SConfTests.py | |
| parent | c7665433b2004d2b404d6fb9d6fd064998486f63 (diff) | |
| parent | e2cfc8f485631bfd5f61d4af1921c7346a062875 (diff) | |
Merge branch 'release/debian/3.1.2+repack-1'debian/3.1.2+repack-1
Diffstat (limited to 'src/engine/SCons/SConfTests.py')
| -rw-r--r-- | src/engine/SCons/SConfTests.py | 30 | 
1 files changed, 13 insertions, 17 deletions
diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index bfa4871..a05eec4 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -21,7 +21,7 @@  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  # -__revision__ = "src/engine/SCons/SConfTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan" +__revision__ = "src/engine/SCons/SConfTests.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"  import SCons.compat @@ -56,6 +56,18 @@ class SConfTestCase(unittest.TestCase):          os.chdir(self.save_cwd)      def _resetSConfState(self): +        if sys.platform in ['cygwin', 'win32'] and sys.version_info.major == 2: +            # On Windows with Python2, SCons.Platform.win32 redefines the +            # built-in file() and open() functions to disable handle +            # inheritance. Because we are unloading all SCons modules other +            # than SCons.Compat, SCons.Platform.win32 will lose the variables +            # it needs. As a result, we should reset the file() and open() +            # functions to their original built-in versions. +            import __builtin__ +            import SCons.Platform.win32 +            __builtin__.file = SCons.Platform.win32._builtin_file +            __builtin__.open = SCons.Platform.win32._builtin_open +          # Ok, this is tricky, and i do not know, if everything is sane.          # We try to reset scons' state (including all global variables)          import SCons.SConsign @@ -90,22 +102,6 @@ class SConfTestCase(unittest.TestCase):              global existing_lib              existing_lib = 'm' -        if sys.platform in ['cygwin', 'win32']: -             # On Windows, SCons.Platform.win32 redefines the builtin -             # file() and open() functions to close the file handles. -             # This interferes with the unittest.py infrastructure in -             # some way.  Just sidestep the issue by restoring the -             # original builtin functions whenever we have to reset -             # all of our global state. - -             import SCons.Platform.win32 - -             try: -                file = SCons.Platform.win32._builtin_file -                open = SCons.Platform.win32._builtin_open -             except AttributeError: -                 pass -      def _baseTryXXX(self, TryFunc):          # TryCompile and TryLink are much the same, so we can test them          # in one method, we pass the function as a string ('TryCompile',  | 
