-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
61 lines (50 loc) · 1.65 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Inspired by https://github.com/himbeles/ctypes-example.
from pathlib import Path
from distutils.command.build_ext import build_ext as build_ext_orig
from setuptools import Extension, setup
class CTypesExtension(Extension):
pass
class build_ext(build_ext_orig):
def build_extension(self, ext):
self._ctypes = isinstance(ext, CTypesExtension)
return super().build_extension(ext)
def get_export_symbols(self, ext):
if self._ctypes:
return ext.export_symbols
return super().get_export_symbols(ext)
def get_ext_filename(self, ext_name):
return super().get_ext_filename(ext_name)
# with open("README.md", "r") as file:
# long_description = file.read()
my_extension = CTypesExtension(
name = "clib-misha",
sources = [
str(Path("misha", "cc", "src", "dat.cc")),
],
include_dirs = [str(Path("misha", "cc", "include")),]
)
setup(
name="misha",
install_requires=["numpy"],
author="Fabrizio Ottati",
author_email="[email protected]",
maintainer="Fabrizio Ottati",
maintainer_email="[email protected], [email protected]",
url="https://github.com/fabrizio-ottati/misha",
version="0.0.0",
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: C++",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Operating System :: OS Independent",
],
# long_description=long_description,
# long_description_content_type="text/markdown",
packages=[
"misha",
],
ext_modules=[
my_extension,
],
cmdclass={"build_ext": build_ext},
)