diff options
author | Aleksey Filippov <alekseyf@google.com> | 2018-01-29 00:10:43 +0000 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-01-30 07:08:22 +1100 |
commit | 2cf85ae16f79b5edcbfa34d57b477c984c79e7a5 (patch) | |
tree | f0c533465924188dec1a95926ae48b4c63c00309 /mesonbuild/mintro.py | |
parent | 4e5ad57161a475dfab1c1a4edde075b2620b9f75 (diff) | |
download | meson-2cf85ae16f79b5edcbfa34d57b477c984c79e7a5.zip meson-2cf85ae16f79b5edcbfa34d57b477c984c79e7a5.tar.gz meson-2cf85ae16f79b5edcbfa34d57b477c984c79e7a5.tar.bz2 |
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
Diffstat (limited to 'mesonbuild/mintro.py')
-rw-r--r-- | mesonbuild/mintro.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index b23869f..aaaf8fc 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -49,14 +49,14 @@ parser.add_argument('builddir', nargs='?', help='The build directory') def determine_installed_path(target, installdata): install_target = None for i in installdata.targets: - if os.path.split(i[0])[1] == target.get_filename(): # FIXME, might clash due to subprojects. + if os.path.basename(i[0]) == target.get_filename(): # FIXME, might clash due to subprojects. install_target = i break if install_target is None: raise RuntimeError('Something weird happened. File a bug.') fname = i[0] outdir = i[1] - outname = os.path.join(installdata.prefix, outdir, os.path.split(fname)[-1]) + outname = os.path.join(installdata.prefix, outdir, os.path.basename(fname)) # Normalize the path by using os.path.sep consistently, etc. # Does not change the effective path. return str(pathlib.PurePath(outname)) |