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

Update setup.py to explicitly include submodules and their files when building for Python3.6 #33

Merged
merged 3 commits into from
Nov 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -55,13 +55,29 @@
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,
)
if (3, 7) > sys.version_info:
# For Python3.6, we need to explicitly specify the packages and the
# package data. Submodules and .pyi/.type files are not
# automatically included.
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="clp_ffi_py",
description="CLP FFI Python Interface",
ext_modules=[ir_native],
kirkrodrigues marked this conversation as resolved.
Show resolved Hide resolved
packages=packages,
package_data=package_data,
version=version,
)
else:
setup(
name="clp_ffi_py",
description="CLP FFI Python Interface",
ext_modules=[ir_native],
packages=["clp_ffi_py"],
version=version,
)

except Exception as e:
sys.exit(f"Error: {e}")