Files
@ 12ce88eece5f
Branch filter:
Location: kallithea/kallithea/lib/paster_commands/install_iis.py
12ce88eece5f
3.4 KiB
text/x-python
diff: correct handling of links to old filename in renames
There were links to the file at the parent revision ... but if the file had
been renamed, it used the wrong name.
There were links to the file at the parent revision ... but if the file had
been renamed, it used the wrong name.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | # -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
kallithea.lib.paster_commands.install_iis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IIS installation tools for Kallithea
"""
import os
import sys
from paste.script.appinstall import AbstractInstallCommand
from paste.script.command import BadCommand
class Command(AbstractInstallCommand):
default_verbosity = 1
max_args = 1
min_args = 1
summary = 'Setup IIS given a config file'
usage = 'CONFIG_FILE'
description = '''
Script for installing into IIS using isapi-wsgi.
'''
parser = AbstractInstallCommand.standard_parser(
simulate=True, quiet=True, interactive=True)
parser.add_option('--virtualdir',
action='store',
dest='virtualdir',
default='/',
help='The virtual folder to install into on IIS')
def command(self):
config_spec = self.args[0]
if not config_spec.startswith('config:'):
config_spec = 'config:' + config_spec
config_file = config_spec[len('config:'):].split('#', 1)[0]
config_file = os.path.join(os.getcwd(), config_file)
try:
import isapi_wsgi
except ImportError:
raise BadCommand('missing requirement: isapi-wsgi not installed')
file = '''\
# Created by Kallithea install_iis
import sys
if hasattr(sys, "isapidllhandle"):
import win32traceutil
import isapi_wsgi
import os
def __ExtensionFactory__():
from paste.deploy import loadapp
from paste.script.util.logging_config import fileConfig
fileConfig('%(inifile)s')
application = loadapp('config:%(inifile)s')
def app(environ, start_response):
user = environ.get('REMOTE_USER', None)
if user is not None:
os.environ['REMOTE_USER'] = user
return application(environ, start_response)
return isapi_wsgi.ISAPIThreadPoolHandler(app)
if __name__=='__main__':
from isapi.install import *
params = ISAPIParameters()
sm = [ScriptMapParams(Extension="*", Flags=0)]
vd = VirtualDirParameters(Name="%(virtualdir)s",
Description = "Kallithea",
ScriptMaps = sm,
ScriptMapUpdate = "replace")
params.VirtualDirs = [vd]
HandleCommandLine(params)
'''
outdata = file % {
'inifile': config_file.replace('\\', '\\\\'),
'virtualdir': self.options.virtualdir
}
dispatchfile = os.path.join(os.getcwd(), 'dispatch.py')
self.ensure_file(dispatchfile, outdata, False)
print 'Generating %s' % (dispatchfile,)
print ('Run \'python "%s" install\' with administrative privileges '
'to generate the _dispatch.dll file and install it into the '
'default web site') % (dispatchfile,)
|