[Scons-users] Chmod fun
Mats Wichmann
mats at wichmann.us
Wed Jul 26 13:39:26 EDT 2017
okay, this was amusing...
Execute(Chmod(ndk_bundle, 'a+x'))
leads to
09:40:32 TypeError: %o format: a number is required, not str:
from (long traceback trimmed):
09:40:32 File "/usr/lib/scons/SCons/Defaults.py", line 177:
09:40:32 return 'Chmod(%s, 0%o)' % (get_paths_str(dest), mode)
scons manpage:
Returns an Action object that changes the permissions on the
specified dest file or directory to the specified mode which can be
octal or string, similar to the bash command. Examples:
Execute(Chmod('file', 0755))
env.Command('foo.out', 'foo.in',
[Copy('$TARGET', '$SOURCE'),
Chmod('$TARGET', 0755)])
Execute(Chmod('file', "ugo+w"))
env.Command('foo.out', 'foo.in',
[Copy('$TARGET', '$SOURCE'),
Chmod('$TARGET', "ugo+w")])
linux chmod man:
The format of a symbolic mode is [ugoa...][[-+=][perms...]...],
where
perms is either zero or more letters from the set rwxXst, or a
single
letter from the set ugo. Multiple symbolic modes can be given,
sepa‐
rated by commas.
But it turns out, not 'a' for scons:
permission_dic = {
'u':{
...
'g':{
...
},
'o':{
...
}
}
There's not a big complaint here, except that "similar to bash" doesn't
give much detail; I guessed wrong.
FWIW, http://www.scons.org/doc/latest/HTML/scons-user.html does not hint
at the string variant of the mode at all: "The permission argument uses
POSIX-style permission bits and should typically be expressed as an
octal, not decimal, number".
More information about the Scons-users
mailing list