Remove _handle_win32() method from "create" command class
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 14 Mar 2019 16:53:34 +0100
changeset 12524 8d3952d7124d
parent 12523 4d68d20427de
child 12525 234079d86496
Remove _handle_win32() method from "create" command class This method generates code in a file using etwist module that we are about to drop.
cubicweb/cwctl.py
--- a/cubicweb/cwctl.py	Fri Mar 15 12:12:23 2019 +0100
+++ b/cubicweb/cwctl.py	Thu Mar 14 16:53:34 2019 +0100
@@ -26,7 +26,7 @@
 import sys
 from warnings import warn, filterwarnings
 from os import remove, listdir, system, pathsep
-from os.path import exists, join, isdir, dirname, abspath
+from os.path import exists, join, isdir
 
 try:
     from os import kill, getpgid
@@ -397,7 +397,6 @@
                     config.input_config(section, self.config.config_level)
         # write down configuration
         config.save()
-        self._handle_win32(config, appid)
         print('-> generated config %s' % config.main_config_file())
         # handle i18n files structure
         # in the first cube given
@@ -424,29 +423,6 @@
         if not self.config.no_db_create:
             helper.postcreate(self.config.automatic, self.config.config_level)
 
-    def _handle_win32(self, config, appid):
-        if sys.platform != 'win32':
-            return
-        service_template = """
-import sys
-import win32serviceutil
-sys.path.insert(0, r"%(CWPATH)s")
-
-from cubicweb.etwist.service import CWService
-
-classdict = {'_svc_name_': 'cubicweb-%(APPID)s',
-             '_svc_display_name_': 'CubicWeb ' + '%(CNAME)s',
-             'instance': '%(APPID)s'}
-%(CNAME)sService = type('%(CNAME)sService', (CWService,), classdict)
-
-if __name__ == '__main__':
-    win32serviceutil.HandleCommandLine(%(CNAME)sService)
-"""
-        open(join(config.apphome, 'win32svc.py'), 'wb').write(
-            service_template % {'APPID': appid,
-                                'CNAME': appid.capitalize(),
-                                'CWPATH': abspath(join(dirname(__file__), '..'))})
-
 
 class DeleteInstanceCommand(Command):
     """Delete an instance. Will remove instance's files and