summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/byteyears.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-01-17 08:48:39 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-01-17 08:48:39 (GMT)
commit70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7 (patch)
treecf47b67db3753288cfd9fa2adc45e7c5cd2f8741 /Tools/scripts/byteyears.py
parenta88854059309667092000da55d4d5a5804267e9f (diff)
downloadcpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.zip
cpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.tar.gz
cpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.tar.bz2
Whitespace normalization.
Diffstat (limited to 'Tools/scripts/byteyears.py')
-rwxr-xr-xTools/scripts/byteyears.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/Tools/scripts/byteyears.py b/Tools/scripts/byteyears.py
index bada5a5..f67be70 100755
--- a/Tools/scripts/byteyears.py
+++ b/Tools/scripts/byteyears.py
@@ -12,46 +12,46 @@ from stat import *
# Use lstat() to stat files if it exists, else stat()
try:
- statfunc = os.lstat
+ statfunc = os.lstat
except AttributeError:
- statfunc = os.stat
+ statfunc = os.stat
# Parse options
if sys.argv[1] == '-m':
- itime = ST_MTIME
- del sys.argv[1]
+ itime = ST_MTIME
+ del sys.argv[1]
elif sys.argv[1] == '-c':
- itime = ST_CTIME
- del sys.argv[1]
+ itime = ST_CTIME
+ del sys.argv[1]
elif sys.argv[1] == '-a':
- itime = ST_CTIME
- del sys.argv[1]
+ itime = ST_CTIME
+ del sys.argv[1]
else:
- itime = ST_MTIME
+ itime = ST_MTIME
-secs_per_year = 365.0 * 24.0 * 3600.0 # Scale factor
-now = time.time() # Current time, for age computations
-status = 0 # Exit status, set to 1 on errors
+secs_per_year = 365.0 * 24.0 * 3600.0 # Scale factor
+now = time.time() # Current time, for age computations
+status = 0 # Exit status, set to 1 on errors
# Compute max file name length
maxlen = 1
for file in sys.argv[1:]:
- if len(file) > maxlen: maxlen = len(file)
+ if len(file) > maxlen: maxlen = len(file)
# Process each argument in turn
for file in sys.argv[1:]:
- try:
- st = statfunc(file)
- except os.error, msg:
- sys.stderr.write('can\'t stat ' + `file` + ': ' + `msg` + '\n')
- status = 1
- st = ()
- if st:
- anytime = st[itime]
- size = st[ST_SIZE]
- age = now - anytime
- byteyears = float(size) * float(age) / secs_per_year
- print string.ljust(file, maxlen),
- print string.rjust(`int(byteyears)`, 8)
+ try:
+ st = statfunc(file)
+ except os.error, msg:
+ sys.stderr.write('can\'t stat ' + `file` + ': ' + `msg` + '\n')
+ status = 1
+ st = ()
+ if st:
+ anytime = st[itime]
+ size = st[ST_SIZE]
+ age = now - anytime
+ byteyears = float(size) * float(age) / secs_per_year
+ print string.ljust(file, maxlen),
+ print string.rjust(`int(byteyears)`, 8)
sys.exit(status)