diff --git a/tools/build-opentx.py b/tools/build-opentx.py new file mode 100755 index 000000000..57cb5f979 --- /dev/null +++ b/tools/build-opentx.py @@ -0,0 +1,110 @@ +#! /usr/bin/python +import cgitb +#cgitb.enable() + + +from pprint import pprint +from time import gmtime, strftime +from os.path import expanduser +import os +import os.path +import cgi +import sys +import re +import fcntl +import subprocess + +gitdir="~/cgibuild/opentx" +pidfile="~/cgibuild/opentxbuild.pid" +outdir="~/Sites/builds/" +builddir="~/cgibuild/" + +def main(): + print ("Content-Type: text/html\n") + + print (""" + +
+\n")
+ sys.stdout.flush()
+
+ for line in p.stdout:
+ sys.stdout.write(line)
+ logfile.write(line)
+ if '\n' in line:
+ sys.stdout.flush()
+
+ print("\n")
+ p.wait()
+ if(p.returncode != 0):
+ status( "failed with status %d" % p.returncode, True)
+
+
+def getlock_or_exit():
+ global fp
+ pid_file = expanduser(pidfile)
+ fp = open(pid_file, 'w')
+ try:
+ fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
+ fp.write("%s" % (os.getpid()))
+ except IOError as e:
+ # another instance is running
+
+ status("could get lock, another instance running? %s " % str(e), True)
+
+def status(msg, exit=False):
+ print ("%s - %s
\n" % (strftime("%Y-%m-%d %H:%M:%S", gmtime()),msg)) + if exit: + sys.exit(0) + +if __name__=="__main__": + main() +