Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package demo scripts and data in sdists and wheels #408

Merged
merged 5 commits into from Nov 30, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython>=0.28", "raysect==0.8.1"]
requires = ["setuptools>=62.3", "oldest-supported-numpy", "cython>=0.28", "raysect==0.8.1"]
build-backend="setuptools.build_meta"
26 changes: 22 additions & 4 deletions setup.py
@@ -1,9 +1,11 @@
from setuptools import setup, find_packages, Extension
from collections import defaultdict
import sys
import numpy
import os
import os.path as path
from pathlib import Path
import multiprocessing
import numpy
from setuptools import setup, find_packages, Extension
from Cython.Build import cythonize

multiprocessing.set_start_method('fork')
Expand Down Expand Up @@ -71,6 +73,16 @@
compiler_directives=cython_directives,
)

# Include demos in a separate directory in the distribution as data_files.
demo_parent_path = Path("share/cherab/demos/core")
data_files = defaultdict(list)
demos_source = Path("demos")
for item in demos_source.rglob("*"):
if item.is_file():
install_dir = demo_parent_path / item.parent.relative_to(demos_source)
data_files[str(install_dir)].append(str(item))
data_files = list(data_files.items())

# parse the package version number
with open(path.join(path.dirname(__file__), "cherab/core/VERSION")) as version_file:
version = version_file.read().strip()
Expand Down Expand Up @@ -112,8 +124,14 @@
# Running ./dev/build_docs.sh runs setup.py, which requires cython.
"docs": ["cython", "sphinx", "sphinx-rtd-theme", "sphinx-tabs"],
},
packages=find_packages(),
include_package_data=True,
packages=find_packages(include=["cherab*"]),
package_data={"": [
"**/*.pyx", "**/*.pxd", # Needed to build Cython extensions.
"**/*.json", "**/*.cl", "**/*.npy", "**/*.obj", # Supplementary data
],
"cherab.core": ["VERSION"], # Used to determine version at run time
},
data_files=data_files,
zip_safe=False,
ext_modules=extensions,
options=dict(
Expand Down