View | Details | Raw Unified | Return to bug 139827
Collapse All | Expand All

(-)gtg/Makefile (-1 / +1 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	gtg
8
PORTNAME=	gtg
9
PORTVERSION=	0.1.2
9
PORTVERSION=	0.1.2
10
PORTREVISION=	1
10
PORTREVISION=	2
11
CATEGORIES=	deskutils gnome python
11
CATEGORIES=	deskutils gnome python
12
MASTER_SITES=	http://launchpad.net/gtg/trunk/${PORTVERSION}/+download/
12
MASTER_SITES=	http://launchpad.net/gtg/trunk/${PORTVERSION}/+download/
13
13
(-)gtg/files/patch-GTG_gtg.py (+40 lines)
Line 0 Link Here
1
--- GTG/gtg.py.orig	2009-07-04 16:26:24.000000000 +0400
2
+++ GTG/gtg.py	2009-09-16 19:43:28.000000000 +0400
3
@@ -58,28 +58,24 @@
4
 #we allow one instance of gtg by data directory.
5
 def check_instance(directory):
6
     """ Check if gtg is already running. """
7
-    pidfile = directory  + "gtg.pid"
8
+    pidfile = os.path.join(directory, "gtg.pid")
9
     if not os.path.exists(pidfile):
10
-        f = open(pidfile, "w")
11
-        f.close()
12
-    os.chmod(pidfile, 0600)
13
+        open(pidfile, "w").close()
14
+        os.chmod(pidfile, 0600)
15
 
16
     #see if gtg is already running
17
-    f = open(pidfile, "r")
18
-    pid = f.readline()
19
-    f.close()
20
+    pid = open(pidfile, "r").readline()
21
     if pid:
22
-        p = os.system("ps --no-heading --pid " + pid)
23
-        p_name = os.popen("ps -f --pid " + pid).read()
24
+        p = os.system("/bin/ps %s >/dev/null" % pid)
25
+        p_name = os.popen("/bin/ps -f %s" % pid).read()
26
         if p == 0 and "gtg" in p_name:
27
             print _("gtg is already running!")
28
             #todo : expose the browser (will be possible when we have dbus)
29
             sys.exit(0)
30
-            
31
+
32
     #write the pid file
33
-    f = open(pidfile, "w")
34
-    f.write(str(os.getpid()))
35
-    f.close()
36
+    with open(pidfile, "w") as f:
37
+      f.write(`os.getpid()`)
38
 
39
 #=== MAIN CLASS ================================================================
40

Return to bug 139827