gst-env: Copy instead of symlink on Windows
authorNirbheek Chauhan <nirbheek@centricular.com>
Mon, 15 Jun 2020 14:18:30 +0000 (19:48 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Mon, 15 Jun 2020 14:29:22 +0000 (19:59 +0530)
os.symlink needs admin privs in most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/160>

gst-env.py

index d91381a..d95b2e9 100755 (executable)
@@ -160,8 +160,11 @@ def setup_gdb(options):
             python_paths.add(str(bdir / gdb_path))
             python_paths.add(os.path.join(options.srcdir, gdb_path))
             try:
-                os.symlink(gdb_helper, str(autoload_path / os.path.basename(gdb_helper)))
-            except FileExistsError:
+                if os.name == 'nt':
+                    shutil.copy(gdb_helper, str(autoload_path / os.path.basename(gdb_helper)))
+                else:
+                    os.symlink(gdb_helper, str(autoload_path / os.path.basename(gdb_helper)))
+            except (FileExistsError, shutil.SameFileError):
                 pass
 
     gdbinit_line = 'add-auto-load-scripts-directory {}\n'.format(bdir / 'gdb-auto-load')