X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=git-instaweb.sh;h=7c55229773e2bdb0f138b1180ab22d05c74ff904;hb=f80fcd36751c85b11722f8c7cfd537c28956400e;hp=eec264e6303684c5886804361c630e1572c1fe09;hpb=a9f2d3f200d9d8b6e803c0818b1163226bbc3994;p=platform%2Fupstream%2Fgit.git diff --git a/git-instaweb.sh b/git-instaweb.sh index eec264e..7c55229 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -67,6 +67,13 @@ resolve_full_httpd () { httpd_only="${httpd%% *}" # cut on first space return ;; + *python*) + # server is started by running via generated gitweb.py in + # $fqgitdir/gitweb + full_httpd="$fqgitdir/gitweb/gitweb.py" + httpd_only="${httpd%% *}" # cut on first space + return + ;; esac httpd_only="$(echo $httpd | cut -f1 -d' ')" @@ -110,7 +117,7 @@ start_httpd () { # don't quote $full_httpd, there can be arguments to it (-f) case "$httpd" in - *mongoose*|*plackup*) + *mongoose*|*plackup*|*python*) #These servers don't have a daemon mode so we'll have to fork it $full_httpd "$conf" & #Save the pid before doing anything else (we'll print it later) @@ -595,6 +602,121 @@ EOF rm -f "$conf" } +python_conf() { + # Python's builtin http.server and its CGI support is very limited. + # CGI handler is capable of running CGI script only from inside a directory. + # Trying to set cgi_directories=["/"] will add double slash to SCRIPT_NAME + # and that in turn breaks gitweb's relative link generation. + + # create a simple web root where $fqgitdir/gitweb/$httpd_only is our root + mkdir -p "$fqgitdir/gitweb/$httpd_only/cgi-bin" + # Python http.server follows the symlinks + ln -sf "$root/gitweb.cgi" "$fqgitdir/gitweb/$httpd_only/cgi-bin/gitweb.cgi" + ln -sf "$root/static" "$fqgitdir/gitweb/$httpd_only/" + + # generate a standalone 'python http.server' script in $fqgitdir/gitweb + # This asumes that python is in user's $PATH + # This script is Python 2 and 3 compatible + cat > "$fqgitdir/gitweb/gitweb.py" < "$fqgitdir/gitweb/gitweb_config.perl" <