Skip to content

Commit

Permalink
Fix packaging of spec files in python wheel
Browse files Browse the repository at this point in the history
This commit ensures the "spec/*.yaml" files are copied to "src/pynwb/spec/*.yaml",
doing so allows the file to be packages into the distributed wheel.
  • Loading branch information
jcfr committed May 19, 2019
1 parent 10d60b0 commit 68592d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions {{ cookiecutter.namespace }}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ docs/source/_format_auto_docs
docs/source/_static
!docs/source/_static/theme_overrides.css

# copied spec files
src/pynwb/spec/*.yaml

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
18 changes: 18 additions & 0 deletions {{ cookiecutter.namespace }}/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-

import os

from setuptools import setup, find_packages
from shutil import copy2

setup_args = {
'name': '{{ cookiecutter.namespace }}',
Expand All @@ -15,12 +18,27 @@
],
'packages': find_packages('src'),
'package_dir': {'': 'src'},
'package_data': {'': [
'{{ cookiecutter.namespace }}.namespace.yaml',
'{{ cookiecutter.namespace }}.extensions.yaml',
]},
'include_package_data': True,
'classifiers': [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
],
'zip_safe': False
}


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')
copy2(ns_path, dst_dir)
copy2(ext_path, dst_dir)


if __name__ == '__main__':
_copy_spec_files(os.path.dirname(__file__))
setup(**setup_args)

0 comments on commit 68592d6

Please sign in to comment.