projects
/
invirt/packages/invirt-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
64b8817
)
Use full names for os.* things
author
Ben Steffen
<bds@mit.edu>
Tue, 26 Nov 2019 19:47:46 +0000
(14:47 -0500)
committer
Ben Steffen
<bds@mit.edu>
Tue, 26 Nov 2019 19:48:44 +0000
(14:48 -0500)
python/invirt/config.py
patch
|
blob
|
history
diff --git
a/python/invirt/config.py
b/python/invirt/config.py
index
9633c2d
..
58b95aa
100644
(file)
--- a/
python/invirt/config.py
+++ b/
python/invirt/config.py
@@
-1,8
+1,6
@@
import json
from invirt.common import *
import os
import json
from invirt.common import *
import os
-from os import rename
-from os.path import getmtime
from contextlib import closing
import yaml
import re
from contextlib import closing
import yaml
import re
@@
-66,8
+64,8
@@
def load_master():
return config
def get_src_mtime():
return config
def get_src_mtime():
- return max(max(getmtime(filename) for filename in list_files()),
- getmtime(src_dirpath))
+ return max(max(os.path.getmtime(filename) for filename in list_files()),
+ os.path.getmtime(src_dirpath))
def load(force_refresh = False):
"""
def load(force_refresh = False):
"""
@@
-85,7
+83,7
@@
def load(force_refresh = False):
do_refresh = True
else:
src_mtime = get_src_mtime()
do_refresh = True
else:
src_mtime = get_src_mtime()
- try: cache_mtime = getmtime(cache_path)
+ try: cache_mtime = os.path.getmtime(cache_path)
except OSError: do_refresh = True
else: do_refresh = src_mtime + 1 >= cache_mtime
except OSError: do_refresh = True
else: do_refresh = src_mtime + 1 >= cache_mtime
@@
-132,7
+130,7
@@
def load(force_refresh = False):
with closing(open(cache_path + '.tmp', 'w')) as f:
f.write(json.write(ns.cfg))
except: pass # silent failure
with closing(open(cache_path + '.tmp', 'w')) as f:
f.write(json.write(ns.cfg))
except: pass # silent failure
- else: rename(cache_path + '.tmp', cache_path)
+ else: os.rename(cache_path + '.tmp', cache_path)
except IOError:
ns.cfg = load_master()
return ns.cfg
except IOError:
ns.cfg = load_master()
return ns.cfg