Skip to content

Commit a873a04

Browse files
authored
Add support for cljc files (#1096)
fixes #1097 I'm not sure if this is the extent of changes that need to occur, but I've been using these changes locally to start porting [portal](https://github.com/djblue/portal) and it's been working for me.
1 parent cd8fd8a commit a873a04

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
* Added support for Python 3.13 (#1056)
10+
* Added support for `.cljc` files (#1097)
1011

1112
### Fixed
1213
* Fix an issue with `basilisp test` standard streams output that can lead to failures on MS-Windows (#1080)

src/basilisp/importer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def _is_package(path: str) -> bool:
105105
or Python code file."""
106106
for _, _, files in os.walk(path):
107107
for file in files:
108-
if file.endswith(".lpy") or file.endswith(".py"):
108+
if file.endswith(".lpy") or file.endswith(".py") or file.endswith(".cljc"):
109109
return True
110110
return False
111111

@@ -122,7 +122,7 @@ def _is_namespace_package(path: str) -> bool:
122122
for file in files:
123123
if file in {"__init__.lpy", "__init__.py"}:
124124
no_inits = False
125-
elif file.endswith(".lpy"):
125+
elif file.endswith(".lpy") or file.endswith(".cljc"):
126126
has_basilisp_files = True
127127
return no_inits and has_basilisp_files
128128

@@ -161,6 +161,8 @@ def find_spec(
161161
filenames = [
162162
f"{os.path.join(root_path, '__init__')}.lpy",
163163
f"{root_path}.lpy",
164+
f"{os.path.join(root_path, '__init__')}.cljc",
165+
f"{root_path}.cljc",
164166
]
165167
for filename in filenames:
166168
if os.path.isfile(filename):

0 commit comments

Comments
 (0)