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/wrap/wraptool.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/wrap/wraptool.py')
-rw-r--r-- | mesonbuild/wrap/wraptool.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/wrap/wraptool.py b/mesonbuild/wrap/wraptool.py index 0bdc417..09a0289 100644 --- a/mesonbuild/wrap/wraptool.py +++ b/mesonbuild/wrap/wraptool.py @@ -150,7 +150,7 @@ def do_promotion(from_path, spdir_name): assert(from_path.endswith('.wrap')) shutil.copy(from_path, spdir_name) elif os.path.isdir(from_path): - sproj_name = os.path.split(from_path)[1] + sproj_name = os.path.basename(from_path) outputdir = os.path.join(spdir_name, sproj_name) if os.path.exists(outputdir): sys.exit('Output dir %s already exists. Will not overwrite.' % outputdir) @@ -178,7 +178,7 @@ def promote(argument): def status(): print('Subproject status') for w in glob('subprojects/*.wrap'): - name = os.path.split(w)[1][:-5] + name = os.path.basename(w)[:-5] try: (latest_branch, latest_revision) = get_latest_version(name) except Exception: |