Skip to content

Commit 73cda78

Browse files
authored
Merge pull request #62 from jvkersch/add-headers
MAINT: Add parasail headers to Python wheel.
2 parents e10c324 + 8f8e42b commit 73cda78

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ parasail.egg-info/
77
*.dll
88
parasail-master*
99
autotools/
10+
parasail/include/**

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ include parasail/bindings_v2.py
99
exclude parasail/libparasail.so
1010
exclude parasail/libparasail.dylib
1111
exclude parasail/parasail.dll
12+
recursive-exclude parasail/include *.h
1213
include setup.cfg
1314
include setup.py
1415
include tests/test_basic.py

parasail/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
elif platform.system() == 'Windows':
2424
_libname = "parasail.dll"
2525
_libpath = os.path.join(os.path.dirname(__file__), _libname)
26+
_includepath = os.path.join(os.path.dirname(__file__), "include")
2627

2728
_verbose = os.environ.get("PARASAIL_VERBOSE", False)
2829

@@ -92,3 +93,12 @@ def version():
9293
else:
9394
from parasail.bindings_v2 import *
9495

96+
def get_include():
97+
""" Returns the path of the Parasail C library include files.
98+
"""
99+
return _includepath
100+
101+
def get_library():
102+
""" Returns the path of the Parasail C library shared object file.
103+
"""
104+
return _libpath

setup.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import tarfile
1414
import zipfile
1515

16+
from distutils.dir_util import copy_tree
1617
from distutils.util import get_platform
1718
from setuptools import setup
1819
from setuptools.command.install import install as install_
@@ -93,6 +94,11 @@ def get_libname():
9394
libname = "parasail.dll"
9495
return libname
9596

97+
def get_includes():
98+
return ["include/*.h",
99+
"include/parasail/*.h",
100+
"include/parasail/matrices/*.h"]
101+
96102
def unzip(archive, destdir):
97103
thefile=zipfile.ZipFile(archive)
98104
thefile.extractall(destdir)
@@ -364,6 +370,16 @@ def build_parasail(libname):
364370
print("copying {} to {}".format(src,dst))
365371
shutil.copy(src,dst)
366372

373+
# copy headers into the parasail directory, so they can be added to the wheel
374+
parasail_headers = os.path.join(parasail_root, "parasail")
375+
dst = os.path.join("parasail", "include", "parasail")
376+
print("copying {} to {}".format(parasail_headers, dst))
377+
copy_tree(parasail_headers, dst)
378+
parasail_h = os.path.join(parasail_root, "parasail.h")
379+
dst = os.path.join("parasail", "include")
380+
print("copying {} to {}".format(parasail_h, dst))
381+
shutil.copy(parasail_h, dst)
382+
367383
def github_api_json(address):
368384
import json
369385
import sys
@@ -431,6 +447,12 @@ def download_windows_dll():
431447
print("copying {} to {}".format(src,dst))
432448
shutil.copy(src,dst)
433449

450+
# copy headers into the parasail directory, so they can be added to the wheel
451+
headers_src = os.path.join(root, "..", "include")
452+
dst = os.path.join("parasail", "include")
453+
print("copying {} to {}".format(headers_src, dst))
454+
copy_tree(headers_src, dst)
455+
434456
def prepare_shared_lib():
435457
libname = get_libname()
436458
libpath = os.path.join("parasail", libname)
@@ -488,7 +510,7 @@ def finalize_options(self):
488510
maintainer_email=find_meta("email"),
489511
keywords=KEYWORDS,
490512
packages=PACKAGES,
491-
package_data={"parasail": [get_libname()]},
513+
package_data={"parasail": [get_libname()] + get_includes()},
492514
cmdclass=cmdclass,
493515
zip_safe=False,
494516
classifiers=CLASSIFIERS,

0 commit comments

Comments
 (0)