diff --git a/setup.py b/setup.py index 4583d991..38b6c9a6 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import sys import toml from setuptools import setup, Extension -from typing import Any, Dict, Optional +from typing import Any, Dict, List, Optional ir_native: Extension = Extension( name="clp_ffi_py.ir.native", @@ -55,13 +55,32 @@ if None is version: sys.exit("Error: The version number was not found in pyproject.toml") - setup( - name="clp_ffi_py", - description="CLP FFI Python Interface", - ext_modules=[ir_native], - packages=["clp_ffi_py"], - version=version, - ) + project_name: str = "clp_ffi_py" + description: str = "CLP FFI Python Interface" + extension_modules: List[Extension] = [ir_native] + if (3, 7) > sys.version_info: + # For Python3.6, setuptools doesn't automatically include submodules + # and .pyi/.type files, so we need to explicitly specify the + # packages and the files to include per package (package_data). + packages: List[str] = ["clp_ffi_py", "clp_ffi_py.ir"] + data_to_include: List[str] = ["*.py", "*.pyi", "*.typed"] + package_data: Dict[str, List[str]] = {package: data_to_include for package in packages} + setup( + name=project_name, + description=description, + ext_modules=extension_modules, + packages=packages, + package_data=package_data, + version=version, + ) + else: + setup( + name=project_name, + description=description, + ext_modules=extension_modules, + packages=["clp_ffi_py"], + version=version, + ) except Exception as e: sys.exit(f"Error: {e}")