Skip to content

Commit

Permalink
Merge pull request #43 from fredboudon/master
Browse files Browse the repository at this point in the history
Upgrade to new namespace convention. Add py 3.11 and py3.12
  • Loading branch information
pradal authored Jan 28, 2024
2 parents 41c66aa + 2e8889f commit 9433221
Show file tree
Hide file tree
Showing 128 changed files with 43,335 additions and 46,815 deletions.
110 changes: 13 additions & 97 deletions .github/workflows/conda-package-build.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,21 @@
name: Building Package using Conda
name: Building Package

on:
push:
branches: [ master ]
branches:
- '**'
tags:
- 'v*'
pull_request:
branches: [ master ]
branches:
- '**'


jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
#max-parallel: 5
matrix:
os: [ macos-latest, ubuntu-latest]
env:
- CONDA_PY: "37"
CONDA_NPY: "111"
- CONDA_PY: "38"
CONDA_NPY: "116"
- CONDA_PY: "39"
CONDA_NPY: "119"

environment: anaconda_build

steps:
- uses: actions/checkout@v2

- name: Add conda to system path
run: |
# Add conda to system path
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Setup conda
run: |
# Setup conda
sudo conda config --add channels conda-forge
sudo conda config --add channels openalea3
sudo conda config --set always_yes yes
sudo conda config --set remote_read_timeout_secs 600
sudo conda config --set auto_update_conda False
sudo conda install conda-build anaconda-client
- name: Build
env:
CONDA_PY: ${{ matrix.env.CONDA_PY }}
CONDA_NPY: ${{ matrix.env.CONDA_NPY }}
run: |
# Build
if [[ "$CONDA_PY" = "" ]]; then
echo "CONDA_PY is not defined"
exit -1
fi
if [[ "$CONDA_NPY" = "" ]]; then
echo "CONDA_NPY is not defined"
exit -1
fi
export PYTHON_VERSION=${CONDA_PY:0:1}.${CONDA_PY:1:1}
export NUMPY_VERSION=${CONDA_NPY:0:1}.${CONDA_NPY:1:2}
export BUILD_CMD="sudo conda build . --python=$PYTHON_VERSION"
export BUILD_OUTPUT=`$BUILD_CMD --output`
if [[ "$BUILD_OUTPUT" = "" ]]; then
echo "PACKAGE NAME is not defined"
exit -1
fi
echo "BUILD_OUTPUT=$BUILD_OUTPUT" >> $GITHUB_ENV
$BUILD_CMD
- name: Login
env:
ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD }}
run: |
# Login
if [[ "$ANACONDA_LOGIN" = "" ]]; then
echo "ANACONDA_LOGIN is not defined"
exit -1
fi
SESSION_UID=$(uuidgen)
anaconda login --username $ANACONDA_LOGIN --password $ANACONDA_PASSWORD --hostname $SESSION_UID
- name: Deploy
env:
ANACONDA_OWNER: ${{ secrets.ANACONDA_OWNER }}
BUILD_OUTPUT: ${{ env.BUILD_OUTPUT }}
run: |
# Deploy
if [[ "$ANACONDA_OWNER" = "" ]]; then
echo "ANACONDA_OWNER is not defined"
exit -1
fi
echo "PACKAGE NAME:" $BUILD_OUTPUT
if [[ "$BUILD_OUTPUT" = "" ]]; then
echo "PACKAGE NAME is not defined"
exit -1
fi
anaconda upload --skip-existing $BUILD_OUTPUT -u $ANACONDA_OWNER --no-progress
uses: openalea/github-action-conda-build/.github/workflows/conda-package-build.yml@main
with:
conda-channels: openalea3, conda-forge
secrets:
anaconda_token: ${{ secrets.ANACONDA_TOKEN }}

5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ src/openalea/lpy/gui/logindialog.py
src/openalea/lpy/gui/lpymainwindow.py
src/openalea/lpy/gui/lpyprefwidget.py
src/openalea/lpy/gui/py2exe_release.py
#src/openalea/lpy/gui/lpyresources_rc.py
src/openalea/lpy/gui/lpyresources_rc.py
src/openalea/lpy/gui/scalarfloatmetaedit.py
src/openalea/lpy/gui/scalarmetaedit.py

# lpy temp file
*.lpy~
*.py~
*.*~
\#*\#

# C extensions
Expand Down
26 changes: 20 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ project(lpy_project CXX)

# --- Build setup

set(CMAKE_INCLUDE_PATH "$ENV{CONDA_PREFIX}/include" ${CMAKE_INCLUDE_PATH})
set(CMAKE_LIBRARY_PATH "$ENV{CONDA_PREFIX}/lib" ${CMAKE_LIBRARY_PATH})
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
Expand All @@ -35,6 +37,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")

# To fix compilation error with vc14 and boost
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DHAVE_SNPRINTF")
endif()

## When linking, Python libs are required, so I advised I could use: "target_library_link(targetname ${Python3_LIBRARIES})"
Expand All @@ -51,25 +56,34 @@ endif()

# --- Python

find_package (Python3 COMPONENTS Interpreter Development REQUIRED)
set(Python3_FIND_VIRTUALENV FIRST)
if (WIN32)
# needed when we run cmake in a conda environment
set(Python3_FIND_REGISTRY LAST)
endif()

find_package (Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
include_directories(${Python3_INCLUDE_DIRS})

# --- Libraries

find_package(Threads REQUIRED)
find_package(Qt5Core CONFIG REQUIRED)
find_package(Qt5Concurrent CONFIG REQUIRED)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Concurrent)
find_package(PlantGL REQUIRED)

set(Boost_NO_SYSTEM_PATHS ON)
set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF)
set(BUILD_SHARED_LIBS ON)

if (USE_CONDA)

set(boost_python python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
find_package(Boost 1.69 COMPONENTS system ${boost_python} REQUIRED)
if (NOT Boost_FOUND)
message("Boost not found, trying again")
set(boost_python python)
else()
set(boost_python python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
find_package(Boost 1.69 COMPONENTS system ${boost_python} REQUIRED)
endif()

find_package(Boost COMPONENTS system ${boost_python} REQUIRED)
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ environment:
CONDA_VERSION: 3

matrix:
- CONDA_PY: 37
- CONDA_PY: 38
CONDA_NPY: 116
- CONDA_PY: 39
CONDA_NPY: 119
- CONDA_PY: 310
CONDA_NPY: 121

install:
- git clone https://github.com/OpenAlea/appveyor-ci.git appveyor-ci
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
conda build . -c conda-forge -c fredboudon -c defaults --python=3.7
conda mambabuild . -c conda-forge -c fredboudon --python=3.10 --no-test
4 changes: 2 additions & 2 deletions conda/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ echo "PYTHON:" ${PYTHON}
#export PYTHONPATH=${PREFIX}/lib/python${PY_VER}/site-packages/
${PYTHON} setup.py install --prefix=${PREFIX}

cp -r share `${PYTHON} -c "import os, openalea.lpy as lpy ; print(os.path.dirname(lpy.__file__))"`/..
#cp -r share `${PYTHON} -c "import os, openalea.lpy as lpy ; print(os.path.dirname(lpy.__file__))"`/..

echo
echo "****** CHECK PYTHON LIB"
Expand All @@ -71,6 +71,6 @@ else
export LDD='ldd'
fi

${LDD} `${PYTHON} -c "import openalea.lpy.__lpy_kernel__ as lpy ; print(lpy.__file__)"`
echo `${PYTHON} -c "import openalea.lpy.__lpy_kernel__ as lpy ; print(lpy.__file__)"`

echo "****** END OF BUILD PROCESS"
17 changes: 17 additions & 0 deletions conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cxx_compiler:
- gxx # [linux]
- clangxx # [osx]
- vs2019 # [win]
compiler_version:
- 11 # [osx]
- 11.2.0 # [linux]
cxx_compiler_version:
- 11 # [osx]
- 11.2.0 # [linux]
MACOSX_DEPLOYMENT_TARGET: # [osx]
- '10.12' # [osx]
MACOSX_SDK_VERSION: # [osx and x86_64]
- '10.12' # [osx and x86_64]
pin_run_as_build:
boost: x.x
openalea.plantgl: x.x
31 changes: 16 additions & 15 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@ about:

build:
preserve_egg_dir: True
number: 0
number: 1
requirements:
host:
- python x.x
- setuptools
- openalea.plantgl >=3.17
- boost
- pyqt
build:
- binutils_impl_linux-64<2.31.0 # [linux]
- binutils_impl_linux-64 # [linux]
- {{ compiler('cxx') }}
- python {{PY_VER}}
- cmake >=3.12.0
- python x.x
- cmake
- pkg-config # [linux]
- make # [unix]
- menuinst # [win]
host:
- python {{PY_VER}}
- setuptools
- openalea.plantgl
# - boost # provided by plantgl
- pyqt
run:
- python {{PY_VER}}
- python x.x
- setuptools
- {{ pin_compatible('openalea.plantgl', max_pin='x.x') }}
- {{ pin_compatible('boost', max_pin='x.x.x') }}
- boost
- pyqt
- ipython
- qtconsole
- jupyter_client # <6
- pyopengl
- pyqglviewer
- pyqglviewer >=1.3
- jsonschema

app:
Expand All @@ -52,11 +52,12 @@ app:
test:
requires:
- nose
- pandas
imports:
- openalea.lpy
source_files:
- test/
- share/
commands:
- nosetests -v -I test_predecessor_at_scale.py -I test_ui.py [unix]
- nosetests -v -I test_predecessor_at_scale.py -I test_ui.py -I test_axialtree.py -I test_successor_at_scale.py [win]
- nosetests -v -I test_predecessor_at_scale.py -I test_ui.py -I test_pickle.py [unix]
- nosetests -v -I test_predecessor_at_scale.py -I test_ui.py -I test_axialtree.py -I test_successor_at_scale.py -I test_pickle.py [win]
Binary file added doc/_images/gallery/tomato.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9433221

Please sign in to comment.