summaryrefslogtreecommitdiff
path: root/gst-env.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-06-15 19:06:22 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-06-15 19:06:22 +0530
commitd570c770adeb89ab5b954f4dadb89d6daadbd238 (patch)
tree36e4e02e9cfb6f297e25075bc3235c474281f2c1 /gst-env.py
parent8b9073367fc9b282f4fe379d7d021d4e4986812a (diff)
downloadgstreamer-d570c770adeb89ab5b954f4dadb89d6daadbd238.tar.gz
gst-env: Fix creation of gdb-autoload dirs on Windows
`bdir[1:]` is supposed to convert `/path/to/bdir` to `path/to/bdir` which is only correct on UNIX. On Windows it will convert `C:\path\to\bdir` to `:\path\to\bdir` which is totally wrong. Use pathlib instead, which makes it trivial to do the conversion using `joinpath(*bdir.parts)` Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/160>
Diffstat (limited to 'gst-env.py')
-rwxr-xr-xgst-env.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/gst-env.py b/gst-env.py
index 34f8f21db6..d91381a731 100755
--- a/gst-env.py
+++ b/gst-env.py
@@ -144,7 +144,7 @@ def setup_gdb(options):
if not shutil.which('gdb'):
return python_paths
- bdir = os.path.realpath(options.builddir)
+ bdir = pathlib.Path(options.builddir).resolve()
for libpath, gdb_path in [
(os.path.join("subprojects", "gstreamer", "gst"),
os.path.join("subprojects", "gstreamer", "libs", "gst", "helpers")),
@@ -154,17 +154,17 @@ def setup_gdb(options):
if not gdb_path:
gdb_path = libpath
- autoload_path = os.path.join(bdir, "gdb-auto-load/", bdir[1:], libpath)
- os.makedirs(autoload_path, exist_ok=True)
- for gdb_helper in glob.glob(os.path.join(bdir, gdb_path, "*-gdb.py")):
- python_paths.add(os.path.join(bdir, gdb_path))
+ autoload_path = (pathlib.Path(bdir) / 'gdb-auto-load').joinpath(*bdir.parts[1:]) / libpath
+ autoload_path.mkdir(parents=True, exist_ok=True)
+ for gdb_helper in glob.glob(str(bdir / gdb_path / "*-gdb.py")):
+ python_paths.add(str(bdir / gdb_path))
python_paths.add(os.path.join(options.srcdir, gdb_path))
try:
- os.symlink(gdb_helper, os.path.join(autoload_path, os.path.basename(gdb_helper)))
+ os.symlink(gdb_helper, str(autoload_path / os.path.basename(gdb_helper)))
except FileExistsError:
pass
- gdbinit_line = 'add-auto-load-scripts-directory %s' % os.path.join(bdir, 'gdb-auto-load\n')
+ gdbinit_line = 'add-auto-load-scripts-directory {}\n'.format(bdir / 'gdb-auto-load')
try:
with open(os.path.join(options.srcdir, '.gdbinit'), 'r') as f:
if gdbinit_line in f.readlines():