Skip to content

Commit

Permalink
Merge pull request #408 from cherab/package-demos
Browse files Browse the repository at this point in the history
Package demo scripts and data in sdists and wheels
  • Loading branch information
jacklovell committed Nov 30, 2023
2 parents 0e6a150 + 49861bf commit def6d5f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
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

0 comments on commit def6d5f

Please sign in to comment.