[libgit2-glib] meson_vapi_link.py: Use python's own utils instead of calling 'ln'



commit 29db98df0f65519bbcc9827253b0849ce7fb741c
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date:   Sun Mar 1 17:33:12 2020 +0000

    meson_vapi_link.py: Use python's own utils instead of calling 'ln'
    
    Replace the use of 'ln' with os.symlink. Since subprocess.call does not
    raise any exception when the called process fails, this script likely
    silently did nothing on Windows. Instead, fall back to using shutil.copy
    to copy instead of symlinking.

 meson_vapi_link.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/meson_vapi_link.py b/meson_vapi_link.py
index d7fc729..db1e4e8 100644
--- a/meson_vapi_link.py
+++ b/meson_vapi_link.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
 import os
-import subprocess
+import shutil
 import sys
 
 datadir = sys.argv[1]
@@ -22,4 +22,7 @@ new = 'libgit2-glib-1.0'
 for ext in ['vapi', 'deps']:
   src = '{}.{}'.format(new, ext)
   dest = '{}.{}'.format(old, ext)
-  subprocess.call(['ln', '-s', '-f', src, dest])
+  try:
+      os.symlink(src, dest)
+  except OSError:
+      shutil.copy(src, dest)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]