Skip to content

Commit be2f8bb

Browse files
committed
For now, only add Oddie support only on Windows and Linux x64
1 parent 520adb0 commit be2f8bb

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.github/workflows/builds.yml

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
CONDA_SUBDIR: 'linux-64'
2828
DSS_CAPI_PATH: '${{ github.workspace }}/dss_capi'
2929
CONDA: "/opt/miniconda/"
30+
DSS_CAPI_BUILD_ODDIE: '1'
3031
steps:
3132
- name: 'Checkout'
3233
run: |
@@ -166,6 +167,7 @@ jobs:
166167
CONDA_SUBDIR: 'win-64'
167168
DSS_CAPI_PATH: '${{ github.workspace }}\dss_capi'
168169
PYTHON: python
170+
DSS_CAPI_BUILD_ODDIE: '1'
169171
steps:
170172
- uses: actions/checkout@v3
171173
with:

dss_build.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cffi import FFI
22
import sys, re, os
3-
from dss_setup_common import PLATFORM_FOLDER
3+
from dss_setup_common import PLATFORM_FOLDER, BUILD_ODDIE
44

55
def process_header(src, extern_py=False, implement_py=False, prefix=''):
66
'''Prepare the DSS C-API headers for parsing and building with CFFI'''
@@ -76,7 +76,11 @@ def process_header(src, extern_py=False, implement_py=False, prefix=''):
7676
src_path = os.environ.get('SRC_DIR', '')
7777
DSS_CAPI_PATH = os.environ.get('DSS_CAPI_PATH', os.path.join(src_path, '..', 'dss_capi'))
7878

79-
for version in ('dss_capi', 'dss_capid', 'altdss_oddie_capi'):
79+
VERSIONS = ['dss_capi', 'dss_capid']
80+
if BUILD_ODDIE:
81+
VERSIONS.append('altdss_oddie_capi')
82+
83+
for version in VERSIONS:
8084
ffi_builder_dss = FFI()
8185
debug = 'd' if version.endswith('d') else ''
8286

@@ -169,7 +173,9 @@ def process_header(src, extern_py=False, implement_py=False, prefix=''):
169173
# needs a list of strings and cannot handle objects directly
170174
ffi_builder_ = ffi_builders['dss_capi']
171175
ffi_builder_d = ffi_builders['dss_capid']
172-
ffi_builder_odd = ffi_builders['altdss_oddie_capi']
176+
if BUILD_ODDIE:
177+
ffi_builder_odd = ffi_builders['altdss_oddie_capi']
178+
173179
ffi_builder_GenUserModel = ffi_builders['GenUserModel']
174180
#ffi_builder_PVSystemUserModel = ffi_builders['PVSystemUserModel']
175181
#ffi_builder_StoreDynaModel = ffi_builders['StoreDynaModel']

dss_setup_common.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import sys, os, platform
22

3+
BUILD_ODDIE = os.environ.get('DSS_CAPI_BUILD_ODDIE', '') == '1'
4+
35
# Not complete but should suffice for the moment
46
if 'linux' in sys.platform.lower():
57
uname = os.uname()

setup.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup
22
import re, shutil, os, io
3-
from dss_setup_common import PLATFORM_FOLDER, DLL_SUFFIX
3+
from dss_setup_common import PLATFORM_FOLDER, DLL_SUFFIX, BUILD_ODDIE
44
import glob
55

66
MANYLINUX = os.environ.get('DSS_PYTHON_BACKEND_MANYLINUX', '0') == '1'
@@ -13,6 +13,7 @@
1313
# 1. Try env var DSS_PYTHON_BACKEND_VERSION
1414
# 2. Try GITHUB_REF for a Git tag
1515
# 3. Otherwise, just use the hardcoded version
16+
1617
package_version = os.environ.get('DSS_PYTHON_BACKEND_VERSION')
1718
github_ref = os.environ.get('GITHUB_REF')
1819
if package_version is None and github_ref is not None:
@@ -84,6 +85,11 @@
8485
'dss_python_backend': ['*{}'.format(DLL_SUFFIX)] + extra_files
8586
})
8687

88+
89+
VERSIONS = ['', 'd']
90+
if BUILD_ODDIE:
91+
VERSIONS.append('odd')
92+
8793
setup(
8894
name="dss_python_backend",
8995
description="Low-level Python bindings and native libs for DSS-Python. Not intended for direct usage, see DSS-Python instead.",
@@ -95,7 +101,7 @@
95101
license="BSD",
96102
packages=['dss_python_backend'],
97103
setup_requires=["cffi>=1.11.2"],
98-
cffi_modules=["dss_build.py:ffi_builder_{}".format(version) for version in ('', 'd', 'odd')] +
104+
cffi_modules=["dss_build.py:ffi_builder_{}".format(version) for version in VERSIONS] +
99105
[
100106
'dss_build.py:ffi_builder_GenUserModel',
101107
#'dss_build.py:ffi_builder_PVSystemUserModel',

0 commit comments

Comments
 (0)