Пример #1
0
def manage_isapi():
    # If run from the command-line, install ourselves.
    from isapi.install import ISAPIParameters, ScriptMapParams, VirtualDirParameters, HandleCommandLine
    params = ISAPIParameters()
    # Setup the virtual directories - this is a list of directories our
    # extension uses - in this case only 1.
    # Each extension has a "script map" - this is the mapping of ISAPI
    # extensions.
    sm = [ScriptMapParams(Extension="*", Flags=0)]
    vd = VirtualDirParameters(Name="isapi-openid",
                              Description="ISAPI-WSGI OpenID Provider",
                              ScriptMaps=sm,
                              ScriptMapUpdate="replace")
    params.VirtualDirs = [vd]
    HandleCommandLine(params)
Пример #2
0
def main():
    parser = OptionParser(usage='%prog [options] install | remove',
                          prog=program_name())
    parser.add_option('-d', '--debug', action='store_true')
    parser.add_option('-m',
                      '--module',
                      dest='module',
                      help='use application module:classname')
    parser.set_default('debug', False)
    opts, args = parser.parse_args()
    sys.argv[1:] = args
    if not opts.module:
        parser.error('you need to specify --module')
    mobj = re_module.match(opts.module)
    if not mobj:
        parser.error('specify --module as module:classname')
    opts.modname = mobj.group(1)
    opts.classname = mobj.group(2)
    module = import_module(opts.modname)
    if module is None:
        parser.error('could not load module %s' % modname)
    if not hasattr(module, opts.classname):
        parser.error('could not load class %s from module' % opts.classname)
    params = ISAPIParameters()
    sm = ScriptMapParams(Extension='*', Flags=0)
    vd = VirtualDirParameters(Name='api',
                              Headers=None,
                              Description='python-rest',
                              ScriptMaps=[sm],
                              ScriptMapUpdate='replace')
    params.VirtualDirs = [vd]
    # A DLL with the name _filename.dll is installed in the same directory as
    # the handler file.
    fname = inspect.getfile(module)
    dname, fname = os.path.split(fname)
    fname, ext = os.path.splitext(fname)
    fname = os.path.join(dname, '_%s_isapi.py' % fname)
    create_isapi_handler(fname, opts)
    HandleCommandLine(params, conf_module_name=fname)
    # Fix up some common errors
    create_egg_cache(eggdir)
    dir = os.path.join(sys.exec_prefix, 'Lib', 'site-packages')
    fix_egg_permissions(dir)
    update_web_config(webroot)
Пример #3
0
def __ExtensionFactory__():
    ##    from paste.deploy import loadapp
    ##     from paste.script.util.logging_config import fileConfig

    # <INSTALLDIR>\config\mapproxy.yaml
    yaml_file = os.path.abspath(
        os.path.join(mapproxy_root_dir, r'config', r'mapproxy.yaml'))

    from mapproxy.wsgiapp import make_wsgi_app
    # application = make_wsgi_app(r'C:\mapproxy\mapproxy.yaml')
    application = make_wsgi_app(yaml_file)

    import isapi_wsgi
    return isapi_wsgi.ISAPIThreadPoolHandler(application)


# ISAPI installation
if __name__ == '__main__':
    from isapi.install import ISAPIParameters, ScriptMapParams, VirtualDirParameters, HandleCommandLine

    params = ISAPIParameters()
    sm = [ScriptMapParams(Extension="*", Flags=0)]

    vd = VirtualDirParameters(Name="mapproxy",
                              Description="MapProxy",
                              ScriptMaps=sm,
                              ScriptMapUpdate="replace")

    params.VirtualDirs = [vd]
    HandleCommandLine(params)