]> xenbits.xensource.com Git - libvirt.git/commitdiff
meson-dist: Use shutil.copy for copying a file
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 12 Jun 2023 07:49:33 +0000 (09:49 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 14 Jun 2023 10:47:55 +0000 (12:47 +0200)
Using os.system("cp {0} {1}".format(...)) has two issues, it does not
work on Windows, but more importantly it can cause issues in case one of
the directories has a space in it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
scripts/meson-dist.py

index a1d36c2533da4ff2c2bed843fc620c86eb9d3f45..1c2364f6b67e334ff36744f3c1810b063c28312f 100755 (executable)
@@ -2,13 +2,12 @@
 
 import os
 import sys
+import shutil
 
 meson_build_root = sys.argv[1]
 file_name = sys.argv[2]
 
 meson_dist_root = os.environ['MESON_DIST_ROOT']
 
-os.system('cp {0} {1}'.format(
-    os.path.join(meson_build_root, file_name),
-    os.path.join(meson_dist_root, file_name)
-))
+shutil.copy(os.path.join(meson_build_root, file_name),
+            os.path.join(meson_dist_root, file_name))