-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdb1f5d
commit f64161d
Showing
1 changed file
with
69 additions
and
32 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 |
---|---|---|
@@ -1,32 +1,69 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use CGI; | ||
my $r = new CGI; | ||
|
||
print $r->header(); | ||
print "<p>pulling repo...<br/>"; | ||
system 'git fetch origin && git reset --hard origin/master'; | ||
system 'git submodule update --init --recursive'; | ||
print "<br/>done.</p>"; | ||
|
||
print "<p>building documentation...<br/>"; | ||
chdir ".."; | ||
|
||
my $status = system('/bin/bash', '-c', ' | ||
source venv/bin/activate && | ||
poetry install --only docs && | ||
sphinx-build -M html underactuated /tmp/underactuated_doc && | ||
rm -rf book/python && | ||
cp -r /tmp/underactuated_doc/html book/python | ||
'); | ||
|
||
if ($status == 0) { | ||
print "<br/>done.</p>"; | ||
} else { | ||
print "<br/>Error occurred: $status</p>"; | ||
} | ||
|
||
print $r->end_html; | ||
#!/usr/bin/env python3 | ||
|
||
import cgitb | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
# Write to a debug file to verify script execution | ||
with open("/tmp/cgi_debug.log", "w") as f: | ||
f.write(f"Script started\n") | ||
f.write(f"Interpreter: {sys.executable}\n") | ||
f.write(f"Working dir: {os.getcwd()}\n") | ||
|
||
# Enable CGI traceback with file logging | ||
cgitb.enable(display=1, logdir="/tmp") | ||
|
||
try: | ||
print("Content-Type: text/html\n") | ||
print("<html><body>") | ||
|
||
print("<p>Current working directory: " + os.getcwd() + "</p>") | ||
print("<p>Python version: " + sys.version + "</p>") | ||
|
||
print("<p>pulling repo...<br/>") | ||
# Capture output from git commands | ||
result = subprocess.run( | ||
["git", "fetch", "origin"], capture_output=True, text=True, check=True | ||
) | ||
result = subprocess.run( | ||
["git", "reset", "--hard", "origin/master"], | ||
capture_output=True, | ||
text=True, | ||
check=True, | ||
) | ||
result = subprocess.run( | ||
["git", "submodule", "update", "--init", "--recursive"], | ||
capture_output=True, | ||
text=True, | ||
check=True, | ||
) | ||
print("<br/>done.</p>") | ||
|
||
print("<p>building documentation...<br/>") | ||
os.chdir("..") | ||
|
||
subprocess.run( | ||
[ | ||
"/bin/bash", | ||
"-c", | ||
"source venv/bin/activate && " | ||
"poetry install --only docs && " | ||
"sphinx-build -M html underactuated /tmp/underactuated_doc && " | ||
"rm -rf book/python && " | ||
"cp -r /tmp/underactuated_doc/html book/python", | ||
], | ||
check=True, | ||
) | ||
print("<br/>done.</p>") | ||
|
||
except Exception as e: | ||
print("<p>Error: " + str(e) + "</p>") | ||
import traceback | ||
|
||
print("<pre>") | ||
traceback.print_exc() | ||
print("</pre>") | ||
|
||
finally: | ||
print("</body></html>") |