Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include README.md
include CHANGELOG.md
include MATLAB_MAPPING.md

recursive-include ndi_common *.json *.txt *.tsv *.tsv.gz *.obo *.md
recursive-include ndi_common/example_binaries *
recursive-include ndi_common/example_datasets *
recursive-include ndi_common/daq_systems *
recursive-include src/ndi/ndi_common *.json *.txt *.tsv *.tsv.gz *.obo *.md
recursive-include src/ndi/ndi_common/example_binaries *
recursive-include src/ndi/ndi_common/example_datasets *
recursive-include src/ndi/ndi_common/daq_systems *
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ allow-direct-references = true
packages = ["src/ndi"]

[tool.hatch.build.targets.sdist]
include = ["/src", "/ndi_common", "/tests", "/examples", "LICENSE", "README.md", "CHANGELOG.md", "MATLAB_MAPPING.md"]
include = ["/src", "/tests", "/examples", "LICENSE", "README.md", "CHANGELOG.md", "MATLAB_MAPPING.md"]

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down
22 changes: 8 additions & 14 deletions src/ndi/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,19 @@ def _find_ndi_root(cls) -> Path:
"""Find the NDI root directory.

Looks for environment variable NDI_ROOT, or tries to find it
relative to this package. Searches multiple possible locations.
relative to this package. The ndi_common directory lives inside
the ndi package (src/ndi/ndi_common), so the root is the ndi
package directory itself.
"""
if os.environ.get("NDI_ROOT"):
return Path(os.environ["NDI_ROOT"])

# Try to find it relative to this file
# src/ndi/common/__init__.py -> src/ndi/common -> src/ndi -> src -> repo_root
package_dir = Path(__file__).parent.parent.parent.parent
# ndi_common is inside the ndi package directory.
# src/ndi/common/__init__.py -> common -> ndi (package root)
package_dir = Path(__file__).parent.parent

# Check multiple possible locations for ndi_common
possible_paths = [
package_dir / "ndi_common", # repo_root/ndi_common
package_dir / "src" / "ndi" / "ndi_common", # repo_root/src/ndi/ndi_common
]

for path in possible_paths:
if path.exists() and (path / "database_documents").exists():
# Return the parent that contains ndi_common
return path.parent
if (package_dir / "ndi_common" / "database_documents").exists():
return package_dir

raise ValueError(
"Cannot find NDI root directory. "
Expand Down
File renamed without changes.
Loading