Skip to content

Commit

Permalink
Merge pull request #49 from open-space-collective/users/remy/add-new-…
Browse files Browse the repository at this point in the history
…python-versions-support

Add new python versions support
  • Loading branch information
Derollez authored Mar 25, 2021
2 parents bb65b11 + e6f9860 commit c796ad8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 39 deletions.
34 changes: 18 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export docker_registry_path := openspacecollective
export docker_image_repository := $(docker_registry_path)/$(project_name)
export docker_image_version := $(project_version)

export development_base_image_version := 0.2.0
export development_base_image_version := 0.2.1

export docker_development_image_repository := $(docker_image_repository)-development
export docker_release_image_cpp_repository := $(docker_image_repository)-cpp
Expand Down Expand Up @@ -252,7 +252,8 @@ _build-packages-cpp: _build-development-image
--volume="/app/build" \
--workdir=/app/build \
$(docker_development_image_repository):$(docker_image_version)-$(target) \
/bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=OFF -DCPACK_GENERATOR=$(package_generator) .. && make package && mkdir -p /app/packages/cpp && mv /app/build/*.$(package_extension) /app/packages/cpp"
/bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=OFF -DCPACK_GENERATOR=$(package_generator) .. \
&& make package && mkdir -p /app/packages/cpp && mv /app/build/*.$(package_extension) /app/packages/cpp"

build-packages-python: ## Build Python packages

Expand Down Expand Up @@ -408,14 +409,14 @@ _debug-python-release: _build-release-image-python

################################################################################################################################################################

test:
test: ## Run tests

@ echo "Running tests..."

@ make test-unit
@ make test-coverage

test-unit:
test-unit: ## Run unit tests

@ echo "Running unit tests..."

Expand Down Expand Up @@ -450,7 +451,7 @@ _test-unit-cpp: _build-development-image
--volume="/app/build" \
--workdir=/app/build \
$(docker_development_image_repository):$(docker_image_version)-$(target) \
/bin/bash -c "cmake -DBUILD_UNIT_TESTS=ON .. && make -j 4 && make test"
/bin/bash -c "cmake -DBUILD_UNIT_TESTS=ON -DBUILD_PYTHON_BINDINGS=OFF .. && make -j 4 && make test"

test-unit-python-debian: target := debian
test-unit-python-fedora: target := fedora
Expand All @@ -468,7 +469,7 @@ _test-unit-python: _build-release-image-python
$(docker_release_image_python_repository):$(docker_image_version)-$(target) \
/bin/bash -c "pip install pytest && pytest -sv ."

test-coverage:
test-coverage: ## Run test coverage

@ echo "Running coverage tests..."

Expand All @@ -495,11 +496,12 @@ _test-coverage-cpp: _build-development-image
--volume="/app/build" \
--workdir=/app/build \
$(docker_development_image_repository):$(docker_image_version)-$(target) \
/bin/bash -c "cmake -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_CODE_COVERAGE=ON .. && make -j 4 && make coverage && (rm -rf /app/coverage || true) && mkdir /app/coverage && mv /app/build/coverage* /app/coverage"
/bin/bash -c "cmake -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_CODE_COVERAGE=ON .. && make -j 4 && make coverage && (rm -rf /app/coverage || true) \
&& mkdir /app/coverage && mv /app/build/coverage* /app/coverage"

################################################################################################################################################################

deploy:
deploy: ## Deploy everything

@ echo "Deploying..."

Expand All @@ -508,14 +510,14 @@ deploy:
@ make deploy-packages
@ make deploy-documentation

deploy-images:
deploy-images: ## Deploy all images

@ echo "Deploying images..."

@ make deploy-development-images
@ make deploy-release-images

deploy-development-images:
deploy-development-images: ## Deploy development images

@ echo "Deploying development images..."

Expand All @@ -529,7 +531,7 @@ _deploy-development-image: _build-development-image
docker push $(docker_development_image_repository):$(docker_image_version)-$(target)
docker push $(docker_development_image_repository):latest-$(target)

deploy-release-images:
deploy-release-images: ## Deploy release images

@ echo "Deploying release images..."

Expand Down Expand Up @@ -567,7 +569,7 @@ deploy-release-image-jupyter: build-release-image-jupyter
docker push $(docker_release_image_jupyter_repository):$(docker_image_version)
docker push $(docker_release_image_jupyter_repository):latest

deploy-packages:
deploy-packages: ## Deploy packages

@ echo "Deploying packages..."

Expand All @@ -586,7 +588,7 @@ _deploy_packages:
@ make _deploy-packages-cpp target=$(target)
@ make _deploy-packages-python target=$(target)

deploy-packages-cpp:
deploy-packages-cpp: ## Deploy packages C++

@ echo "Deploying C++ packages..."

Expand All @@ -599,7 +601,7 @@ _deploy-packages-cpp: _build-packages-cpp

@ echo "TBI"

deploy-packages-python:
deploy-packages-python: ## Deploy packages Python

@ echo "Deploying Python packages..."

Expand Down Expand Up @@ -635,15 +637,15 @@ deploy-coverage-cpp-results: _test-coverage-cpp
$(docker_development_image_repository):$(docker_image_version)-$(target) \
/bin/bash -c "bash <(curl -s https://codecov.io/bash) -X gcov -y .codecov.yml -t ${ci_codecov_token}"

deploy-documentation: build-documentation
deploy-documentation: build-documentation ## Deploy documentation

@ echo "Deploying documentation..."

@ "$(project_directory)"/tools/ci/deploy-documentation.sh

################################################################################################################################################################

clean:
clean: ## Clean

@ echo "Cleaning up..."

Expand Down
22 changes: 9 additions & 13 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# @project Open Space Toolkit ▸ Mathematics
# @file bindings/python/CMakeLists.txt
# @author Lucas Brémond <lucas@loftorbital.com>
# @author Remy Derollez <remy@loftorbital.com>
# @license Apache License 2.0

################################################################################################################################################################
Expand Down Expand Up @@ -150,17 +150,13 @@ FUNCTION (PY_ADD_PACKAGE_DIRECTORY NAME)

# Build wheels with cmake
ADD_CUSTOM_COMMAND (OUTPUT ${OUTPUT}
COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}"
COMMAND cp -r "${CMAKE_CURRENT_SOURCE_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/test"
COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/tools/python/${PROJECT_GROUP}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_GROUP}/__init__.py"
COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/tools/python/${PROJECT_PATH}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/__init__.py"
# COMMAND cp "/usr/local/lib/libboost_${PYTHON_VERSION}.so.${BOOST_VERSION}.0" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/libboost_${PYTHON_VERSION}.so.${BOOST_VERSION}.0"
# COMMAND cp "/usr/local/lib/libboost_numpy37.so.${BOOST_VERSION}.0" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/libboost_numpy37.so.${BOOST_VERSION}.0"
COMMAND cp "${CMAKE_SOURCE_DIR}/lib/${SHARED_LIBRARY_TARGET}" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/libopen-space-toolkit-mathematics.so.0"
COMMAND cp "${CMAKE_SOURCE_DIR}/lib/${LIBRARY_TARGET}.*${EXTENSION}*.so" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/"
COMMAND python${PYTHON_VERSION} ${SETUP_PY} bdist_wheel --python-tag=py${EXTENSION}
COMMAND rm -rf "${CMAKE_CURRENT_BINARY_DIR}/build/lib"
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}"
COMMAND cp -r "${CMAKE_CURRENT_SOURCE_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/test"
COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/tools/python/${PROJECT_GROUP}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_GROUP}/__init__.py"
COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/tools/python/${PROJECT_PATH}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/__init__.py"
COMMAND cp "${CMAKE_SOURCE_DIR}/lib/${SHARED_LIBRARY_TARGET}" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/libopen-space-toolkit-mathematics.so.0"
COMMAND cp "${CMAKE_SOURCE_DIR}/lib/${LIBRARY_TARGET}.*${EXTENSION}*.so" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/"
COMMAND python${PYTHON_VERSION} ${SETUP_PY} build --build-base=./lib${EXTENSION} bdist_wheel --python-tag=py${EXTENSION} --bdist-dir=./dist${EXTENSION}
DEPENDS ${DEPS})

# Install package on the machine
Expand Down Expand Up @@ -193,7 +189,7 @@ FIND_PACKAGE (pybind11 2.6.0 REQUIRED)
### Python

# Decide on the versions to build for and support
SET (PYTHON_SEARCH_VERSIONS 2.7 3.5 3.6 3.7 3.8 3.9)
SET (PYTHON_SEARCH_VERSIONS 2.7 3.5 3.6 3.7 3.8 3.9 3.10)

MESSAGE (STATUS "Looking for available python versions...")
FOREACH (PYTHON_VERSION ${PYTHON_SEARCH_VERSIONS})
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

numpy>=1.17.4

open-space-toolkit-core>=0.4.2
open-space-toolkit-core>=0.4.3

################################################################################################################################################################
7 changes: 4 additions & 3 deletions bindings/python/tools/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ setuptools.setup(
'Operating System :: POSIX :: Linux'
],
keywords = 'open-space-collective open-space-toolkit mathematics',
packages = setuptools.find_packages(),
package_dir = {'': '${CMAKE_CURRENT_BINARY_DIR}/${NAME}'},
packages = setuptools.find_packages(where='${CMAKE_CURRENT_BINARY_DIR}/${NAME}'),
package_data = {
'': [
'${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/libopen-space-toolkit-mathematics.so.0',
'${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_PATH}/${LIBRARY_TARGET}.*${EXTENSION}*.so'
'${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/libopen-space-toolkit-mathematics.so.0',
'${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/${LIBRARY_TARGET}.*${EXTENSION}*.so'
]
},
install_requires = requirements
Expand Down
6 changes: 3 additions & 3 deletions docker/development/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ RUN git clone --branch 3.28 --depth 1 https://github.com/lucas-bremond/geometric
&& cp -r ./Include /usr/local/include/Gte \
&& rm -rf /tmp/geometric-tools-engine

## Open Space Toolkit ▸ Core [0.4.2]
## Open Space Toolkit ▸ Core [0.4.3]

RUN mkdir -p /tmp/open-space-toolkit-core \
&& cd /tmp/open-space-toolkit-core \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.2/open-space-toolkit-core-0.4.2-1.x86_64-runtime.deb \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.2/open-space-toolkit-core-0.4.2-1.x86_64-devel.deb \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.3/open-space-toolkit-core-0.4.3-1.x86_64-runtime.deb \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.3/open-space-toolkit-core-0.4.3-1.x86_64-devel.deb \
&& apt-get install -y ./*.deb \
&& rm -rf /tmp/open-space-toolkit-core

Expand Down
6 changes: 3 additions & 3 deletions docker/development/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ RUN git clone --branch 3.28 --depth 1 https://github.com/lucas-bremond/geometric
&& cp -r ./Include /usr/local/include/Gte \
&& rm -rf /tmp/geometric-tools-engine

## Open Space Toolkit ▸ Core [0.4.2]
## Open Space Toolkit ▸ Core [0.4.3]

RUN mkdir -p /tmp/open-space-toolkit-core \
&& cd /tmp/open-space-toolkit-core \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.2/open-space-toolkit-core-0.4.2-1.x86_64-runtime.rpm \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.2/open-space-toolkit-core-0.4.2-1.x86_64-devel.rpm \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.3/open-space-toolkit-core-0.4.3-1.x86_64-runtime.rpm \
&& wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/0.4.3/open-space-toolkit-core-0.4.3-1.x86_64-devel.rpm \
&& dnf install -y ./*.rpm \
&& rm -rf /tmp/open-space-toolkit-core

Expand Down

0 comments on commit c796ad8

Please sign in to comment.