[jhbuild] Install python2 symlink in ~/.local/bin when running on Debian



commit 6007add3779f8aa2a28e49394c88b9e6ddc494c7
Author: Colin Walters <walters verbum org>
Date:   Mon Nov 5 17:09:33 2012 -0500

    Install python2 symlink in ~/.local/bin when running on Debian
    
    This hack allows all GNOME modules to use "python2" to find Python 2.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687692

 Makefile.am                                |    3 +++
 Makefile.plain                             |    2 ++
 scripts/Makefile.am                        |    2 +-
 scripts/debian-python2-postinstall-hook.sh |   18 ++++++++++++++++++
 4 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index dd60013..c3c9ae6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,3 +37,6 @@ bin_PROGRAMS = install-check
 
 install_check_SOURCES = install-check.c
 
+
+install-exec-local:
+	$(srcdir)/scripts/debian-python2-postinstall-hook.sh $(DESTDIR)$(bindir)
diff --git a/Makefile.plain b/Makefile.plain
index a40f627..761d067 100644
--- a/Makefile.plain
+++ b/Makefile.plain
@@ -46,4 +46,6 @@ install: include-check install-check
 		ln -s $(bindir)/jhbuild "$(HOME)/bin/jhbuild" ; \
 	fi
 
+	./scripts/debian-python2-postinstall-hook.sh $(bindir)
+
 .PHONY: all update install
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index d480572..1e4087f 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = hg-update.py jhbuild.in
+EXTRA_DIST = hg-update.py jhbuild.in debian-python2-postinstall-hook.sh
 
 bin_SCRIPTS = jhbuild
 CLEANFILES = jhbuild
diff --git a/scripts/debian-python2-postinstall-hook.sh b/scripts/debian-python2-postinstall-hook.sh
new file mode 100755
index 0000000..ef7b39b
--- /dev/null
+++ b/scripts/debian-python2-postinstall-hook.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# This awful bit of code is intended to ensure that
+# modules we build with jhbuild can always use "python2"
+# to find Python 2, even if the host system (e.g. Debian)
+# doesn't have such a symbolic link.
+#
+# See: https://mail.gnome.org/archives/desktop-devel-list/2012-November/msg00011.html
+
+set -e
+
+bindir=$1
+test -n "$bindir" || (echo "usage: $0 bindir"; exit 1)
+
+py2=$(which python2 2>/dev/null || true)
+if test -z "$py2"; then
+    py=$(which python 2>/dev/null);
+    ln -s "$(which python)" ${bindir}/python2;
+fi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]