[pywin32-checkins] pywin32/win32/scripts/ce pysynch.py, 1.2, 1.2.4.1
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-11-26 09:03:34
|
Update of /cvsroot/pywin32/pywin32/win32/scripts/ce In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20331/win32/scripts/ce Modified Files: Tag: py3k pysynch.py Log Message: many more upgrades to py3k syntax Index: pysynch.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/scripts/ce/pysynch.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** pysynch.py 8 Mar 2000 09:57:54 -0000 1.2 --- pysynch.py 26 Nov 2008 09:03:30 -0000 1.2.4.1 *************** *** 15,19 **** def print_error(api_exc, msg): hr, fn, errmsg = api_exc ! print "%s - %s(%d)" % (msg, errmsg, hr) def GetFileAttributes(file, local=1): --- 15,19 ---- def print_error(api_exc, msg): hr, fn, errmsg = api_exc ! print("%s - %s(%d)" % (msg, errmsg, hr)) def GetFileAttributes(file, local=1): *************** *** 99,103 **** try: opts, args = getopt.getopt(args, "rv") ! except getopt.error, details: raise InvalidUsage(details) for o, v in opts: --- 99,103 ---- try: opts, args = getopt.getopt(args, "rv") ! except getopt.error as details: raise InvalidUsage(details) for o, v in opts: *************** *** 122,126 **** if not isdir(dest, not bToDevice): ! print "%s does not indicate a directory" files = [] # List of FQ (from_name, to_name) --- 122,126 ---- if not isdir(dest, not bToDevice): ! print("%s does not indicate a directory") files = [] # List of FQ (from_name, to_name) *************** *** 133,137 **** new = BuildFileList(spec, 1, bRecurse, _copyfilter, bMaintainDir) if not new: ! print "Warning: '%s' did not match any files" % (spec) files = files + new --- 133,137 ---- new = BuildFileList(spec, 1, bRecurse, _copyfilter, bMaintainDir) if not new: ! print("Warning: '%s' did not match any files" % (spec)) files = files + new *************** *** 139,145 **** dest_name = os.path.join(dest, dest_info) size = src_info[5] ! print "Size=", size if bVerbose: ! print full_src, "->", dest_name,"- ", dialog.SetText(dest_name) dialog.Set(0, size/1024) --- 139,145 ---- dest_name = os.path.join(dest, dest_info) size = src_info[5] ! print("Size=", size) if bVerbose: ! print(full_src, "->", dest_name,"- ", end=' ') dialog.SetText(dest_name) dialog.Set(0, size/1024) *************** *** 147,154 **** num_bytes = num_bytes + bytes if bVerbose: ! print bytes, "bytes" num_files = num_files + 1 dialog.Close() ! print "%d files copied (%d bytes)" % (num_files, num_bytes) def _dirfilter(*args): --- 147,154 ---- num_bytes = num_bytes + bytes if bVerbose: ! print(bytes, "bytes") num_files = num_files + 1 dialog.Close() ! print("%d files copied (%d bytes)" % (num_files, num_bytes)) def _dirfilter(*args): *************** *** 162,166 **** try: opts, args = getopt.getopt(args, "r") ! except getopt.error, details: raise InvalidUsage(details) for o, v in opts: --- 162,166 ---- try: opts, args = getopt.getopt(args, "r") ! except getopt.error as details: raise InvalidUsage(details) for o, v in opts: *************** *** 168,172 **** bRecurse=1 for arg in args: ! print "Directory of WCE:%s" % arg files = BuildFileList(arg, 0, bRecurse, _dirfilter, None) total_size=0 --- 168,172 ---- bRecurse=1 for arg in args: ! print("Directory of WCE:%s" % arg) files = BuildFileList(arg, 0, bRecurse, _dirfilter, None) total_size=0 *************** *** 175,181 **** attr_string = " " if info[0] & win32con.FILE_ATTRIBUTE_DIRECTORY: attr_string = "<DIR>" ! print "%s %s %10d %s" % (date_str, attr_string, info[5], rel_name) total_size = total_size + info[5] ! print " " * 14 + "%3d files, %10d bytes" % (len(files), total_size) def run(args): --- 175,181 ---- attr_string = " " if info[0] & win32con.FILE_ATTRIBUTE_DIRECTORY: attr_string = "<DIR>" ! print("%s %s %10d %s" % (date_str, attr_string, info[5], rel_name)) total_size = total_size + info[5] ! print(" " * 14 + "%3d files, %10d bytes" % (len(files), total_size)) def run(args): *************** *** 199,209 **** try: wincerapi.CeDeleteFile(arg) ! print "Deleted: %s" % arg ! except win32api.error, details: print_error(details, "Error deleting '%s'" % arg) def DumpCommands(): ! print "%-10s - %s" % ("Command", "Description") ! print "%-10s - %s" % ("-------", "-----------") for name, item in globals().items(): if type(item)==type(DumpCommands): --- 199,209 ---- try: wincerapi.CeDeleteFile(arg) ! print("Deleted: %s" % arg) ! except win32api.error as details: print_error(details, "Error deleting '%s'" % arg) def DumpCommands(): ! print("%-10s - %s" % ("Command", "Description")) ! print("%-10s - %s" % ("-------", "-----------")) for name, item in globals().items(): if type(item)==type(DumpCommands): *************** *** 211,222 **** if doc: lines = string.split(doc, "\n") ! print "%-10s - %s" % (name, lines[0]) for line in lines[1:]: if line: ! print " " * 8, line def main(): if len(sys.argv)<2: ! print "You must specify a command!" DumpCommands() return --- 211,222 ---- if doc: lines = string.split(doc, "\n") ! print("%-10s - %s" % (name, lines[0])) for line in lines[1:]: if line: ! print(" " * 8, line) def main(): if len(sys.argv)<2: ! print("You must specify a command!") DumpCommands() return *************** *** 224,228 **** fn = globals().get(command) if fn is None: ! print "Unknown command:", command DumpCommands() return --- 224,228 ---- fn = globals().get(command) if fn is None: ! print("Unknown command:", command) DumpCommands() return *************** *** 231,245 **** try: verinfo = wincerapi.CeGetVersionEx() ! print "Connected to device, CE version %d.%d %s" % (verinfo[0], verinfo[1], verinfo[4]) try: fn(sys.argv[2:]) ! except InvalidUsage, msg: ! print "Invalid syntax -", msg ! print fn.__doc__ finally: try: wincerapi.CeRapiUninit() ! except win32api.error, details: print_error(details, "Error disconnecting") --- 231,245 ---- try: verinfo = wincerapi.CeGetVersionEx() ! print("Connected to device, CE version %d.%d %s" % (verinfo[0], verinfo[1], verinfo[4])) try: fn(sys.argv[2:]) ! except InvalidUsage as msg: ! print("Invalid syntax -", msg) ! print(fn.__doc__) finally: try: wincerapi.CeRapiUninit() ! except win32api.error as details: print_error(details, "Error disconnecting") |