mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
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>
This commit is contained in:
parent
8b9073367f
commit
d570c770ad
1 changed files with 7 additions and 7 deletions
14
gst-env.py
14
gst-env.py
|
@ -144,7 +144,7 @@ def setup_gdb(options):
|
||||||
if not shutil.which('gdb'):
|
if not shutil.which('gdb'):
|
||||||
return python_paths
|
return python_paths
|
||||||
|
|
||||||
bdir = os.path.realpath(options.builddir)
|
bdir = pathlib.Path(options.builddir).resolve()
|
||||||
for libpath, gdb_path in [
|
for libpath, gdb_path in [
|
||||||
(os.path.join("subprojects", "gstreamer", "gst"),
|
(os.path.join("subprojects", "gstreamer", "gst"),
|
||||||
os.path.join("subprojects", "gstreamer", "libs", "gst", "helpers")),
|
os.path.join("subprojects", "gstreamer", "libs", "gst", "helpers")),
|
||||||
|
@ -154,17 +154,17 @@ def setup_gdb(options):
|
||||||
if not gdb_path:
|
if not gdb_path:
|
||||||
gdb_path = libpath
|
gdb_path = libpath
|
||||||
|
|
||||||
autoload_path = os.path.join(bdir, "gdb-auto-load/", bdir[1:], libpath)
|
autoload_path = (pathlib.Path(bdir) / 'gdb-auto-load').joinpath(*bdir.parts[1:]) / libpath
|
||||||
os.makedirs(autoload_path, exist_ok=True)
|
autoload_path.mkdir(parents=True, exist_ok=True)
|
||||||
for gdb_helper in glob.glob(os.path.join(bdir, gdb_path, "*-gdb.py")):
|
for gdb_helper in glob.glob(str(bdir / gdb_path / "*-gdb.py")):
|
||||||
python_paths.add(os.path.join(bdir, gdb_path))
|
python_paths.add(str(bdir / gdb_path))
|
||||||
python_paths.add(os.path.join(options.srcdir, gdb_path))
|
python_paths.add(os.path.join(options.srcdir, gdb_path))
|
||||||
try:
|
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:
|
except FileExistsError:
|
||||||
pass
|
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:
|
try:
|
||||||
with open(os.path.join(options.srcdir, '.gdbinit'), 'r') as f:
|
with open(os.path.join(options.srcdir, '.gdbinit'), 'r') as f:
|
||||||
if gdbinit_line in f.readlines():
|
if gdbinit_line in f.readlines():
|
||||||
|
|
Loading…
Reference in a new issue