From 2cf85ae16f79b5edcbfa34d57b477c984c79e7a5 Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Mon, 29 Jan 2018 00:10:43 +0000 Subject: Use os.path: basename() and dirname() instead of split() According to Python documentation[1] dirname and basename are defined as follows: os.path.dirname() = os.path.split()[0] os.path.basename() = os.path.split()[1] For the purpose of better readability split() is replaced by appropriate function if only one part of returned tuple is used. [1]: https://docs.python.org/3/library/os.path.html#os.path.split --- mesonbuild/scripts/gettext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/scripts/gettext.py') diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py index 30ac54c..f308c5a 100644 --- a/mesonbuild/scripts/gettext.py +++ b/mesonbuild/scripts/gettext.py @@ -81,7 +81,7 @@ def do_install(src_sub, bld_sub, dest, pkgname, langs): srcfile = os.path.join(bld_sub, l + '.gmo') outfile = os.path.join(dest, l, 'LC_MESSAGES', pkgname + '.mo') - os.makedirs(os.path.split(outfile)[0], exist_ok=True) + os.makedirs(os.path.dirname(outfile), exist_ok=True) shutil.copyfile(srcfile, outfile) shutil.copystat(srcfile, outfile) print('Installing %s to %s' % (srcfile, outfile)) -- cgit v1.1