mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
fixed a bug in buildcache -- now it both loads the latest version of images AND merges diffs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9dbe12ca13
commit
11b4705ded
@ -2,7 +2,7 @@
|
|||||||
#=======================================================================
|
#=======================================================================
|
||||||
|
|
||||||
__version__ = '''0.0.01'''
|
__version__ = '''0.0.01'''
|
||||||
__sub_version__ = '''20131228083526'''
|
__sub_version__ = '''20140102074435'''
|
||||||
__copyright__ = '''(c) Alex A. Naanou 2011'''
|
__copyright__ = '''(c) Alex A. Naanou 2011'''
|
||||||
|
|
||||||
|
|
||||||
@ -258,7 +258,8 @@ def make_inline_report_progress(state=None):
|
|||||||
|
|
||||||
#----------------------------------------------------------mergediffs---
|
#----------------------------------------------------------mergediffs---
|
||||||
##!!! this is generic, move to pli?
|
##!!! this is generic, move to pli?
|
||||||
def mergediffs(path, base, isdiff, merge, dfl, cmp=None, verbosity=0):
|
def mergediffs(path, base, isdiff, merge, dfl,
|
||||||
|
get_latest_base=True, isversion=None, load=None, cmp=None, verbosity=0):
|
||||||
'''
|
'''
|
||||||
load the base file and merge in all the diff files in order.
|
load the base file and merge in all the diff files in order.
|
||||||
'''
|
'''
|
||||||
@ -267,11 +268,21 @@ def mergediffs(path, base, isdiff, merge, dfl, cmp=None, verbosity=0):
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return res
|
return res
|
||||||
# base images file...
|
# base images file...
|
||||||
target = pathjoin(path, base)
|
if get_latest_base:
|
||||||
if os.path.exists(target):
|
res.update(loadlatest(
|
||||||
if verbosity >= 1:
|
path,
|
||||||
print 'Loading: %s' % target
|
isversion if isversion != None else lambda n: n.endswith(base),
|
||||||
merge(res, target)
|
lambda n: n == base,
|
||||||
|
load if load != None else lambda path: json.load(open(path)),
|
||||||
|
{},
|
||||||
|
cmp,
|
||||||
|
verbosity=verbosity))
|
||||||
|
else:
|
||||||
|
target = pathjoin(path, base)
|
||||||
|
if os.path.exists(target):
|
||||||
|
if verbosity >= 1:
|
||||||
|
print 'Loading: %s' % target
|
||||||
|
merge(res, target)
|
||||||
# apply diff files...
|
# apply diff files...
|
||||||
files = os.listdir(path)
|
files = os.listdir(path)
|
||||||
if cmp == None:
|
if cmp == None:
|
||||||
@ -326,6 +337,7 @@ def loadlatest(path, isversion, isbase, load, dfl, cmp=None, verbosity=0):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
# API...
|
# API...
|
||||||
#-----------------------------------------------------------getimages---
|
#-----------------------------------------------------------getimages---
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user