aboutsummaryrefslogtreecommitdiff
path: root/source/pyAggr3g470r
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-11-09 21:30:41 +0100
committercedricbonhomme <devnull@localhost>2012-11-09 21:30:41 +0100
commit550159216a4c63f4ee3351f26310ec3bbf4e4d53 (patch)
treee522643f26a3f289b971da7211e20a6f6f15e370 /source/pyAggr3g470r
parentUpdated README. (diff)
downloadnewspipe-550159216a4c63f4ee3351f26310ec3bbf4e4d53.tar.gz
newspipe-550159216a4c63f4ee3351f26310ec3bbf4e4d53.tar.bz2
newspipe-550159216a4c63f4ee3351f26310ec3bbf4e4d53.zip
Start script now checks if Python 3 is the default installation on the system. If not the script tries to launch pyAggr3g470r with Python 3.2.
Diffstat (limited to 'source/pyAggr3g470r')
-rwxr-xr-xsource/pyAggr3g470r15
1 files changed, 9 insertions, 6 deletions
diff --git a/source/pyAggr3g470r b/source/pyAggr3g470r
index 5bce5181..f9177374 100755
--- a/source/pyAggr3g470r
+++ b/source/pyAggr3g470r
@@ -37,10 +37,10 @@ import signal
PATH = os.path.abspath(".")
SERVICE = "pyAggr3g470r"
-def service_start(servicename = None):
+def service_start(python_command, servicename = None):
if servicename is not None:
service = servicename + ".py"
- proc = subprocess.Popen(["python",service], stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
+ proc = subprocess.Popen([python_command, service], stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
time.sleep(0.15)
return proc.pid
return False
@@ -80,9 +80,9 @@ def rmpid (processname = None):
else:
return False
-def start():
+def start(python_command):
if not checkpid(servicename = SERVICE):
- pid = service_start(servicename = SERVICE)
+ pid = service_start(python_command, servicename = SERVICE)
writepid(processname = SERVICE, pid = pid)
print(SERVICE + " is starting with pid: " + pidof(processname=SERVICE))
else:
@@ -117,14 +117,17 @@ def usage():
if __name__ == "__main__":
# Point of entry in execution mode.
+ python_command = "python"
+ if sys.version_info.major == 2:
+ python_command = "python3.2"
if len(sys.argv) == 1:
usage()
elif sys.argv[1] == "start":
- start()
+ start(python_command)
elif sys.argv[1] == "stop":
stop()
elif sys.argv[1] == "restart":
stop()
- start()
+ start(python_command)
else:
usage()
bgstack15