Skip to content

Commit

Permalink
Fix python package layout to avoid overriding pynwb installation
Browse files Browse the repository at this point in the history
This commit ensures the extension python package is named after the
namespace. Doing so avoids to override file like "pynwb/__init__.py"
provided by the upstream "pynwb" package.
  • Loading branch information
jcfr committed May 19, 2019
1 parent 09e01e5 commit 526638e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion {{ cookiecutter.namespace }}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ docs/source/_static
!docs/source/_static/theme_overrides.css

# copied spec files
src/pynwb/spec/*.yaml
src/pynwb/{{ cookiecutter.namespace|replace("-", "_") }}/spec/*.yaml

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.namespace }}/NEXTSTEPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ update `setup.py` setting the `package_data` and `include_package_data` keyword
```python
setup_args = {
# [...]
'package_data': {'pynwb': [
'package_data': {'{{ cookiecutter.namespace|replace("-", "_") }}': [
'spec/{{ cookiecutter.namespace }}.namespace.yaml',
'spec/{{ cookiecutter.namespace }}.extensions.yaml',
]},
Expand Down
8 changes: 4 additions & 4 deletions {{ cookiecutter.namespace }}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
'install_requires': [
'pynwb'
],
'packages': find_packages('src'),
'package_dir': {'': 'src'},
'package_data': {'pynwb': [
'packages': find_packages('src/pynwb'),
'package_dir': {'': 'src/pynwb'},
'package_data': {'{{ cookiecutter.namespace|replace("-", "_") }}': [
'spec/{{ cookiecutter.namespace }}.namespace.yaml',
'spec/{{ cookiecutter.namespace }}.extensions.yaml',
]},
Expand All @@ -34,7 +34,7 @@ def _copy_spec_files(project_dir):
ns_path = os.path.join(project_dir, 'spec', '{{ cookiecutter.namespace }}.namespace.yaml')
ext_path = os.path.join(project_dir, 'spec', '{{ cookiecutter.namespace }}.extensions.yaml')

dst_dir = os.path.join(project_dir, 'src', 'pynwb', 'spec')
dst_dir = os.path.join(project_dir, 'src', 'pynwb', '{{ cookiecutter.namespace|replace("-", "_") }}', 'spec')
if not os.path.exists(dst_dir):
os.mkdir(dst_dir)

Expand Down

0 comments on commit 526638e

Please sign in to comment.