aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang E. Sanyer <WolfgangESanyer@gmail.com>2021-09-17 17:04:59 -0400
committerZac Medico <zmedico@gentoo.org>2021-09-19 20:57:12 -0700
commit3812225ace5db8c691cbe027d234a3e223972199 (patch)
tree393971cca00076ab902f2b6f6351394b50639c06 /bin/chmod-lite.py
parentInclude INHERIT value in generated cache (diff)
downloadportage-3812225ace5db8c691cbe027d234a3e223972199.tar.gz
portage-3812225ace5db8c691cbe027d234a3e223972199.tar.bz2
portage-3812225ace5db8c691cbe027d234a3e223972199.zip
Reformat to use spaces instead of tabs. Also, use black
The following command was used to reformat: autopep8 --in-place --select=E101,E11,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E133,E20,E211,E22,E224,E224,E226,E227,E228,E231,E241,E242,E251,E252,E26,E265,E266,E27,E301,E302,E303,E304,E305,E306,W291,W293,W391 -r . black was run as `black .`, using the default configurations Signed-off-by: Wolfgang E. Sanyer <WolfgangESanyer@gmail.com> Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'bin/chmod-lite.py')
-rwxr-xr-xbin/chmod-lite.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/bin/chmod-lite.py b/bin/chmod-lite.py
index 7fe743ed1..fc2194ed5 100755
--- a/bin/chmod-lite.py
+++ b/bin/chmod-lite.py
@@ -10,20 +10,23 @@ from portage.util import apply_recursive_permissions
# Change back to original cwd _after_ all imports (bug #469338).
os.chdir(os.environ["__PORTAGE_HELPER_CWD"])
+
def main(files):
- # We can't trust that the filesystem encoding (locale dependent)
- # correctly matches the arguments, so use surrogateescape to
- # pass through the original argv bytes for Python 3.
- fs_encoding = sys.getfilesystemencoding()
- files = [x.encode(fs_encoding, 'surrogateescape') for x in files]
+ # We can't trust that the filesystem encoding (locale dependent)
+ # correctly matches the arguments, so use surrogateescape to
+ # pass through the original argv bytes for Python 3.
+ fs_encoding = sys.getfilesystemencoding()
+ files = [x.encode(fs_encoding, "surrogateescape") for x in files]
+
+ for filename in files:
+ # Emulate 'chmod -fR a+rX,u+w,g-w,o-w' with minimal chmod calls.
+ apply_recursive_permissions(
+ filename, filemode=0o644, filemask=0o022, dirmode=0o755, dirmask=0o022
+ )
- for filename in files:
- # Emulate 'chmod -fR a+rX,u+w,g-w,o-w' with minimal chmod calls.
- apply_recursive_permissions(filename, filemode=0o644,
- filemask=0o022, dirmode=0o755, dirmask=0o022)
+ return os.EX_OK
- return os.EX_OK
if __name__ == "__main__":
- sys.exit(main(sys.argv[1:]))
+ sys.exit(main(sys.argv[1:]))