-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update makefile to ass some install commands
- Loading branch information
1 parent
a3e11a2
commit 98c7f7c
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/python | ||
import os, sys, re, subprocess | ||
|
||
# If this script is set as your command handler, when any ?command is run in IRC it will | ||
# look in the path defined below for a script matching that command name and run it. | ||
# | ||
# e.g. ?uptime would look in "/usr/share/irccat/" (the default) for any script called | ||
# "uptime", with any extension. It would happily run both uptime.sh and uptime.py, or | ||
# a script in whatever language you like. Command names are limited to [0-9a-z]. | ||
|
||
path = '/home/instrumentation/bin/irccat/' | ||
|
||
args = sys.argv[1] | ||
bits = args.split(' ') | ||
command = bits[3].lower() | ||
|
||
found = False | ||
if re.match('^[a-z0-9]+$', command): | ||
for file in os.listdir(path): | ||
|
||
if re.match('^%s\.[a-z]+$' % command, file): | ||
found = True | ||
|
||
procArgs = [path + file] | ||
procArgs.extend(bits) | ||
proc = subprocess.Popen(procArgs, stdout=subprocess.PIPE) | ||
stdout = proc.stdout | ||
|
||
while True: | ||
# We do this to avoid buffering from the subprocess stdout | ||
print os.read(stdout.fileno(), 65536), | ||
sys.stdout.flush() | ||
|
||
if proc.poll() != None: | ||
break | ||
|
||
if found == False: | ||
print "Unknown command '%s'" % command |