Updated gitserve.py to work with python 3.x
This commit is contained in:
parent
8e02d05ba9
commit
e518bc9b68
@ -23,14 +23,17 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import commands
|
import subprocess
|
||||||
import traceback
|
|
||||||
|
SCRIPTDIR = os.path.abspath(__file__).rsplit(os.path.sep, 1)[0]
|
||||||
|
GITSERVEPHP = '%s/gitserve.php' % SCRIPTDIR
|
||||||
|
process = subprocess.Popen(['php', GITSERVEPHP, sys.argv[1]],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
output = str.encode("\n").join(process.communicate()).strip()
|
||||||
|
status = process.wait()
|
||||||
|
|
||||||
n = len("/gitserve.py")
|
|
||||||
GITSERVEPHP = '%s/gitserve.php' % traceback.extract_stack(limit=1)[0][0][0:-n]
|
|
||||||
status, output = commands.getstatusoutput('php %s %s' % (GITSERVEPHP, sys.argv[1]))
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
os.execvp('git', ['git', 'shell', '-c', output.strip()])
|
os.execvp('git', ['git', 'shell', '-c', output.strip()])
|
||||||
else:
|
else:
|
||||||
sys.stderr.write("%s\n" % output)
|
sys.stderr.write("%s\n" % output.strip())
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user