diff options
author | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-10-28 21:35:59 (GMT) |
---|---|---|
committer | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-10-28 21:35:59 (GMT) |
commit | 8e627eb7aec9e58d7128a571aa201830da140825 (patch) | |
tree | a08a2a013a20ce69c57779403426675bd31f4bff /testing | |
parent | 55849419b8a1365d5918386c085be55bc9cddd3a (diff) | |
parent | de084c80eb08f44ff55ea15eba275fda7d1382c7 (diff) | |
download | SCons-8e627eb7aec9e58d7128a571aa201830da140825.zip SCons-8e627eb7aec9e58d7128a571aa201830da140825.tar.gz SCons-8e627eb7aec9e58d7128a571aa201830da140825.tar.bz2 |
Merge branch 'master' into jbrill-msvs-tests
Manually resolve conflicts in CHANGES.txt.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/framework/TestCmd.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index cada7be..243745d 100644 --- a/testing/framework/TestCmd.py +++ b/testing/framework/TestCmd.py @@ -329,6 +329,10 @@ IS_WINDOWS = sys.platform == 'win32' IS_MACOS = sys.platform == 'darwin' IS_64_BIT = sys.maxsize > 2**32 IS_PYPY = hasattr(sys, 'pypy_translation_info') +try: + IS_ROOT = os.geteuid() == 0 +except AttributeError: + IS_ROOT = False NEED_HELPER = os.environ.get('SCONS_NO_DIRECT_SCRIPT') # sentinel for cases where None won't do @@ -2003,11 +2007,15 @@ class TestCmd: do_chmod(os.path.join(dirpath, name)) do_chmod(top) - def writable(self, top, write: bool=True) -> None: + def writable(self, top, write: bool = True) -> None: """Make the specified directory tree writable or unwritable. Tree is made writable if `write` evaluates True (the default), else it is made not writable. + + Note on Windows the only thing we can do is and/remove the + "readable" setting without resorting to PyWin32 - and that, + only as Administrator, so this is kind of pointless there. """ if sys.platform == 'win32': @@ -2034,7 +2042,7 @@ class TestCmd: except OSError: pass else: - os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE] | 0o200)) + os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE] | stat.S_IWRITE)) else: def do_chmod(fname) -> None: try: @@ -2043,7 +2051,7 @@ class TestCmd: pass else: os.chmod(fname, stat.S_IMODE( - st[stat.ST_MODE] & ~0o200)) + st[stat.ST_MODE] & ~stat.S_IWRITE)) if os.path.isfile(top): do_chmod(top) |