Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Ambrois <andresambrois@gmail.com>2008-08-16 09:15:34 (GMT)
committer Andrés Ambrois <andresambrois@gmail.com>2008-08-16 09:15:34 (GMT)
commit6200c1437f278640f4c94f6ccfc9aeaeedf0e7ba (patch)
treea401aab52b4cdd6d20a64dae60b201e7123f82fb
parent11cf6c6a268b17c02df7673c846ba991a04842fa (diff)
gtp.search_for_gnugo() checks if gnugo is installed
-rw-r--r--gtp.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gtp.py b/gtp.py
index 5e7164a..98a500a 100644
--- a/gtp.py
+++ b/gtp.py
@@ -19,8 +19,19 @@
from subprocess import Popen, PIPE
import logging
+from os.path import exists, join, abspath
+from os import pathsep, environ
+from string import split
+
logger = logging.getLogger('PlayGo')
+def search_for_gnugo():
+ paths = split(environ['PATH'], pathsep)
+ for path in paths:
+ if exists(join(path, 'gnugo')):
+ return abspath(join(path, 'gnugo'))
+ return False
+
class gnugo:
''' A wrapper for talking to gnugo over GTP '''
def __init__(self, boardsize=19, color='black', handicap=0, komi=5.5, level=3):