Update of /cvsroot/pywin32/pywin32
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20331
Modified Files:
Tag: py3k
pywin32_postinstall.py setup.py setup_win32all.py
Log Message:
many more upgrades to py3k syntax
Index: pywin32_postinstall.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/pywin32_postinstall.py,v
retrieving revision 1.25.2.1
retrieving revision 1.25.2.2
diff -C2 -d -r1.25.2.1 -r1.25.2.2
*** pywin32_postinstall.py 1 Oct 2008 14:01:15 -0000 1.25.2.1
--- pywin32_postinstall.py 26 Nov 2008 09:03:28 -0000 1.25.2.2
***************
*** 58,62 ****
root_key_name, winreg.KEY_CREATE_SUB_KEY)
return winreg.HKEY_LOCAL_MACHINE
! except OSError, details:
# Either not exist, or no permissions to create subkey means
# must be HKCU
--- 58,62 ----
root_key_name, winreg.KEY_CREATE_SUB_KEY)
return winreg.HKEY_LOCAL_MACHINE
! except OSError as details:
# Either not exist, or no permissions to create subkey means
# must be HKCU
***************
*** 102,106 ****
csidl = getattr(shellcon, maybe)
return shell.SHGetSpecialFolderPath(0, csidl, False)
! raise ValueError, "%s is an unknown path ID" % (path_name,)
def CopyTo(desc, src, dest):
--- 102,106 ----
csidl = getattr(shellcon, maybe)
return shell.SHGetSpecialFolderPath(0, csidl, False)
! raise ValueError("%s is an unknown path ID" % (path_name,))
def CopyTo(desc, src, dest):
***************
*** 110,114 ****
win32api.CopyFile(src, dest, 0)
return
! except win32api.error, details:
if details.winerror==5: # access denied - user not admin.
raise
--- 110,114 ----
win32api.CopyFile(src, dest, 0)
return
! except win32api.error as details:
if details.winerror==5: # access denied - user not admin.
raise
***************
*** 165,169 ****
root_key.Close()
if verbose:
! print "-> %s\\%s[%s]=%r" % (root_key_name, key_name, value_name, value)
def RegisterCOMObjects(register = 1):
--- 165,169 ----
root_key.Close()
if verbose:
! print("-> %s\\%s[%s]=%r" % (root_key_name, key_name, value_name, value))
def RegisterCOMObjects(register = 1):
***************
*** 218,222 ****
try:
winreg.DeleteKey(classes_root, key)
! except OSError, why:
winerror = getattr(why, 'winerror', why.errno)
if winerror != 2: # file not found
--- 218,222 ----
try:
winreg.DeleteKey(classes_root, key)
! except OSError as why:
winerror = getattr(why, 'winerror', why.errno)
if winerror != 2: # file not found
***************
*** 296,300 ****
files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
if not files:
! raise RuntimeError, "No system files to copy!!"
# Try the system32 directory first - if that fails due to "access denied",
# it implies a non-admin user, and we use sys.prefix
--- 296,300 ----
files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
if not files:
! raise RuntimeError("No system files to copy!!")
# Try the system32 directory first - if that fails due to "access denied",
# it implies a non-admin user, and we use sys.prefix
***************
*** 308,312 ****
CopyTo("installing %s" % base, fname, dst)
if verbose:
! print "Copied %s to %s" % (base, dst)
# Register the files with the uninstaller
file_created(dst)
--- 308,312 ----
CopyTo("installing %s" % base, fname, dst)
if verbose:
! print("Copied %s to %s" % (base, dst))
# Register the files with the uninstaller
file_created(dst)
***************
*** 322,326 ****
if worked:
break
! except win32api.error, details:
if details.winerror==5:
# access denied - user not admin - try sys.prefix dir,
--- 322,326 ----
if worked:
break
! except win32api.error as details:
if details.winerror==5:
# access denied - user not admin - try sys.prefix dir,
***************
*** 332,342 ****
"reinstall this software as an Administrator" \
% dst
! print msg
! raise RuntimeError, msg
continue
raise
else:
! raise RuntimeError, \
! "You don't have enough permissions to install the system files"
# Pythonwin 'compiles' config files - record them for uninstall.
--- 332,342 ----
"reinstall this software as an Administrator" \
% dst
! print(msg)
! raise RuntimeError(msg)
continue
raise
else:
! raise RuntimeError(
! "You don't have enough permissions to install the system files")
# Pythonwin 'compiles' config files - record them for uninstall.
***************
*** 349,359 ****
try:
RegisterCOMObjects()
! except win32api.error, details:
if details[0]!=5: # ERROR_ACCESS_DENIED
raise
! print "You do not have the permissions to install COM objects."
! print "The sample COM objects were not registered."
except:
! print "FAILED to register the Python COM objects"
traceback.print_exc()
--- 349,359 ----
try:
RegisterCOMObjects()
! except win32api.error as details:
if details[0]!=5: # ERROR_ACCESS_DENIED
raise
! print("You do not have the permissions to install COM objects.")
! print("The sample COM objects were not registered.")
except:
! print("FAILED to register the Python COM objects")
traceback.print_exc()
***************
*** 369,374 ****
SetPyKeyVal("Help\\Pythonwin Reference", None, chm_file)
else:
! print "NOTE: PyWin32.chm can not be located, so has not " \
! "been registered"
# Register Pythonwin in context menu
--- 369,374 ----
SetPyKeyVal("Help\\Pythonwin Reference", None, chm_file)
else:
! print("NOTE: PyWin32.chm can not be located, so has not " \
! "been registered")
# Register Pythonwin in context menu
***************
*** 376,384 ****
RegisterPythonwin()
except:
! print 'Failed to register pythonwin as editor'
traceback.print_exc()
else:
if verbose:
! print 'Pythonwin has been registered in context menu'
# Create the win32com\gen_py directory.
--- 376,384 ----
RegisterPythonwin()
except:
! print('Failed to register pythonwin as editor')
traceback.print_exc()
else:
if verbose:
! print('Pythonwin has been registered in context menu')
# Create the win32com\gen_py directory.
***************
*** 386,390 ****
if not os.path.isdir(make_dir):
if verbose:
! print "Creating directory", make_dir
directory_created(make_dir)
os.mkdir(make_dir)
--- 386,390 ----
if not os.path.isdir(make_dir):
if verbose:
! print("Creating directory", make_dir)
directory_created(make_dir)
os.mkdir(make_dir)
***************
*** 403,407 ****
file_created(dst)
if verbose:
! print "Shortcut for Pythonwin created"
# And the docs.
dst = os.path.join(fldr, "Python for Windows Documentation.lnk")
--- 403,407 ----
file_created(dst)
if verbose:
! print("Shortcut for Pythonwin created")
# And the docs.
dst = os.path.join(fldr, "Python for Windows Documentation.lnk")
***************
*** 410,419 ****
file_created(dst)
if verbose:
! print "Shortcut to documentation created"
else:
if verbose:
! print "Can't install shortcuts - %r is not a folder" % (fldr,)
! except Exception, details:
! print details
# Check the MFC dll exists - it is doesn't, point them at it
--- 410,419 ----
file_created(dst)
if verbose:
! print("Shortcut to documentation created")
else:
if verbose:
! print("Can't install shortcuts - %r is not a folder" % (fldr,))
! except Exception as details:
! print(details)
# Check the MFC dll exists - it is doesn't, point them at it
***************
*** 432,443 ****
win32api.SearchPath(None, mfc_dll)
except win32api.error:
! print "*" * 20, "WARNING", "*" * 20
! print "It appears that the MFC DLL '%s' is not installed" % (mfc_dll,)
! print "Pythonwin will not work without this DLL, and I haven't had the"
! print "time to package it in with the installer."
! print
! print "You can download this DLL from:"
! print "http://starship.python.net/crew/mhammond/win32/"
! print "*" * 50
# importing win32com.client ensures the gen_py dir created - not strictly
--- 432,443 ----
win32api.SearchPath(None, mfc_dll)
except win32api.error:
! print("*" * 20, "WARNING", "*" * 20)
! print("It appears that the MFC DLL '%s' is not installed" % (mfc_dll,))
! print("Pythonwin will not work without this DLL, and I haven't had the")
! print("time to package it in with the installer.")
! print()
! print("You can download this DLL from:")
! print("http://starship.python.net/crew/mhammond/win32/")
! print("*" * 50)
# importing win32com.client ensures the gen_py dir created - not strictly
***************
*** 448,452 ****
# Don't let this error sound fatal
pass
! print "The pywin32 extensions were successfully installed."
def uninstall():
--- 448,452 ----
# Don't let this error sound fatal
pass
! print("The pywin32 extensions were successfully installed.")
def uninstall():
***************
*** 460,473 ****
try:
RegisterCOMObjects(False)
! except Exception, why:
! print "Failed to unregister COM objects:", why
try:
RegisterPythonwin(False)
! except Exception, why:
! print "Failed to unregister Pythonwin:", why
else:
if verbose:
! print 'Unregistered Pythonwin'
try:
--- 460,473 ----
try:
RegisterCOMObjects(False)
! except Exception as why:
! print("Failed to unregister COM objects:", why)
try:
RegisterPythonwin(False)
! except Exception as why:
! print("Failed to unregister Pythonwin:", why)
else:
if verbose:
! print('Unregistered Pythonwin')
try:
***************
*** 477,481 ****
shutil.rmtree(gen_dir)
if verbose:
! print "Removed directory", gen_dir
# Remove pythonwin compiled "config" files.
--- 477,481 ----
shutil.rmtree(gen_dir)
if verbose:
! print("Removed directory", gen_dir)
# Remove pythonwin compiled "config" files.
***************
*** 483,488 ****
for fname in glob.glob(os.path.join(pywin_dir, "*.cfc")):
os.remove(fname)
! except Exception, why:
! print "Failed to remove misc files:", why
try:
--- 483,488 ----
for fname in glob.glob(os.path.join(pywin_dir, "*.cfc")):
os.remove(fname)
! except Exception as why:
! print("Failed to remove misc files:", why)
try:
***************
*** 493,499 ****
os.remove(fqlink)
if verbose:
! print "Removed", link
! except Exception, why:
! print "Failed to remove shortcuts:", why
# Now remove the system32 files.
files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
--- 493,499 ----
os.remove(fqlink)
if verbose:
! print("Removed", link)
! except Exception as why:
! print("Failed to remove shortcuts:", why)
# Now remove the system32 files.
files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
***************
*** 512,522 ****
worked = 1
if verbose:
! print "Removed file %s" % (dst)
except Exception:
! print "FAILED to remove", dst
if worked:
break
! except Exception, why:
! print "FAILED to remove system files:", why
def usage():
--- 512,522 ----
worked = 1
if verbose:
! print("Removed file %s" % (dst))
except Exception:
! print("FAILED to remove", dst)
if worked:
break
! except Exception as why:
! print("FAILED to remove system files:", why)
def usage():
***************
*** 533,537 ****
-quiet : Don't display progress messages.
"""
! print msg.strip() % os.path.basename(sys.argv[0])
# NOTE: If this script is run from inside the bdist_wininst created
--- 533,537 ----
-quiet : Don't display progress messages.
"""
! print(msg.strip() % os.path.basename(sys.argv[0]))
# NOTE: If this script is run from inside the bdist_wininst created
***************
*** 578,582 ****
uninstall()
else:
! print "Unknown option:", arg
usage()
sys.exit(0)
--- 578,582 ----
uninstall()
else:
! print("Unknown option:", arg)
usage()
sys.exit(0)
Index: setup.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/setup.py,v
retrieving revision 1.81.2.6
retrieving revision 1.81.2.7
diff -C2 -d -r1.81.2.6 -r1.81.2.7
*** setup.py 26 Nov 2008 07:17:38 -0000 1.81.2.6
--- setup.py 26 Nov 2008 09:03:28 -0000 1.81.2.7
***************
*** 102,108 ****
class Log:
def debug(self, msg, *args):
! print msg % args
def info(self, msg, *args):
! print msg % args
log = Log()
--- 102,108 ----
class Log:
def debug(self, msg, *args):
! print(msg % args)
def info(self, msg, *args):
! print(msg % args)
log = Log()
***************
*** 120,124 ****
pywin32_version="%d.%d.%s" % (sys.version_info[0], sys.version_info[1],
build_id_patch)
! print "Building pywin32", pywin32_version
try:
--- 120,124 ----
pywin32_version="%d.%d.%s" % (sys.version_info[0], sys.version_info[1],
build_id_patch)
! print("Building pywin32", pywin32_version)
try:
***************
*** 150,154 ****
if sdkdir:
if DEBUG:
! print "PSDK: try %MSSdk%: '%s'" % sdkdir
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
--- 150,154 ----
if sdkdir:
if DEBUG:
! print("PSDK: try %MSSdk%: '%s'" % sdkdir)
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
***************
*** 165,170 ****
else:
if DEBUG:
! print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\
! "\Directories\Install Dir': '%s'" % sdkdir
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
--- 165,170 ----
else:
if DEBUG:
! print(r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\
! "\Directories\Install Dir': '%s'" % sdkdir)
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
***************
*** 186,192 ****
else:
if DEBUG:
! print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\
"\InstallSDKs\%s\Install Dir': '%s'"\
! % (guid, sdkdir)
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
--- 186,192 ----
else:
if DEBUG:
! print(r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\
"\InstallSDKs\%s\Install Dir': '%s'"\
! % (guid, sdkdir))
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
***************
*** 203,208 ****
else:
if DEBUG:
! print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDKs"\
! "\Windows\CurrentInstallFolder': '%s'" % sdkdir
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
--- 203,208 ----
else:
if DEBUG:
! print(r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDKs"\
! "\Windows\CurrentInstallFolder': '%s'" % sdkdir)
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
***************
*** 216,220 ****
for sdkdir in defaultlocs:
if DEBUG:
! print "PSDK: try default location: '%s'" % sdkdir
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
--- 216,220 ----
for sdkdir in defaultlocs:
if DEBUG:
! print("PSDK: try default location: '%s'" % sdkdir)
if os.path.isfile(os.path.join(sdkdir, landmark)):
return sdkdir
***************
*** 580,585 ****
f.write("%s\n" % build_id)
f.close()
! except EnvironmentError, why:
! print "Failed to open '%s': %s" % (ver_fname, why)
class my_build_ext(build_ext):
--- 580,585 ----
f.write("%s\n" % build_id)
f.close()
! except EnvironmentError as why:
! print("Failed to open '%s': %s" % (ver_fname, why))
class my_build_ext(build_ext):
***************
*** 853,857 ****
self.excluded_extensions.append((ext, why))
assert why, "please give a reason, or None"
! print "Skipping %s: %s" % (ext.name, why)
continue
--- 853,857 ----
self.excluded_extensions.append((ext, why))
assert why, "please give a reason, or None"
! print("Skipping %s: %s" % (ext.name, why))
continue
***************
*** 915,920 ****
self.copy_file(
os.path.join(mfc_dir, f), target_dir)
! except (EnvironmentError, RuntimeError), exc:
! print "Can't find an installed VC for the MFC DLLs:", exc
--- 915,920 ----
self.copy_file(
os.path.join(mfc_dir, f), target_dir)
! except (EnvironmentError, RuntimeError) as exc:
! print("Can't find an installed VC for the MFC DLLs:", exc)
***************
*** 1042,1046 ****
self.excluded_extensions.append((ext, why))
assert why, "please give a reason, or None"
! print "Skipping %s: %s" % (ext.name, why)
return
self.current_extension = ext
--- 1042,1046 ----
self.excluded_extensions.append((ext, why))
assert why, "please give a reason, or None"
! print("Skipping %s: %s" % (ext.name, why))
return
self.current_extension = ext
***************
*** 1231,1235 ****
if not os.path.isfile(filename):
raise RuntimeError("Can't find '%s'" % (filename,))
! print "Executing post install script..."
# What executable to use? This one I guess.
os.spawnl(os.P_NOWAIT, sys.executable,
--- 1231,1235 ----
if not os.path.isfile(filename):
raise RuntimeError("Can't find '%s'" % (filename,))
! print("Executing post install script...")
# What executable to use? This one I guess.
os.spawnl(os.P_NOWAIT, sys.executable,
***************
*** 1331,1335 ****
try:
self.spawn(args)
! except DistutilsExecError, msg:
log.info("VersionStamp failed: %s", msg)
ok = False
--- 1331,1335 ----
try:
self.spawn(args)
! except DistutilsExecError as msg:
log.info("VersionStamp failed: %s", msg)
ok = False
***************
*** 1371,1375 ****
installobj = self.distribution.get_command_obj('install')
self.install_dir = installobj.install_lib
! print 'Installing data files to %s' % self.install_dir
install_data.finalize_options(self)
--- 1371,1375 ----
installobj = self.distribution.get_command_obj('install')
self.install_dir = installobj.install_lib
! print('Installing data files to %s' % self.install_dir)
install_data.finalize_options(self)
***************
*** 1845,1849 ****
try:
temp = convert_data_files([file])
! except RuntimeError, details:
if not str(details.args[0]).startswith("No file"):
raise
--- 1845,1849 ----
try:
temp = convert_data_files([file])
! except RuntimeError as details:
if not str(details.args[0]).startswith("No file"):
raise
***************
*** 1856,1861 ****
if len(sys.argv)==1:
# distutils will print usage - print our docstring first.
! print __doc__
! print "Standard usage information follows:"
packages=['win32com',
--- 1856,1861 ----
if len(sys.argv)==1:
# distutils will print usage - print our docstring first.
! print(__doc__)
! print("Standard usage information follows:")
packages=['win32com',
***************
*** 2040,2048 ****
excluded_extensions = dist.command_obj['build_ext'].excluded_extensions
if excluded_extensions:
! print "*** NOTE: The following extensions were NOT %s:" % what_string
for ext, why in excluded_extensions:
! print " %s: %s" % (ext.name, why)
! print "For more details on installing the correct libraries and headers,"
! print "please execute this script with no arguments (or see the docstring)"
else:
! print "All extension modules %s OK" % (what_string,)
--- 2040,2048 ----
excluded_extensions = dist.command_obj['build_ext'].excluded_extensions
if excluded_extensions:
! print("*** NOTE: The following extensions were NOT %s:" % what_string)
for ext, why in excluded_extensions:
! print(" %s: %s" % (ext.name, why))
! print("For more details on installing the correct libraries and headers,")
! print("please execute this script with no arguments (or see the docstring)")
else:
! print("All extension modules %s OK" % (what_string,))
Index: setup_win32all.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Attic/setup_win32all.py,v
retrieving revision 1.39
retrieving revision 1.39.4.1
diff -C2 -d -r1.39 -r1.39.4.1
*** setup_win32all.py 18 Oct 2004 06:04:21 -0000 1.39
--- setup_win32all.py 26 Nov 2008 09:03:28 -0000 1.39.4.1
***************
*** 1,5 ****
# The build script used to be called setup_win32all.py
# We will remove this in a few versions, but give people the hint
! print "Please use 'setup.py' instead of 'setup_win32all.py'"
import sys, os
mydir=os.path.dirname(sys.argv[0])
--- 1,5 ----
# The build script used to be called setup_win32all.py
# We will remove this in a few versions, but give people the hint
! print("Please use 'setup.py' instead of 'setup_win32all.py'")
import sys, os
mydir=os.path.dirname(sys.argv[0])
|