gmyth-stream/server/lib.py
branchtrunk
changeset 513 12a61040588d
parent 484 27e83a8f68d7
child 516 f353f0da6f07
     1.1 --- a/gmyth-stream/server/lib.py	Tue Apr 03 16:42:04 2007 +0100
     1.2 +++ b/gmyth-stream/server/lib.py	Mon Apr 09 15:20:37 2007 +0100
     1.3 @@ -1,9 +1,25 @@
     1.4  import time
     1.5 +import logging
     1.6 +import os
     1.7 +import stat
     1.8  
     1.9  def now():
    1.10      return time.strftime("%Y-%m-%d %H:%M:%S");
    1.11  
    1.12  def log(msg):
    1.13 +    logging.log(logging.DEBUG, msg)
    1.14      new_msg = "[%s] %s" % (now(), msg)
    1.15 -    print new_msg
    1.16      return new_msg
    1.17 +
    1.18 +
    1.19 +bin_path_list = os.environ["PATH"].split(os.pathsep)
    1.20 +def which(prg):
    1.21 +    for d in bin_path_list:
    1.22 +        path = os.path.join(d, prg)
    1.23 +        if os.path.exits(path):
    1.24 +            st = os.stat(path)
    1.25 +            if st[stat.ST_MODE] & 0111:
    1.26 +                return path
    1.27 +    return ""
    1.28 +
    1.29 +