Commit graph

27 commits

Author SHA1 Message Date
Antonio Ospite
fa9627eb75 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>
2020-09-24 13:50:09 +02:00
Nirbheek Chauhan
2a4d7f2264 gst-env: Load gio modules in the devenv
By setting GIO_EXTRA_MODULES we can ensure that any gio modules we
built are loaded by the devenv.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/180>
2020-08-03 18:52:20 +00:00
Nirbheek Chauhan
ef4059d4ad gst-env: Factor out some common code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/180>
2020-08-03 18:52:20 +00:00
Nirbheek Chauhan
beeec59a01 gst-env: Prematurely skip all targets that aren't installed
Simplifies the code a bit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/180>
2020-08-03 18:52:20 +00:00
Jan Alexander Steffens (heftig)
9fa22f5873 gst-env.py: Sort path sets before using prepend_env_var
Python `set`s have a random ordering. To avoid creating a random
environment, create sorted lists before iterating over them.

Our Rust crates instruct cargo to rebuild if `PKG_CONFIG_PATH` changes,
so this has been causing unnecessary rebuilds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/177>
2020-07-21 21:13:56 +02:00
Nirbheek Chauhan
77cd988ac8 gst-env: Copy instead of symlink on Windows
os.symlink needs admin privs in most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/160>
2020-06-15 19:59:22 +05:30
Nirbheek Chauhan
d570c770ad 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>
2020-06-15 19:06:22 +05:30
Nirbheek Chauhan
8b9073367f gst-env: Use meson-uninstalled pkgconfig files if available
This allows people to use the development environment for building
projects when glib is built as a subproject.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/158>
2020-06-12 19:21:52 +05:30
Víctor Manuel Jáquez Leal
ac7b46033f gst-env: fix program name in argparse
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/145>
2020-05-11 16:39:59 +02:00
Philippe Normand
6abaee851b gst-env: Remove non-existent directory from PKG_CONFIG_PATH
There is no pkgconfig directory in -good.
2020-04-20 14:53:11 +01:00
Nirbheek Chauhan
478836e85b gst-env: Also look for builddir when hunting for a build dir 2020-04-16 19:38:29 +05:30
Nicolas Dufresne
f69a2c9fd2 gst-env: Allow setting environment without git
This is needed to use gst-uninstalled mode over NFS when gst-build is a
worktree. When this is the case, the .git is a file that links to the original
git tree, but this tree is unlikely to be visible over NFS. Instead of forcing
NFS contorsion, simply ignore the error.
2020-03-25 08:43:10 -04:00
Thibault Saunier
7d08aef9ed devenv: Fix path handling for gdb support
And enable gdb support only when gdb is avalaible
2020-01-19 11:21:17 +00:00
Thibault Saunier
84e01411e4 uninstalled: Add support for GStreamer and GLib gdb scripts 2020-01-13 11:41:40 -03:00
Charlie Turner
c57dca5220 dev environment: allow printing only env without starting a shell
allow for workflows that don't want the gst scripts to start shells,
this can be awkward for higher-level scripts setting up shells
themselves.

this is especially useful in combination with eval, and mimics the sort
of thing you can do with ssh-agent -s.
2020-01-06 21:06:42 +00:00
Julien Isorce
cca62a11f5 env: preprend gst-build/prefix/etc/xdg to XDG_CONFIG_DIRS
So gst-build/prefix/etc/xdg/tizonia/tizonia.conf can be found.
Which one contains path to tizonia plugins. Useful when
compiling tizonia-openmax-il and installing it in gst-build
's prefix location:
  autoreconf -ifs
  ./configure --disable-player
              --without-libspotify
              --prefix=path_to_gst-build/prefix/
  make && make install

Allows the following to work:
  gst-launch-1.0 videotestsrc ! vp8enc ! omxvp8dec ! xvimagesink
2019-12-23 09:38:59 +00:00
Nirbheek Chauhan
b46aa21ed4 gst-env: Automatically set the prompt for zsh too 2019-12-22 20:16:25 +05:30
Nirbheek Chauhan
bc1c337c77 gst-env: Don't put helper binaries in PATH
Check if the executable would be installed into bindir before adding
it to PATH in the uninstalled shell.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-build/issues/67
2019-12-19 16:24:37 +05:30
Nirbheek Chauhan
245baadbce gst-env: Fix shell name check
We should use `endswith`, not `in`. Else we'll match paths like:

`/home/arbash/.local/bin/fish` as a bash shell, not a fish shell.
2019-12-19 02:45:44 +05:30
Nirbheek Chauhan
e13e6758e3 gst-env: Set the prompt for fish to be same as bash 2019-12-19 02:39:01 +05:30
Nirbheek Chauhan
675cec1ed2 gst-env: Ignore SIGINT when using the fish shell
After discussion with fish upstream it looks like it will take some
work to fix this issue.

https://github.com/fish-shell/fish-shell/pull/6426#issuecomment-567174105

In the meantime, this only happens when there's no command running in
the terminal, and in that case the shell just ignores it anyway. So
just do that in `gst-env.py`.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-build/issues/18
2019-12-19 02:14:30 +05:30
Jan Alexander Steffens (heftig)
49fea2520f
python: Avoid using 'is' to compare strings
This is the wrong operator to use, which only seems to work because
`os.name` and `'nt'` happen to be the same object. Python 3.8 also
produces a `SyntaxWarning` when encountering this pattern.
2019-11-11 12:41:44 +01:00
Philippe Normand
2e6bd1ca8d gst-env: Fix the gst plugin file path regex for Linux platforms
On Linux, the library file is stored in the platform triplet directory under the
lib directory (hence for example
lib/x86_64-linux-gnu/gstreamer-1.0/libgstfoo.so) so the regex needs to take this
into account.

With this change the LD_LIBRARY_PATH on Linux now contains only the directories
with gst libs, ignoring the plugins, as initially intended in
c6613d8da2.

Fixes #56
2019-11-06 09:33:46 +01:00
Philippe Normand
aded9c617f gst-env: Ensure target install filename is a list
At least in Meson 0.49, the target['install_name'] is a string, not a list, so
the heuristics declared in the is_library_target_and_not_plugin() can't apply
because Python is actually happy to iterate over a string without any warning.
2019-11-06 09:33:46 +01:00
Philippe Normand
3dc7c9de94 gst-env: Use locally built GStreamer utility programs
The host environment might not have gst-launch-1.0 and gst-inspect-1.0
installed.

Fixes #52
2019-11-02 10:56:59 +01:00
Thibault Saunier
3d8662ebfe Add support for wine+mingw environments 2019-10-01 09:20:25 -03:00
Thibault Saunier
fe39bd3027 Rename 'uninstalled' to development environment
In the case of wine, the env can not be uninstalled, also developers
do not necessiraly care about the fact that it is "uninstalled", the
important thing is that it is a development environment, meaning
that they can work on GStreamer or with GStreamer in the environment.

I still keep the `uninstalled` target to avoid changing people's
habits for now.
2019-09-24 08:23:07 -03:00
Renamed from gst-uninstalled.py (Browse further)