# HG changeset patch # User Thomas De Schampheleire <thomas.de_schamphele...@nokia.com> # Date 1539716904 -7200 # Tue Oct 16 21:08:24 2018 +0200 # Node ID 714cacbf3266d092c7cce3c20e83ae6525d32f9a # Parent 3a3f3ae5620d39f43894afd82ec1a6701e25a2a1 cli: convert 'gearbox install-iis' into 'kallithea-cli iis-install'
diff --git a/docs/installation_iis.rst b/docs/installation_iis.rst --- a/docs/installation_iis.rst +++ b/docs/installation_iis.rst @@ -59,7 +59,7 @@ ISAPI handler The ISAPI handler can be generated using:: - gearbox install-iis -c my.ini --virtualdir=/ + kallithea-cli iis-install --virtualdir=/ my.ini This will generate a ``dispatch.py`` file in the current directory that contains the necessary components to finalize an installation into IIS. Once this file diff --git a/kallithea/bin/kallithea_cli.py b/kallithea/bin/kallithea_cli.py --- a/kallithea/bin/kallithea_cli.py +++ b/kallithea/bin/kallithea_cli.py @@ -19,5 +19,6 @@ from kallithea.bin.kallithea_cli_base im import kallithea.bin.kallithea_cli_cache import kallithea.bin.kallithea_cli_celery import kallithea.bin.kallithea_cli_config +import kallithea.bin.kallithea_cli_iis import kallithea.bin.kallithea_cli_ishell import kallithea.bin.kallithea_cli_repo diff --git a/kallithea/lib/paster_commands/install_iis.py b/kallithea/bin/kallithea_cli_iis.py rename from kallithea/lib/paster_commands/install_iis.py rename to kallithea/bin/kallithea_cli_iis.py --- a/kallithea/lib/paster_commands/install_iis.py +++ b/kallithea/bin/kallithea_cli_iis.py @@ -11,21 +11,15 @@ # # 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 click +from kallithea.bin.kallithea_cli_base import cli +import kallithea.bin.kallithea_cli_util as cli_util import os - -from kallithea.lib.paster_commands.common import BasePasterCommand - +import sys dispath_py_template = '''\ -# Created by Kallithea 'gearbox install-iis' +# Created by Kallithea 'kallithea-cli iis-install' import sys if hasattr(sys, "isapidllhandle"): @@ -60,38 +54,29 @@ if __name__=='__main__': HandleCommandLine(params) ''' - -class Command(BasePasterCommand): - '''Kallithea: Install into IIS using isapi-wsgi''' - - requires_db_session = False +@cli.command() +@cli_util.auto_setup_app(config_only=True) +@click.option('--virtualdir', default='/', + help='The virtual folder to install into on IIS.') +def iis_install(config_file, virtualdir): + """Install into IIS using isapi-wsgi.""" - def take_action(self, args): - config_file = os.path.abspath(args.config_file) - try: - import isapi_wsgi - except ImportError: - self.error('missing requirement: isapi-wsgi not installed') + config_file_abs = os.path.abspath(config_file) - dispatchfile = os.path.join(os.getcwd(), 'dispatch.py') - print 'Writing %s' % dispatchfile - with open(dispatchfile, 'w') as f: - f.write(dispath_py_template % { - 'inifile': config_file.replace('\\', '\\\\'), - 'virtualdir': args.virtualdir, - }) + try: + import isapi_wsgi + except ImportError: + sys.stderr.write('missing requirement: isapi-wsgi not installed\n') + sys.exit(1) - print ('Run \'python "%s" install\' with administrative privileges ' - 'to generate the _dispatch.dll file and install it into the ' - 'default web site') % (dispatchfile,) - - def get_parser(self, prog_name): - parser = super(Command, self).get_parser(prog_name) + dispatchfile = os.path.join(os.getcwd(), 'dispatch.py') + click.echo('Writing %s' % dispatchfile) + with open(dispatchfile, 'w') as f: + f.write(dispath_py_template % { + 'inifile': config_file_abs.replace('\\', '\\\\'), + 'virtualdir': virtualdir, + }) - parser.add_argument('--virtualdir', - action='store', - dest='virtualdir', - default='/', - help='The virtual folder to install into on IIS') - - return parser + click.echo('Run \'python "%s" install\' with administrative privileges ' + 'to generate the _dispatch.dll file and install it into the ' + 'default web site' % dispatchfile) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -158,7 +158,6 @@ setuptools.setup( main = kallithea.config.middleware:make_app [gearbox.commands] - install-iis=kallithea.lib.paster_commands.install_iis:Command make-index=kallithea.lib.paster_commands.make_index:Command make-rcext=kallithea.lib.paster_commands.make_rcextensions:Command setup-db=kallithea.lib.paster_commands.setup_db:Command _______________________________________________ kallithea-general mailing list kallithea-general@sfconservancy.org https://lists.sfconservancy.org/mailman/listinfo/kallithea-general