Skip to content

Commit efc42b4

Browse files
authored
Merge pull request #1567 from etpinard/etpinard/jl-compgen_filename-case-insensitive-fs
Fix `dash-generate-components` for julia on case-insensitive filesystems
2 parents e5583bd + 741df37 commit efc42b4

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
77
## Dash and Dash Renderer
88
### Changed
99
- [#1611](https://github.com/plotly/dash/pull/1611) Package dash-renderer artifacts and dependencies with Dash, and source renderer resources from within Dash.
10+
- [#1567](https://github.com/plotly/dash/pull/1567) Julia component generator puts components into `src/jl` - fixes an issue on case-insensitive filesystems when the component name and module name match (modulo case) and no prefix is used. Also reduces JS/Julia clutter in the overloaded `src` directory.
1011

1112
### Fixed
1213
- [#1664](https://github.com/plotly/dash/pull/1664) Fix [#1649](https://github.com/plotly/dash/issues/1649), makes the devtools readable with a dark theme.

dash/development/_jl_components_generation.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"DashBase": "0.1",
9292
}
9393

94-
jl_component_include_string = 'include("{name}.jl")'
94+
jl_component_include_string = 'include("jl/{name}.jl")'
9595

9696
jl_resource_tuple_string = """DashBase.Resource(
9797
relative_package_path = {relative_package_path},
@@ -500,7 +500,13 @@ def generate_struct_file(name, props, description, project_shortname, prefix):
500500

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

503-
file_path = os.path.join("src", file_name)
503+
# put component files in src/jl subdir,
504+
# this also creates the Julia source directory for the package
505+
# if it is missing
506+
if not os.path.exists("src/jl"):
507+
os.makedirs("src/jl")
508+
509+
file_path = os.path.join("src", "jl", file_name)
504510
with open(file_path, "w") as f:
505511
f.write(import_string)
506512
f.write(class_string)
@@ -512,12 +518,7 @@ def generate_struct_file(name, props, description, project_shortname, prefix):
512518
def generate_module(
513519
project_shortname, components, metadata, pkg_data, prefix, **kwargs
514520
):
515-
# the Julia source directory for the package won't exist on first call
516-
# create the Julia directory if it is missing
517-
if not os.path.exists("src"):
518-
os.makedirs("src")
519-
520-
# now copy over all JS dependencies from the (Python) components dir
521+
# copy over all JS dependencies from the (Python) components dir
521522
# the inst/lib directory for the package won't exist on first call
522523
# create this directory if it is missing
523524
if os.path.exists("deps"):

0 commit comments

Comments
 (0)