forked from pvlib/pvlib-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
36 lines (27 loc) · 882 Bytes
/
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
#!/usr/bin/env python
import os
try:
from setuptools import setup
from setuptools.extension import Extension
except ImportError:
raise RuntimeError("setuptools is required")
URL = "https://github.com/pvlib/pvlib-python"
extensions = []
spa_sources = ["pvlib/spa_c_files/spa.c", "pvlib/spa_c_files/spa_py.c"]
spa_depends = ["pvlib/spa_c_files/spa.h"]
spa_all_file_paths = map(
lambda x: os.path.join(os.path.dirname(__file__), x),
spa_sources + spa_depends
)
if all(map(os.path.exists, spa_all_file_paths)):
print("all spa_c files found")
spa_ext = Extension(
"pvlib.spa_c_files.spa_py", sources=spa_sources, depends=spa_depends
)
extensions.append(spa_ext)
else:
print(
"WARNING: spa_c files not detected. "
+ "See installation instructions for more information."
)
setup(ext_modules=extensions, url=URL)