aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2017-06-09 05:08:40 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2017-06-13 00:12:19 -0400
commit1aa1d0d9ad378aa89f5d593e9d9b5c0d4ce30610 (patch)
tree6e335d51923c1e5c196b912e0aeba0fbb45789e7
parentf75d39468317fa642fca264ef05c4ef7c86fd9ca (diff)
downloadmeson-1aa1d0d9ad378aa89f5d593e9d9b5c0d4ce30610.zip
meson-1aa1d0d9ad378aa89f5d593e9d9b5c0d4ce30610.tar.gz
meson-1aa1d0d9ad378aa89f5d593e9d9b5c0d4ce30610.tar.bz2
Remove extraneous os.path.split()s.
Since only one part is needed, they can be replaced by dirname, basename, or the originally joined file name.
-rw-r--r--mesonbuild/scripts/dist.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/scripts/dist.py b/mesonbuild/scripts/dist.py
index 325a882..a8e163c 100644
--- a/mesonbuild/scripts/dist.py
+++ b/mesonbuild/scripts/dist.py
@@ -29,10 +29,11 @@ def create_hash(fname):
m = hashlib.sha256()
m.update(open(fname, 'rb').read())
with open(hashname, 'w') as f:
- f.write('%s %s\n' % (m.hexdigest(), os.path.split(fname)[-1]))
+ f.write('%s %s\n' % (m.hexdigest(), os.path.basename(fname)))
+
def create_zip(zipfilename, packaging_dir):
- prefix = os.path.split(packaging_dir)[0]
+ prefix = os.path.dirname(packaging_dir)
removelen = len(prefix) + 1
with zipfile.ZipFile(zipfilename,
'w',
@@ -81,7 +82,7 @@ def create_dist(dist_name, src_root, bld_root, dist_sub):
xzname = distdir + '.tar.xz'
# Should use shutil but it got xz support only in 3.5.
with tarfile.open(xzname, 'w:xz') as tf:
- tf.add(distdir, os.path.split(distdir)[1])
+ tf.add(distdir, dist_name)
# Create only .tar.xz for now.
# zipname = distdir + '.zip'
# create_zip(zipname, distdir)