mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Give in to tabnanny
This commit is contained in:
parent
8053d89f7b
commit
71543e13db
2 changed files with 106 additions and 106 deletions
|
@ -21,17 +21,17 @@ import win32con
|
|||
def rmkey(parent, key, level=0):
|
||||
sep = " "*level
|
||||
try:
|
||||
handle = win32api.RegOpenKey(parent, key)
|
||||
handle = win32api.RegOpenKey(parent, key)
|
||||
except win32api.error, msg:
|
||||
print sep + "No key", `key`
|
||||
return
|
||||
print sep + "No key", `key`
|
||||
return
|
||||
print sep + "Removing key", key
|
||||
while 1:
|
||||
try:
|
||||
subkey = win32api.RegEnumKey(handle, 0)
|
||||
except win32api.error, msg:
|
||||
break
|
||||
rmkey(handle, subkey, level+1)
|
||||
try:
|
||||
subkey = win32api.RegEnumKey(handle, 0)
|
||||
except win32api.error, msg:
|
||||
break
|
||||
rmkey(handle, subkey, level+1)
|
||||
win32api.RegCloseKey(handle)
|
||||
win32api.RegDeleteKey(parent, key)
|
||||
print sep + "Done with", key
|
||||
|
@ -47,25 +47,25 @@ def rmtree(dir, level=0):
|
|||
sep = " "*level
|
||||
print sep+"rmtree", dir
|
||||
for name in os.listdir(dir):
|
||||
if level == 0 and \
|
||||
os.path.normcase(name) == os.path.normcase("uninstall.bat"):
|
||||
continue
|
||||
fn = os.path.join(dir, name)
|
||||
if os.path.isdir(fn):
|
||||
rmtree(fn, level+1)
|
||||
else:
|
||||
try:
|
||||
os.remove(fn)
|
||||
except os.error, msg:
|
||||
print sep+" can't remove", `fn`, msg
|
||||
else:
|
||||
print sep+" removed", `fn`
|
||||
if level == 0 and \
|
||||
os.path.normcase(name) == os.path.normcase("uninstall.bat"):
|
||||
continue
|
||||
fn = os.path.join(dir, name)
|
||||
if os.path.isdir(fn):
|
||||
rmtree(fn, level+1)
|
||||
else:
|
||||
try:
|
||||
os.remove(fn)
|
||||
except os.error, msg:
|
||||
print sep+" can't remove", `fn`, msg
|
||||
else:
|
||||
print sep+" removed", `fn`
|
||||
try:
|
||||
os.rmdir(dir)
|
||||
os.rmdir(dir)
|
||||
except os.error, msg:
|
||||
print sep+"can't remove directory", `dir`, msg
|
||||
print sep+"can't remove directory", `dir`, msg
|
||||
else:
|
||||
print sep+"removed directory", `dir`
|
||||
print sep+"removed directory", `dir`
|
||||
|
||||
pwd = os.getcwd()
|
||||
scriptdir = os.path.normpath(os.path.join(pwd, os.path.dirname(sys.argv[0])))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue