def external_imports (pkg_name, pkg_path, ignore_imports = ignore_imports) : """Return the set of external imports of package at `pkg_path`""" result = set () for m in sos.listdir_ext (pkg_path, ".py") : result.update (external_module_imports (pkg_name, m, ignore_imports)) for s in subdirs_transitive (pkg_path) : result.update (external_imports (pkg_name, s, ignore_imports)) return result
def _create_cache (self, name, map, minifier = None) : media_dir = self.media_dir if not sos.path.isdir (media_dir) : sos.mkdir_p (media_dir) else : for f in sos.listdir_ext (media_dir, name.lower ()) : sos.remove (f) for k, (href, fn, attr) in pyk.iteritems (map) : with open (fn, "wb") as file : if minifier is not None : attr = minifier (attr) file.write (attr) if self.verbose : print ("Wrote template media cache file", fn)