summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2016-03-01 08:45:42 (GMT)
committerRussel Winder <russel@winder.org.uk>2016-03-01 08:45:42 (GMT)
commit14924bcc1713c5bd7dcf4db5b420204407048889 (patch)
treea679d247d04daf78f0a58ee0bb05afa04488704a /src
parent193c96046004369ba13fb9b4fc0e992513cc8f78 (diff)
parent3791dc82915d61f0b9eee4738fc090c8a23b162c (diff)
downloadSCons-14924bcc1713c5bd7dcf4db5b420204407048889.zip
SCons-14924bcc1713c5bd7dcf4db5b420204407048889.tar.gz
SCons-14924bcc1713c5bd7dcf4db5b420204407048889.tar.bz2
Resolved conflicting merge.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt16
-rw-r--r--src/engine/SCons/Defaults.py64
-rw-r--r--src/engine/SCons/Platform/PlatformTests.py20
-rw-r--r--src/engine/SCons/Platform/posix.py6
4 files changed, 100 insertions, 6 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 93bf387..7e1e9fe 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -16,8 +16,20 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
From William Blevins:
- Added support for cross-language dependency scanning;
SCons now respects scanner keys for implicit dependencies.
+ - Notes for SCons users with heterogeneous systems.
+ - May find new (previously missed) dependencies.
+ - May cause rebuild after upgrade due to dependency changes.
+ - May find new dependency errors (EG. cycles).
+ - Discovered in some of the SCons QT tests.
- Resolved missing cross-language dependencies for
SWIG bindings (fixes #2264).
+ - Corrected typo in User Guide for Scanner keyword. (PR #2959)
+ - Install builder interacts with scanner found in SCANNERS differently.
+ - Previous: Install builder recursively scanned implicit dependencies
+ for scanners from SCANNER, but not for built-in (default) scanners.
+ - Current: Install builder will not scan for implicit dependencies via
+ either scanner source. This optimizes some Install builder behavior
+ and brings orthogonality to Install builder scanning behavior.
From William Deegan:
- Add better messaging when two environments have
@@ -25,11 +37,15 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Fix issue only with MSVC and Always build where targets
marked AlwaysBuild wouldn't make it into CHANGED_SOURCES
and thus yield an empty compile command line. (Bug #2622)
+ - Fix posix platform escaping logic to properly handle paths
+ with parens in them "()". (Bug #2225)
From Jakub Pola:
- Intel Compiler 2016 (Linux/Mac) update for tool directories.
+ From Adarsh Sanjeev:
+ - Fix for issue #2494: Added string support for Chmod function.
RELEASE 2.4.1 - Mon, 07 Nov 2015 10:37:21 -0700
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index e26a5c0..b198a24 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -169,15 +169,73 @@ def get_paths_str(dest):
else:
return '"' + str(dest) + '"'
+permission_dic = {
+ 'u':{
+ 'r':stat.S_IRUSR,
+ 'w':stat.S_IWUSR,
+ 'x':stat.S_IXUSR
+ },
+ 'g':{
+ 'r':stat.S_IRGRP,
+ 'w':stat.S_IWGRP,
+ 'x':stat.S_IXGRP
+ },
+ 'o':{
+ 'r':stat.S_IROTH,
+ 'w':stat.S_IWOTH,
+ 'x':stat.S_IXOTH
+ }
+}
+
def chmod_func(dest, mode):
+ import SCons.Util
+ from string import digits
SCons.Node.FS.invalidate_node_memos(dest)
if not SCons.Util.is_List(dest):
dest = [dest]
- for element in dest:
- os.chmod(str(element), mode)
+ if SCons.Util.is_String(mode) and not 0 in [i in digits for i in mode]:
+ mode = int(mode, 8)
+ if not SCons.Util.is_String(mode):
+ for element in dest:
+ os.chmod(str(element), mode)
+ else:
+ mode = str(mode)
+ for operation in mode.split(","):
+ if "=" in operation:
+ operator = "="
+ elif "+" in operation:
+ operator = "+"
+ elif "-" in operation:
+ operator = "-"
+ else:
+ raise SyntaxError("Could not find +, - or =")
+ operation_list = operation.split(operator)
+ if len(operation_list) is not 2:
+ raise SyntaxError("More than one operator found")
+ user = operation_list[0].strip().replace("a", "ugo")
+ permission = operation_list[1].strip()
+ new_perm = 0
+ for u in user:
+ for p in permission:
+ try:
+ new_perm = new_perm | permission_dic[u][p]
+ except KeyError:
+ raise SyntaxError("Unrecognized user or permission format")
+ for element in dest:
+ curr_perm = os.stat(str(element)).st_mode
+ if operator == "=":
+ os.chmod(str(element), new_perm)
+ elif operator == "+":
+ os.chmod(str(element), curr_perm | new_perm)
+ elif operator == "-":
+ os.chmod(str(element), curr_perm & ~new_perm)
def chmod_strfunc(dest, mode):
- return 'Chmod(%s, 0%o)' % (get_paths_str(dest), mode)
+ import SCons.Util
+ if not SCons.Util.is_String(mode):
+ return 'Chmod(%s, 0%o)' % (get_paths_str(dest), mode)
+ else:
+ return 'Chmod(%s, "%s")' % (get_paths_str(dest), str(mode))
Chmod = ActionFactory(chmod_func, chmod_strfunc)
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py
index 38ea55a..3432e94 100644
--- a/src/engine/SCons/Platform/PlatformTests.py
+++ b/src/engine/SCons/Platform/PlatformTests.py
@@ -187,11 +187,29 @@ class TempFileMungeTestCase(unittest.TestCase):
assert cmd != defined_cmd, cmd
assert cmd == getattr(target[0].attributes, 'tempfile_cmdlist', None)
+class PlatformEscapeTestCase(unittest.TestCase):
+ def test_posix_escape(self):
+ """ Check that paths with parens are escaped properly
+ """
+ import SCons.Platform.posix
+
+ test_string = "/my (really) great code/main.cpp"
+ output = SCons.Platform.posix.escape(test_string)
+
+ # We expect the escape function to wrap the string
+ # in quotes, but not escape any internal characters
+ # in the test_string. (Parens doesn't require shell
+ # escaping if their quoted)
+ assert output[1:-1] == test_string
+
+
if __name__ == "__main__":
suite = unittest.TestSuite()
tclasses = [ PlatformTestCase,
- TempFileMungeTestCase ]
+ TempFileMungeTestCase,
+ PlatformEscapeTestCase,
+ ]
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py
index 7e69a7c..190a2a6 100644
--- a/src/engine/SCons/Platform/posix.py
+++ b/src/engine/SCons/Platform/posix.py
@@ -48,16 +48,18 @@ exitvalmap = {
}
def escape(arg):
- "escape shell special characters"
+ "escape shell special characters"
slash = '\\'
- special = '"$()'
+ special = '"$'
arg = arg.replace(slash, slash+slash)
for c in special:
arg = arg.replace(c, slash+c)
+ # print "ESCAPE RESULT: %s"%arg
return '"' + arg + '"'
+
def exec_subprocess(l, env):
proc = subprocess.Popen(l, env = env, close_fds = True)
return proc.wait()