[Checkins] SVN: z3c.recipe.winservice/trunk/ - virtualenv creates no pythonw.exe -- fallback to python.exe
Adam Groszer
agroszer at gmail.com
Wed Mar 25 04:41:31 EDT 2009
Log message for revision 98356:
- virtualenv creates no pythonw.exe -- fallback to python.exe
- tested on winXP pro workstation
Changed:
U z3c.recipe.winservice/trunk/CHANGES.txt
U z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/README.txt
U z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/winservice.in
-=-
Modified: z3c.recipe.winservice/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.winservice/trunk/CHANGES.txt 2009-03-25 07:55:15 UTC (rev 98355)
+++ z3c.recipe.winservice/trunk/CHANGES.txt 2009-03-25 08:41:31 UTC (rev 98356)
@@ -11,6 +11,20 @@
- Slight changes to service manager
+- virtualenv creates no pythonw.exe -- fallback to python.exe
+
+- tested on winXP pro workstation:
+ - from service manager:
+ - service start: OK
+ - service stop: OK
+ - service restart: OK
+ - net
+ - net start: OK
+ - net stop: OK
+ - from instance:
+ - ``ZMI restart``: OK (restarts)
+ - task manager kill ``python.exe``: OK (starts again)
+
Version 0.5.0 (2008-04-12)
--------------------------
Modified: z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/README.txt
===================================================================
--- z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/README.txt 2009-03-25 07:55:15 UTC (rev 98355)
+++ z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/README.txt 2009-03-25 08:41:31 UTC (rev 98356)
@@ -191,6 +191,9 @@
PYTHONW = os.path.join(PYTHONDIR, 'pythonw.exe')
PYTHONSERVICE_EXE = r'%s\Lib\site-packages\win32\pythonservice.exe' % PYTHONDIR
TOSTART = r'/sample-buildout/bin/app-script.py'
+ SERVICE_NAME = '..._bin_app_script_py'
+ SERVICE_DISPLAY_NAME = r'Zope 3 Windows Service'
+ SERVICE_DESCRIPTION = r'Zope 3 Windows Service description'
<BLANKLINE>
<BLANKLINE>
# the max seconds we're allowed to spend backing off
@@ -242,20 +245,26 @@
# each instance. The below-defined start_cmd (and _svc_display_name_
# and _svc_name_) are just examples.
<BLANKLINE>
- _svc_name_ = '..._bin_app_script_py'
- _svc_display_name_ = r'Zope 3 Windows Service'
- _svc_description_ = r'Zope 3 Windows Service description'
+ _svc_name_ = SERVICE_NAME
+ _svc_display_name_ = SERVICE_DISPLAY_NAME
+ _svc_description_ = SERVICE_DESCRIPTION
<BLANKLINE>
_exe_name_ = PYTHONSERVICE_EXE
- start_cmd = '"%s" "%s"' % (PYTHONW, TOSTART)
+ start_cmd = ''
<BLANKLINE>
def __init__(self, args):
+ python = PYTHONW
if not os.path.exists(PYTHONW):
- raise OSError("%s does not exist" % PYTHON)
+ #virtualenv misses pythonw.exe, fall back to python.exe
+ python = PYTHON
+ if not os.path.exists(PYTHON):
+ raise OSError("%s or %s does not exist" % (PYTHONW, PYTHON))
<BLANKLINE>
if not os.path.exists(TOSTART):
raise OSError("%s does not exist" % TOSTART)
<BLANKLINE>
+ self.start_cmd = '"%s" "%s"' % (python, TOSTART)
+ <BLANKLINE>
win32serviceutil.ServiceFramework.__init__(self, args)
# Create an event which we will use to wait on.
# The "service stop" request will set this event.
@@ -407,6 +416,7 @@
win32serviceutil.HandleCommandLine(Zope3Service)
+
Debug
-----
@@ -460,7 +470,7 @@
>>> cat('bin', 'winservice.py')
##############################################################################
...TOSTART = r'/sample-buildout/bin/app-servicedebug.py'...
- ..._svc_name_ = '...bin_app_script_py'...
+ ...SERVICE_NAME = '...bin_app_script_py'...
The debug script contains a bare catch-all and a logger:
Modified: z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/winservice.in
===================================================================
--- z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/winservice.in 2009-03-25 07:55:15 UTC (rev 98355)
+++ z3c.recipe.winservice/trunk/src/z3c/recipe/winservice/winservice.in 2009-03-25 08:41:31 UTC (rev 98356)
@@ -90,6 +90,9 @@
PYTHONW = os.path.join(PYTHONDIR, 'pythonw.exe')
PYTHONSERVICE_EXE = r'%s\Lib\site-packages\win32\pythonservice.exe' % PYTHONDIR
TOSTART = r'<<RUNZOPE>>'
+SERVICE_NAME = '<<SERVICE_NAME>>'
+SERVICE_DISPLAY_NAME = r'<<SERVICE_DISPLAY_NAME>>'
+SERVICE_DESCRIPTION = r'<<SERVICE_DESCRIPTION>>'
# the max seconds we're allowed to spend backing off
@@ -141,20 +144,26 @@
# each instance. The below-defined start_cmd (and _svc_display_name_
# and _svc_name_) are just examples.
- _svc_name_ = '<<SERVICE_NAME>>'
- _svc_display_name_ = r'<<SERVICE_DISPLAY_NAME>>'
- _svc_description_ = r'<<SERVICE_DESCRIPTION>>'
+ _svc_name_ = SERVICE_NAME
+ _svc_display_name_ = SERVICE_DISPLAY_NAME
+ _svc_description_ = SERVICE_DESCRIPTION
_exe_name_ = PYTHONSERVICE_EXE
- start_cmd = '"%s" "%s"' % (PYTHONW, TOSTART)
+ start_cmd = ''
def __init__(self, args):
+ python = PYTHONW
if not os.path.exists(PYTHONW):
- raise OSError("%s does not exist" % PYTHON)
+ #virtualenv misses pythonw.exe, fall back to python.exe
+ python = PYTHON
+ if not os.path.exists(PYTHON):
+ raise OSError("%s or %s does not exist" % (PYTHONW, PYTHON))
if not os.path.exists(TOSTART):
raise OSError("%s does not exist" % TOSTART)
+ self.start_cmd = '"%s" "%s"' % (python, TOSTART)
+
win32serviceutil.ServiceFramework.__init__(self, args)
# Create an event which we will use to wait on.
# The "service stop" request will set this event.
More information about the Checkins
mailing list