Skip to content

Commit 50302c9

Browse files
committed
allow for missing spa files
1 parent 2f910ec commit 50302c9

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

setup.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,25 @@
4444
# 'pyephem',
4545

4646
# set up pvlib packages to be installed and extensions to be compiled
47-
PACKAGES = ['pvlib',
48-
'pvlib.spa_c_files']
47+
PACKAGES = ['pvlib']
4948

5049
extensions = []
5150

52-
spa_ext = Extension('pvlib.spa_c_files.spa_py',
53-
sources = ['pvlib/spa_c_files/spa.c',
54-
'pvlib/spa_c_files/spa_py.c'],
55-
depends = ['pvlib/spa_c_files/spa.h'])
56-
extensions.append(spa_ext)
51+
spa_sources = ['pvlib/spa_c_files/spa.c', 'pvlib/spa_c_files/spa_py.c']
52+
spa_depends = ['pvlib/spa_c_files/spa.h']
53+
spa_all_file_paths = map(lambda x: os.path.join(os.path.dirname(__file__), x),
54+
spa_sources + spa_depends)
55+
56+
if all(map(os.path.exists, spa_all_file_paths)):
57+
print('all spa_c files found')
58+
PACKAGES.append('pvlib.spa_c_files')
59+
60+
spa_ext = Extension('pvlib.spa_c_files.spa_py',
61+
sources=spa_sources, depends=spa_depends)
62+
extensions.append(spa_ext)
63+
else:
64+
print('WARNING: spa_c files not detected. ' +
65+
'See installation instructions for more information.')
5766

5867

5968
setup(name=DISTNAME,

0 commit comments

Comments
 (0)