Skip to content

Commit

Permalink
prepend 'comp_' in jl component file names
Browse files Browse the repository at this point in the history
so that the component file name does not conflict with
the jl module filename in case-insensitive filesystems
when --prefix=''.
  • Loading branch information
etpinard committed Mar 9, 2021
1 parent 200b05e commit 7f8ca06
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dash/development/_jl_components_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"DashBase": "0.1",
}

jl_component_include_string = 'include("{name}.jl")'
jl_component_include_string = 'include("{filename}.jl")'

jl_resource_tuple_string = """DashBase.Resource(
relative_package_path = {relative_package_path},
Expand Down Expand Up @@ -340,6 +340,10 @@ def format_fn_name(prefix, name):
return name.lower()


def format_file_name(prefix, name):
return "comp_{}".format(format_fn_name(prefix, name))


def generate_metadata_strings(resources, metatype):
def nothing_or_string(v):
return '"{}"'.format(v) if v else "nothing"
Expand Down Expand Up @@ -391,7 +395,7 @@ def generate_package_file(project_shortname, components, pkg_data, prefix):
component_includes="\n".join(
[
jl_component_include_string.format(
name=format_fn_name(prefix, comp_name)
filename=format_file_name(prefix, comp_name)
)
for comp_name in components
]
Expand Down Expand Up @@ -498,7 +502,7 @@ def generate_struct_file(name, props, description, project_shortname, prefix):
name, props, description, project_shortname, prefix
)

file_name = format_fn_name(prefix, name) + ".jl"
file_name = format_file_name(prefix, name) + ".jl"

file_path = os.path.join("src", file_name)
with open(file_path, "w") as f:
Expand Down

0 comments on commit 7f8ca06

Please sign in to comment.