Package: pyro4 / 4.23-1

initscript_fallback_to_python2.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Description: support Python 2.x and Python 3.y versions in initscript
 Pyro4 support both Python2 and Python3 versions, use the one which is
 available.
 .
Author: Laszlo Boszormenyi (GCS) <gcs@debian.hu>
Last-Update: <2012-12-31>

---

--- pyro4-4.17.orig/contrib/init.d/pyro4-nsd
+++ pyro4-4.17/contrib/init.d/pyro4-nsd
@@ -49,6 +49,10 @@ fi
 # Create the PID File
 touch $PID
 
+# Detect if Python 2.x or Python 3.y is installed
+PYTHON=python3
+[ -x /usr/bin/$PYTHON ] || PYTHON=python
+
 case "$1" in
   start)
     # create the log directory if not exist
@@ -57,7 +61,7 @@ case "$1" in
     echo "Starting Pyro4 Name Server"
     # test if not already running
     if [ ! -f "/proc/$(cat $PID)/exe" ]; then
-      python -m Pyro4.naming -n "$LISTEN_ADDRESS" -p "$LISTEN_PORT" >/dev/null 2>&1 &
+      $PYTHON -m Pyro4.naming -n "$LISTEN_ADDRESS" -p "$LISTEN_PORT" >/dev/null 2>&1 &
       echo $!>"$PID"
     else
       echo "Pyro4 Name Server already running"