[gtk-osx: 25/48] Update installation of jhbuildrc and jhbuildrc-custom...
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-osx: 25/48] Update installation of jhbuildrc and jhbuildrc-custom...
- Date: Tue, 14 May 2019 23:58:36 +0000 (UTC)
commit 2425963ab77ab24f80aa057d089cebddd51c3c9d
Author: John Ralls <jralls ceridwen us>
Date: Sat Apr 13 12:23:00 2019 -0700
Update installation of jhbuildrc and jhbuildrc-custom...
To match the current jhbuild defaults.
Notice that one can now set XDG_CONFIG_HOME and put both there, and it
need not be in $HOME. The default is $HOME/.config. $HOME/.jhbuildrc and
$HOME/.jhbuildrc-custom are still supported and won't be disturbed if
found.
jhbuildrc will now search in order the same directory it is in,
$XDG_CONFIG_HOME if it's set or $HOME/.config if its not, and $HOME for
either jhbuildrc-custom or .jhbuildrc-custom.
If for some reason you want jhbuildrc-custom somewhere else or to have a
different name you can set $JHBUILDRC_CUSTOM. Both gtk-osx-setup.sh and
jhbuildrc will honor it.
gtk-osx-setup.sh | 22 +++++++++++++++++++---
jhbuildrc-gtk-osx | 25 ++++++++++++++++++++++---
2 files changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/gtk-osx-setup.sh b/gtk-osx-setup.sh
index 6b72601..c86b2de 100755
--- a/gtk-osx-setup.sh
+++ b/gtk-osx-setup.sh
@@ -207,16 +207,32 @@ export PATH="$PYENV_ROOT/shims:$DEVPREFIX/bin:$PYENV_INSTALL_ROOT/plugins/python
export PYENV_ROOT
export CFLAGS="-isysroot $SDKROOT -I$SDKROOT/usr/include"
export PYTHON_CONFIGURE_OPTS="--enable-shared"
+export WORKON_HOME=$DEVPREFIX/share/venv
$PIPENV install
BASEURL="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master"
-if test -L $HOME/.jhbuildrc ; then
+config_dir=""
+if test -d "$XDG_CONFIG_HOME" ; then
+ config_dir="$XDG_CONFIG_HOME"
+elif test -d "$HOME/.config" ; then
+ config_dir = "$HOME/.config"
+fi
+
+jhbuildrc_file=""
+if test -e "$config_dir/jhbuildrc" ; then
+ jhbuildrc_file="$config_dir/jhbuildrc"
+elif test -e "$HOME/.jhbuildrc" ; then
+ jhbuildrc_file="$HOME/.jhbuildrc"
+fi
+
+if -z "$jhbuildrc_file" ; then
echo "Installing jhbuild configuration..."
- curl -ks $BASEURL/jhbuildrc-gtk-osx -o $HOME/.jhbuildrc
+ curl -ks $BASEURL/jhbuildrc-gtk-osx -o "$config_dir/jhbuildrc"
fi
-if test ! -e $HOME/.jhbuildrc-custom ; then
+envvar JHBUILDRC_CUSTOM "$config_dir/jhbuildrc-custom"
+if test ! -e "$JHBUILDRC_CUSTOM" -a ! -e $HOME/.jhbuildrc-custom; then
curl -ks $BASEURL/jhbuildrc-gtk-osx-custom-example -o $HOME/.jhbuildrc-custom
fi
diff --git a/jhbuildrc-gtk-osx b/jhbuildrc-gtk-osx
index 80a3660..0dd4d93 100644
--- a/jhbuildrc-gtk-osx
+++ b/jhbuildrc-gtk-osx
@@ -403,9 +403,28 @@ if _osx_version < 8.0:
# the prefix or default build setup for example, or CFLAGS or
# module_autogenargs, etc.
#
-_userrc = os.path.join(os.environ['HOME'], '.jhbuildrc-custom')
-if os.path.exists(_userrc):
- execfile(_userrc)
+_this_dir = os.path.dirname(__file__);
+_home = os.path.expanduser('~')
+_user_config_dir = os.environ.get('XDG_CONFIG_HOME',
+ os.path.join(home, '.config'))
+if ('JHBUILDRC_CUSTOM' in os.environ and
+ os.environ['JHBUILDRC_CUSTOM']):
+ _user_rc = os.environ['JHBUILDRC_CUSTOM']
+if not os.path.exists(_user_rc):
+ _user_rc = os.path.join(_this_dir, 'jhbuildrc-custom');
+if not os.path.exists(_user_rc):
+ _user_rc = os.path.join(_this_dir, '.jhbuildrc-custom')
+if not os.path.exists(_user_rc):
+ _user_rc = os.path.join(_user_config_dir, 'jhbuildrc-custom')
+if not os.path.exists(_user_rc):
+ _user_rc = os.path.join(_user_config_dir, '.jhbuildrc-custom')
+if not os.path.exists(_user_rc):
+ _user_rc = os.path.join(_home, 'jhbuildrc-custom')
+if not os.path.exists(_user_rc):
+ _user_rc = os.path.join(_home, '.jhbuildrc-custom')
+
+if os.path.exists(_user_rc):
+ execfile(_user_rc)
# Allow including different variants depending on the environment
# variable JHB. This can be used to have different setups for SDK
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]