From 0b39bd5d00678338b3bdf41f8479bcddf60b1655 Mon Sep 17 00:00:00 2001 From: tcbegley Date: Sat, 7 Nov 2020 21:06:20 +0000 Subject: [PATCH] Generate Julia components with nested structure --- dash/development/_jl_components_generation.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/dash/development/_jl_components_generation.py b/dash/development/_jl_components_generation.py index 981b249d31..642221d678 100644 --- a/dash/development/_jl_components_generation.py +++ b/dash/development/_jl_components_generation.py @@ -4,7 +4,6 @@ import copy import os import shutil -import glob import warnings import sys import importlib @@ -526,14 +525,21 @@ def generate_module( os.makedirs("deps") - for javascript in glob.glob("{}/*.js".format(project_shortname)): - shutil.copy(javascript, "deps/") + for rel_dirname, _, filenames in os.walk(project_shortname): + for filename in filenames: + extension = os.path.splitext(filename)[1] - for css in glob.glob("{}/*.css".format(project_shortname)): - shutil.copy(css, "deps/") + if extension in [".py", ".pyc", ".json"]: + continue - for sourcemap in glob.glob("{}/*.map".format(project_shortname)): - shutil.copy(sourcemap, "deps/") + target_dirname = os.path.join( + "deps/", os.path.relpath(rel_dirname, project_shortname) + ) + + if not os.path.exists(target_dirname): + os.makedirs(target_dirname) + + shutil.copy(os.path.join(rel_dirname, filename), target_dirname) generate_package_file(project_shortname, components, pkg_data, prefix) generate_toml_file(project_shortname, pkg_data)