Skip to content

Commit 9a6757d

Browse files
committed
posix -> os
1 parent 391b8b7 commit 9a6757d

3 files changed

Lines changed: 17 additions & 18 deletions

File tree

Tools/scripts/byteyears.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
#
77
# Options -[amc] select atime, mtime (default) or ctime as age.
88

9-
import sys, posix, time
9+
import sys, os, time
1010
import string
1111
from stat import *
1212

1313
# Use lstat() to stat files if it exists, else stat()
1414
try:
15-
statfunc = posix.lstat
16-
except NameError:
17-
statfunc = posix.stat
15+
statfunc = os.lstat
16+
except AttributeError:
17+
statfunc = os.stat
1818

1919
# Parse options
2020
if sys.argv[1] == '-m':
@@ -42,7 +42,7 @@
4242
for file in sys.argv[1:]:
4343
try:
4444
st = statfunc(file)
45-
except posix.error, msg:
45+
except os.error, msg:
4646
sys.stderr.write('can\'t stat ' + `file` + ': ' + `msg` + '\n')
4747
status = 1
4848
st = ()

Tools/scripts/checkpyc.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Check that all ".pyc" files exist and are up-to-date
2-
# Uses module 'posix'
2+
# Uses module 'os'
33

44
import sys
5-
import posix
6-
import path
5+
import os
76
from stat import ST_MTIME
87

98
def main():
@@ -24,19 +23,19 @@ def main():
2423
print 'Using MAGIC word', `MAGIC`
2524
for dirname in sys.path:
2625
try:
27-
names = posix.listdir(dirname)
28-
except posix.error:
26+
names = os.listdir(dirname)
27+
except os.error:
2928
print 'Cannot list directory', `dirname`
3029
continue
3130
if not silent:
3231
print 'Checking', `dirname`, '...'
3332
names.sort()
3433
for name in names:
3534
if name[-3:] == '.py':
36-
name = path.join(dirname, name)
35+
name = os.path.join(dirname, name)
3736
try:
38-
st = posix.stat(name)
39-
except posix.error:
37+
st = os.stat(name)
38+
except os.error:
4039
print 'Cannot stat', `name`
4140
continue
4241
if verbose:

Tools/scripts/copytime.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copy one file's atime and mtime to another
44

55
import sys
6-
import posix
6+
import os
77
from stat import ST_ATIME, ST_MTIME # Really constants 7 and 8
88

99
def main():
@@ -12,13 +12,13 @@ def main():
1212
sys.exit(2)
1313
file1, file2 = sys.argv[1], sys.argv[2]
1414
try:
15-
stat1 = posix.stat(file1)
16-
except posix.error:
15+
stat1 = os.stat(file1)
16+
except os.error:
1717
sys.stderr.write(file1 + ': cannot stat\n')
1818
sys.exit(1)
1919
try:
20-
posix.utime(file2, (stat1[ST_ATIME], stat1[ST_MTIME]))
21-
except posix.error:
20+
os.utime(file2, (stat1[ST_ATIME], stat1[ST_MTIME]))
21+
except os.error:
2222
sys.stderr.write(file2 + ': cannot change time\n')
2323
sys.exit(2)
2424

0 commit comments

Comments
 (0)