Commit a471dc90 authored by Sean Leavey's avatar Sean Leavey
Browse files

Merge branch 'extension-sources-relative-paths' into 'develop'

Store Cython extension sources as relative paths in setup.py

See merge request !78
parents 9fc8522c 52eb823b
Pipeline #235080 passed with stages
in 25 minutes and 12 seconds
......@@ -3,6 +3,7 @@ from setuptools import setup, find_packages
import os
import sys
import platform
from pathlib import Path
from Cython.Build import build_ext, cythonize
from Cython.Distutils import Extension
......@@ -23,8 +24,9 @@ def get_conda_paths():
def make_extension(relpath, **kwargs):
import numpy as np
root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "src")
finesse_dir = os.path.join(root_dir, "finesse")
here = Path(__file__).parent.absolute()
src_dir = Path("src")
finesse_dir = src_dir / "finesse"
def construct_ext_name(rp):
names = []
......@@ -63,7 +65,7 @@ def make_extension(relpath, **kwargs):
include_dirs = ext_args.get("include_dirs")
# Include the src/finesse and NumPy header file directories
include_dirs.extend([finesse_dir, np.get_include()])
include_dirs.extend([str(here / finesse_dir), np.get_include()])
# Now ensure suitesparse headers get included
USR_SUITESPARSE_PATH = "/usr/include/suitesparse"
......@@ -112,7 +114,7 @@ def make_extension(relpath, **kwargs):
arg_list += extra_args
ext_name = "finesse." + construct_ext_name(relpath)
sources = [os.path.join(finesse_dir, relpath)]
sources = [str(finesse_dir / relpath)]
return Extension(ext_name, sources, language="c", **ext_args,)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment