only generate index.js, index.css on demand

This commit is contained in:
andreas 2024-11-03 17:33:30 +01:00
parent c6f601377c
commit 01d334d598
1 changed files with 21 additions and 5 deletions

View File

@ -375,14 +375,30 @@ def getLibs():
rt.append(e) rt.append(e)
return rt return rt
def joinFiles(target,pattern,dirlist): def joinFiles(target,pattern,dirlist):
with gzip.open(target,"wb") as oh: flist=[]
for dir in dirlist: for dir in dirlist:
fn=os.path.join(dir,pattern) fn=os.path.join(dir,pattern)
if os.path.exists(fn): if os.path.exists(fn):
print("adding %s to %s"%(fn,target)) flist.append(fn)
with open(fn,"rb") as rh: current=False
shutil.copyfileobj(rh,oh) if os.path.exists(target):
current=True
for f in flist:
if not isCurrent(f,target):
current=False
break
if current:
print("%s is up to date"%target)
return
print("creating %s"%target)
with gzip.open(target,"wb") as oh:
for fn in flist:
print("adding %s to %s"%(fn,target))
with open(fn,"rb") as rh:
shutil.copyfileobj(rh,oh)
OWNLIBS=getLibs()+["FS","WiFi"] OWNLIBS=getLibs()+["FS","WiFi"]