-
Notifications
You must be signed in to change notification settings - Fork 172
/
01-python.patch
89 lines (84 loc) · 3.42 KB
/
01-python.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
--- desktop-cache-smf-services-0.2.2/find_newer.~1~ 2009-04-02 12:05:33.000000000 +0000
+++ desktop-cache-smf-services-0.2.2/find_newer 2019-08-01 16:27:59.118847968 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/python3.5
import os, sys
import getopt
@@ -12,8 +12,8 @@
self.msg = ""
self.msg = self.msg + "Usage: find_newer.py [options] dir...\n\n"
self.msg = self.msg + "Options:\n"
- self.msg = self.msg + " --name glob find files matching glob\n"
- self.msg = self.msg + " --newer ref find files newer than a reference file"
+ self.msg = self.msg + " --name glob find files matching glob\n"
+ self.msg = self.msg + " --newer ref find files newer than a reference file\n"
self.msg = self.msg + " -c compare ctimes (the time the file status was last changed)\n"
self.msg = self.msg + " This is the default.\n"
self.msg = self.msg + " -m compare mtimes (the time the file was last modified)\n"
@@ -45,7 +45,7 @@
def find_newer_files(dir, comp_time, ref_time, reobj, follow_links):
dir = os.path.abspath(dir)
if dir in dirs_seen:
- print >>sys.stderr, "Warning: infinite loop of symlinks"
+ print("Warning: infinite loop of symlinks", file=sys.stderr)
return
dirs_seen.append(dir)
for root, dirs, files in os.walk(dir):
@@ -57,16 +57,16 @@
if get_file_time (stat, comp_time) > ref_time:
if reobj:
if reobj.match (file):
- print file
+ print(file)
else:
- print file
+ print(file)
else:
# no reference time, print all files that match the regex
if reobj:
if reobj.match (file):
- print file
+ print(file)
else:
- print file
+ print(file)
except:
pass
if follow_links:
@@ -90,7 +90,7 @@
try:
try:
opts, args = getopt.getopt(argv[1:], "hcmaf", ["help", "newer=", "name="])
- except getopt.error, msg:
+ except getopt.error as msg:
raise Usage(msg)
for o, a in opts:
if o == "-c":
@@ -110,9 +110,9 @@
if len(args) < 1:
raise Usage("invalid arguments")
- except Usage, err:
- print >>sys.stderr, err.msg
- print >>sys.stderr, "Use --help for usage information"
+ except Usage as err:
+ print(err.msg, file=sys.stderr)
+ print("Use --help for usage information", file=sys.stderr)
return 2
# default: compare ctime
@@ -126,7 +126,7 @@
try:
ref_stat = os.stat(ref_file)
except:
- print >>sys.stderr, "Cannot stat reference file: %s" % ref_file
+ print("Cannot stat reference file: %s" % ref_file, file=sys.stderr)
return 1
ref_time = get_file_time (ref_stat, comp_time)
else:
@@ -134,7 +134,7 @@
for dir in args:
if not os.path.isdir(dir):
- print >>sys.stderr, "Directory not found: %s" % dir
+ print("Directory not found: %s" % dir, file=sys.stderr)
return 1
if glob: