Skip to content

Commit

Permalink
For now, only add Oddie support only on Windows and Linux x64
Browse files Browse the repository at this point in the history
  • Loading branch information
PMeira committed Jun 26, 2024
1 parent 520adb0 commit be2f8bb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
CONDA_SUBDIR: 'linux-64'
DSS_CAPI_PATH: '${{ github.workspace }}/dss_capi'
CONDA: "/opt/miniconda/"
DSS_CAPI_BUILD_ODDIE: '1'
steps:
- name: 'Checkout'
run: |
Expand Down Expand Up @@ -166,6 +167,7 @@ jobs:
CONDA_SUBDIR: 'win-64'
DSS_CAPI_PATH: '${{ github.workspace }}\dss_capi'
PYTHON: python
DSS_CAPI_BUILD_ODDIE: '1'
steps:
- uses: actions/checkout@v3
with:
Expand Down
12 changes: 9 additions & 3 deletions dss_build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cffi import FFI
import sys, re, os
from dss_setup_common import PLATFORM_FOLDER
from dss_setup_common import PLATFORM_FOLDER, BUILD_ODDIE

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

for version in ('dss_capi', 'dss_capid', 'altdss_oddie_capi'):
VERSIONS = ['dss_capi', 'dss_capid']
if BUILD_ODDIE:
VERSIONS.append('altdss_oddie_capi')

for version in VERSIONS:
ffi_builder_dss = FFI()
debug = 'd' if version.endswith('d') else ''

Expand Down Expand Up @@ -169,7 +173,9 @@ def process_header(src, extern_py=False, implement_py=False, prefix=''):
# needs a list of strings and cannot handle objects directly
ffi_builder_ = ffi_builders['dss_capi']
ffi_builder_d = ffi_builders['dss_capid']
ffi_builder_odd = ffi_builders['altdss_oddie_capi']
if BUILD_ODDIE:
ffi_builder_odd = ffi_builders['altdss_oddie_capi']

ffi_builder_GenUserModel = ffi_builders['GenUserModel']
#ffi_builder_PVSystemUserModel = ffi_builders['PVSystemUserModel']
#ffi_builder_StoreDynaModel = ffi_builders['StoreDynaModel']
Expand Down
2 changes: 2 additions & 0 deletions dss_setup_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sys, os, platform

BUILD_ODDIE = os.environ.get('DSS_CAPI_BUILD_ODDIE', '') == '1'

# Not complete but should suffice for the moment
if 'linux' in sys.platform.lower():
uname = os.uname()
Expand Down
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup
import re, shutil, os, io
from dss_setup_common import PLATFORM_FOLDER, DLL_SUFFIX
from dss_setup_common import PLATFORM_FOLDER, DLL_SUFFIX, BUILD_ODDIE
import glob

MANYLINUX = os.environ.get('DSS_PYTHON_BACKEND_MANYLINUX', '0') == '1'
Expand All @@ -13,6 +13,7 @@
# 1. Try env var DSS_PYTHON_BACKEND_VERSION
# 2. Try GITHUB_REF for a Git tag
# 3. Otherwise, just use the hardcoded version

package_version = os.environ.get('DSS_PYTHON_BACKEND_VERSION')
github_ref = os.environ.get('GITHUB_REF')
if package_version is None and github_ref is not None:
Expand Down Expand Up @@ -84,6 +85,11 @@
'dss_python_backend': ['*{}'.format(DLL_SUFFIX)] + extra_files
})


VERSIONS = ['', 'd']
if BUILD_ODDIE:
VERSIONS.append('odd')

setup(
name="dss_python_backend",
description="Low-level Python bindings and native libs for DSS-Python. Not intended for direct usage, see DSS-Python instead.",
Expand All @@ -95,7 +101,7 @@
license="BSD",
packages=['dss_python_backend'],
setup_requires=["cffi>=1.11.2"],
cffi_modules=["dss_build.py:ffi_builder_{}".format(version) for version in ('', 'd', 'odd')] +
cffi_modules=["dss_build.py:ffi_builder_{}".format(version) for version in VERSIONS] +
[
'dss_build.py:ffi_builder_GenUserModel',
#'dss_build.py:ffi_builder_PVSystemUserModel',
Expand Down

0 comments on commit be2f8bb

Please sign in to comment.