hgweb.cgi
author Adrian Buehlmann <adrian@cadifra.com>
Tue, 08 May 2012 11:20:07 +0200
branchstable
changeset 16604 48e42f984074
parent 15475 85cba926cb59
child 26421 4b0fc75f9403
permissions -rwxr-xr-x
parsers: statically initializing tp_new to PyType_GenericNew is not portable As detailed on http://docs.python.org/extending/newtypes.html (quote): "In this case, we can just use the default implementation provided by the API function PyType_GenericNew(). We’d like to just assign this to the tp_new slot, but we can’t, for portability sake. On some platforms or compilers, we can’t statically initialize a structure member with a function defined in another C module, so, instead, we’ll assign the tp_new slot in the module initialization function just before calling PyType_Ready()." Fixes "gcc (GCC) 3.4.5 (mingw-vista special r3)" complaining with: mercurial/parsers.c:1096: error: initializer element is not constant mercurial/parsers.c:1096: error: (near initialization for `indexType.tp_new')

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/path/to/repo/or/config"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)