Update of /cvsroot/pywin32/pywin32/win32/Lib
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29773/win32/Lib
Modified Files:
Tag: py3k
win32evtlogutil.py win32serviceutil.py win32verstamp.py
Log Message:
merge more .py changes from the trunk (via 2to3)
Index: win32verstamp.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32verstamp.py,v
retrieving revision 1.2.4.2
retrieving revision 1.2.4.3
diff -C2 -d -r1.2.4.2 -r1.2.4.3
*** win32verstamp.py 6 Dec 2008 01:48:26 -0000 1.2.4.2
--- win32verstamp.py 11 Dec 2008 05:45:21 -0000 1.2.4.3
***************
*** 48,52 ****
def nullterm(s):
# get raw bytes for a NULL terminated unicode string.
! return (s + '\0').encode('unicode-internal')
def pad32(s, extra=2):
--- 48,52 ----
def nullterm(s):
# get raw bytes for a NULL terminated unicode string.
! return (str(s) + '\0').encode('unicode-internal')
def pad32(s, extra=2):
***************
*** 152,156 ****
is_debug = os.path.splitext(pathname)[0].lower().endswith("_d")
# convert None to blank strings
! for k, v in sdata.items():
if v is None:
sdata[k] = ""
--- 152,156 ----
is_debug = os.path.splitext(pathname)[0].lower().endswith("_d")
# convert None to blank strings
! for k, v in list(sdata.items()):
if v is None:
sdata[k] = ""
Index: win32serviceutil.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32serviceutil.py,v
retrieving revision 1.26.2.4
retrieving revision 1.26.2.5
diff -C2 -d -r1.26.2.4 -r1.26.2.5
*** win32serviceutil.py 27 Nov 2008 11:31:10 -0000 1.26.2.4
--- win32serviceutil.py 11 Dec 2008 05:45:21 -0000 1.26.2.5
***************
*** 354,361 ****
try:
status = win32service.ControlService(hs, win32service.SERVICE_CONTROL_STOP)
! except pywintypes.error as xxx_todo_changeme:
! (hr, name, msg) = xxx_todo_changeme.args
! if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error(hr, name, msg)
for i in range(waitSecs):
status = win32service.QueryServiceStatus(hs)
--- 354,360 ----
try:
status = win32service.ControlService(hs, win32service.SERVICE_CONTROL_STOP)
! except pywintypes.error as exc:
! if exc.winerror!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise
for i in range(waitSecs):
status = win32service.QueryServiceStatus(hs)
***************
*** 408,417 ****
try:
StopService(serviceName, machine)
! except pywintypes.error as xxx_todo_changeme1:
! # Allow only "service not running" error
! (hr, name, msg) = xxx_todo_changeme1.args
# Allow only "service not running" error
! if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error(hr, name, msg)
# Give it a few goes, as the service may take time to stop
for i in range(waitSeconds):
--- 407,414 ----
try:
StopService(serviceName, machine)
! except pywintypes.error as exc:
# Allow only "service not running" error
! if exc.winerror!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise
# Give it a few goes, as the service may take time to stop
for i in range(waitSeconds):
***************
*** 419,425 ****
StartService(serviceName, args, machine)
break
! except pywintypes.error as xxx_todo_changeme2:
! (hr, name, msg) = xxx_todo_changeme2.args
! if hr!=winerror.ERROR_SERVICE_ALREADY_RUNNING:
raise
win32api.Sleep(1000)
--- 416,421 ----
StartService(serviceName, args, machine)
break
! except pywintypes.error as exc:
! if exc.winerror!=winerror.ERROR_SERVICE_ALREADY_RUNNING:
raise
win32api.Sleep(1000)
***************
*** 577,583 ****
if waitSecs:
WaitForServiceStatus(serviceName, win32service.SERVICE_RUNNING, waitSecs)
! except win32service.error as xxx_todo_changeme3:
! (hr, fn, msg) = xxx_todo_changeme3.args
! print("Error starting service: %s" % msg)
elif arg=="restart":
--- 573,578 ----
if waitSecs:
WaitForServiceStatus(serviceName, win32service.SERVICE_RUNNING, waitSecs)
! except win32service.error as exc:
! print("Error starting service: %s" % exc.strerror)
elif arg=="restart":
***************
*** 644,653 ****
customOptionHandler(*(opts,))
print("Service installed")
! except win32service.error as xxx_todo_changeme4:
! (hr, fn, msg) = xxx_todo_changeme4.args
! if hr==winerror.ERROR_SERVICE_EXISTS:
arg = "update" # Fall through to the "update" param!
else:
! print("Error installing service: %s (%d)" % (msg, hr))
err = hr
except ValueError as msg: # Can be raised by custom option handler.
--- 639,647 ----
customOptionHandler(*(opts,))
print("Service installed")
! except win32service.error as exc:
! if exc.winerror==winerror.ERROR_SERVICE_EXISTS:
arg = "update" # Fall through to the "update" param!
else:
! print("Error installing service: %s (%d)" % (exc.strerror, exc.winerror))
err = hr
except ValueError as msg: # Can be raised by custom option handler.
***************
*** 688,694 ****
customOptionHandler(*(opts,))
print("Service updated")
! except win32service.error as xxx_todo_changeme5:
! (hr, fn, msg) = xxx_todo_changeme5.args
! print("Error changing service configuration: %s (%d)" % (msg,hr))
err = hr
--- 682,687 ----
customOptionHandler(*(opts,))
print("Service updated")
! except win32service.error as exc:
! print("Error changing service configuration: %s (%d)" % (exc.strerror,exc.winerror))
err = hr
***************
*** 699,705 ****
RemoveService(serviceName)
print("Service removed")
! except win32service.error as xxx_todo_changeme6:
! (hr, fn, msg) = xxx_todo_changeme6.args
! print("Error removing service: %s (%d)" % (msg,hr))
err = hr
elif arg=="stop":
--- 692,697 ----
RemoveService(serviceName)
print("Service removed")
! except win32service.error as exc:
! print("Error removing service: %s (%d)" % (exc.strerror,exc.winerror))
err = hr
elif arg=="stop":
***************
*** 711,717 ****
else:
StopService(serviceName)
! except win32service.error as xxx_todo_changeme7:
! (hr, fn, msg) = xxx_todo_changeme7.args
! print("Error stopping service: %s (%d)" % (msg,hr))
err = hr
if not knownArg:
--- 703,708 ----
else:
StopService(serviceName)
! except win32service.error as exc:
! print("Error stopping service: %s (%d)" % (exc.strerror,exc.winerror))
err = hr
if not knownArg:
Index: win32evtlogutil.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32evtlogutil.py,v
retrieving revision 1.10.4.3
retrieving revision 1.10.4.4
diff -C2 -d -r1.10.4.3 -r1.10.4.4
*** win32evtlogutil.py 27 Nov 2008 11:31:07 -0000 1.10.4.3
--- win32evtlogutil.py 11 Dec 2008 05:45:21 -0000 1.10.4.4
***************
*** 60,66 ****
win32api.RegDeleteKey(win32con.HKEY_LOCAL_MACHINE, \
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s" % (eventLogType, appName))
! except win32api.error as xxx_todo_changeme:
! (hr, fn, desc) = xxx_todo_changeme.args
! if hr != winerror.ERROR_FILE_NOT_FOUND:
raise
--- 60,65 ----
win32api.RegDeleteKey(win32con.HKEY_LOCAL_MACHINE, \
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s" % (eventLogType, appName))
! except win32api.error as exc:
! if exc.winerror != winerror.ERROR_FILE_NOT_FOUND:
raise
|