comparison libervia/server/tasks/implicit/task_brython.py @ 1335:f2ce8072d89d

tasks (brython): don't copy `__pycache__` to build_dir + fixed recursive copy
author Goffi <goffi@goffi.org>
date Sat, 15 Aug 2020 13:03:13 +0200
parents 089742e065e3
children b61509c47cac
comparison
equal deleted inserted replaced
1334:5ff6e187084f 1335:f2ce8072d89d
84 84
85 def copyFiles(self, files_paths, dest): 85 def copyFiles(self, files_paths, dest):
86 for p in files_paths: 86 for p in files_paths:
87 log.debug(f"copying {p}") 87 log.debug(f"copying {p}")
88 if p.is_dir(): 88 if p.is_dir():
89 shutil.copytree(p, dest) 89 if p.name == '__pycache__':
90 continue
91 shutil.copytree(p, dest / p.name)
90 else: 92 else:
91 shutil.copy(p, dest) 93 shutil.copy(p, dest)
92 94
93 def start(self): 95 def start(self):
94 dyn_path = self.build_path / C.BUILD_DIR_DYN 96 dyn_path = self.build_path / C.BUILD_DIR_DYN
115 ]) 117 ])
116 self.resource.dyn_data_common.setdefault( 118 self.resource.dyn_data_common.setdefault(
117 "template", {})['body_onload'] = self.getBodyOnload() 119 "template", {})['body_onload'] = self.getBodyOnload()
118 else: 120 else:
119 page_dyn_path = dyn_path / url_hash 121 page_dyn_path = dyn_path / url_hash
122 log.debug(f"using dynamic path at {page_dyn_path}")
120 if page_dyn_path.exists(): 123 if page_dyn_path.exists():
121 log.debug("cleaning existing path") 124 log.debug("cleaning existing path")
122 shutil.rmtree(page_dyn_path) 125 shutil.rmtree(page_dyn_path)
123 126
124 page_dyn_path.mkdir(parents=True, exist_ok=True) 127 page_dyn_path.mkdir(parents=True, exist_ok=True)