diff options
author | Antonio Ospite <antonio.ospite@collabora.com> | 2020-09-24 13:50:09 +0200 |
---|---|---|
committer | Antonio Ospite <antonio.ospite@collabora.com> | 2020-09-24 13:50:09 +0200 |
commit | fa9627eb75c3904c53b81e06f6e0d2034a4a2d98 (patch) | |
tree | 22b3b2b2a5733d9f5cf8c8ac509585c19a6eec3e /gst-env.py | |
parent | 9e8ce49ac42b461a83098f8164915b19c0a78cfb (diff) | |
download | gstreamer-fa9627eb75c3904c53b81e06f6e0d2034a4a2d98.tar.gz |
gst-env: use Path.open() in get_pkgconfig_variable_from_pcfile()
The pcfile argument passed to get_target_install_filename() is
guaranteed to be a Path() object so use the .open() method to open the
file instead of the standard open() function.
This makes it possible to run gst-env.py on older systems with pyhton3.5
where the standard open() function cannot handle Path arguments.
The change fixes errors like the following:
-----------------------------------------------------------------------
$ ninja -C build/ devenv
ninja: Entering directory `build/'
[0/1] Running external command devenv
Traceback (most recent call last):
File "/home/ao2/gst-build/gst-env.py", line 493, in <module>
env = get_subprocess_env(options, gst_version)
File "/home/ao2/gst-build/gst-env.py", line 342, in get_subprocess_env
elif is_gio_module(target, filename, options.builddir):
File "/home/ao2/gst-build/gst-env.py", line 121, in is_gio_module
giomoduledir = PurePath(get_pkgconfig_variable(builddir, 'gio-2.0', 'giomoduledir'))
File "/home/ao2/gst-build/gst-env.py", line 110, in get_pkgconfig_variable
return get_pkgconfig_variable_from_pcfile(pcfile, varname)
File "/home/ao2/gst-build/gst-env.py", line 89, in get_pkgconfig_variable_from_pcfile
with open(pcfile, 'r', encoding='utf-8') as f:
TypeError: invalid file: PosixPath('/home/ao2/gst-build/build/meson-private/gio-2.0.pc')
FAILED: meson-devenv
-----------------------------------------------------------------------
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/192>
Diffstat (limited to 'gst-env.py')
-rwxr-xr-x | gst-env.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gst-env.py b/gst-env.py index 8811ae878b..a94432b461 100755 --- a/gst-env.py +++ b/gst-env.py @@ -86,7 +86,7 @@ def get_target_install_filename(target, filename): def get_pkgconfig_variable_from_pcfile(pcfile, varname): variables = {} substre = re.compile('\$\{[^${}]+\}') - with open(pcfile, 'r', encoding='utf-8') as f: + with pcfile.open('r', encoding='utf-8') as f: for line in f: if '=' not in line: continue |