Commit graph

46 commits

Author SHA1 Message Date
Tim-Philipp Müller
936143599c gst-env.py: drop 'gst-' prefix from branch name in prompt
Probably leftover from the days where we would have a gst-foo.sh
script to set up the devenv for a particular checkout/branch.

Kind of confusing now if you're working on a named branch and
it just adds an extra gst- prefix in the prompt.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2594>
2022-06-15 21:55:57 +00:00
Seungha Yang
12fdf93ba4 gst-env: Add support for PowerShell 7
The executable binary name of "PowerShell 7" is "pwsh.exe"
which is different from system default installed
"Windows PowerShell (version 5.x or older)"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2545>
2022-06-03 18:55:36 +00:00
Jordan Petridis
d63a2c786b gst-env: spawn a shell to execute commands on windows
On windows, if you are not using built-in commands you need
to pass the full path of your executable into the subprocess.call/
Popen syscall. ex `c:/foo/bar/baz.exe`. This get's long and is
not ergonomic when you want to run trivial task like:

`gst-env.py ninja` or `gst-inspect0.0` or `gst-validate-launcher`

Instead, on windows, always launch a shell to be able to resolve
the executable from the PATH.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2397>
2022-05-15 09:34:58 +00:00
Sebastian Fricke
57158f4194 Allow running gst-uninstalled when GStreamer is a subproject
As described in Merge request 222, the previous solution is not the
best possible solution and was also missing documentation.
Adjust the suggestion to the current GStreamer mono-repository.
And apply this change after reverting the previous commit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1743>
2022-03-01 11:33:10 +00:00
Sebastian Fricke
0c8ff1a837 Revert "Allow running gst-uninstalled when gst-build is a subproject"
This reverts commit 879126a31c.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1743>
2022-03-01 11:33:10 +00:00
Sebastian Fricke
cfea428081 gst-env: Improve coding style and cleanup
* Remove unused variables
* Remove unused imports
* Apply pycodestyle style suggestions
  - Missing newlines
  - spaces before brackets
  - Wrong indentations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1743>
2022-03-01 11:33:10 +00:00
Mark Nauwelaerts
4dece4701d gst-env: extend PATH to include plugin scanner and generator 2022-01-12 21:27:30 +00:00
Thibault Saunier
bdc4d9c395 env: Fix deprecations from python 3.10
distutils is now deprecated and strtobool is simple enough for us to just
vendor.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1358>
2021-11-18 00:19:46 +00:00
Thibault Saunier
1babccfe50 python: Fix using overrides when not building PyGObject
Since 547570cd79 we do not always build
PyGObject and our development environment is broken when trying to use
GStreamer python when built against system PyGObject with the following
error importing Gst in there:

```
12345678** (gst-plugin-scanner:710617): CRITICAL **: 11:45:02.343: can't find gi.repository.Gst
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/gi/repository/__init__.py", line 23, in <module>
    from ..importer import DynamicImporter
  File "/usr/lib64/python3.9/site-packages/gi/importer.py", line 33, in <module>
    from .overrides import load_overrides
ImportError: cannot import name 'load_overrides' from 'gi.overrides' (/var/home/thiblahute/devel/gstreamer/gstreamer/subprojects/gst-editing-services/bindings/python/gi/overrides/__init__.py)
Factory Details:
```

The approach to fixing it is to implement override `gi` in
`gst-python/gi/` which we add to `PYTHONPATH`) and in there reset the
`gi` module to the right place and we get overrides from paths from
`_GI_OVERRIDES_PATH` we set in `gst-env.py` which points to all the
overrides that will be installed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1155>
2021-10-15 20:51:41 +00:00
Thibault Saunier
ee67bd8e8b gst-env: Ignore SIGINT when running on the CI server
We get spurious sigint and this is just a small temporary workaround

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1113>
2021-10-12 16:59:16 +00:00
Xavier Claessens
cf912f6d15 ci: Fix gst-indent path
It used to be downloaded into PATH, but we can now instead run it from
git. Also move it to top source dir instead of gstreamer subproject.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/931>
2021-10-05 23:44:03 +03:00
Stéphane Cerveau
d435b154b8 core: remove outdated mention to gst-build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/956>
2021-09-30 12:24:38 +00:00
Thibault Saunier
bcd3ffa8b2 Cleanup root directory from misc files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/891>
2021-09-24 16:21:18 -03:00
Nirbheek Chauhan
a31e9dcf43 gst-env: Don't set DYLD_LIBRARY_PATH on macOS
This is not actually needed because everything we build is using
@rpath already, and setting it causes dynamic linker path priority
issues with macOS internals causing *all* programs to fail to run
inside gst-env:

```
$ vim
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
  Expected in: /Users/nirbheek/projects/repos/gst-build/_build_macos/subprojects/libjpeg-turbo-2.1.0/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Abort trap: 6
```

In this case it is caused by libjpeg.dylib, but it can happen with
other dylibs that conflict with dylibs used by macOS internally.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/257>
2021-08-28 23:44:52 +05:30
Olivier Crete
879126a31c Allow running gst-uninstalled when gst-build is a subproject
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/222>
2021-08-27 12:44:25 +00:00
Olivier Crête
e43985d8bb devenv: Add webrtc testsuite to paths
This makes it a little easier to run it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/243>
2021-04-30 17:37:31 -04:00
Stéphane Cerveau
e4421c3c90 bash-completion: add completion for gstreamer tools
Allow to autocomplete with elements/properties
in the devenv using gst-launch-1.0 etc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/232>
2021-04-29 23:54:33 +00:00
Andrey Moiseev
d5b6cc88f9 gst-env: Windows: Fix looking for cmd_or_ps.ps1 in the wrong directory
At the point of get_windows_shell() execution, the current directory
equals DEFAULT_BUILDDIR=./build. But cmd_or_ps.ps1 is in SCRIPTDIR=./
(repo root). Point subprocess.check_output() to the correct directory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/238>
2021-04-06 02:51:07 -07:00
Xavier Claessens
8046eda879 Meson: Use generated -uninstalled.pc files 2020-10-23 10:55:20 -04:00
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)