From e6118d2152a9e677373b1f68425addf75f02735d Mon Sep 17 00:00:00 2001 From: Diego Ferigo Date: Sun, 17 Oct 2021 14:12:18 +0200 Subject: [PATCH] Add packages: libscenario, scenariopy, scenario, gym-ignition --- recipes/gym-ignition/activate.sh | 1 + recipes/gym-ignition/build_gym_ignition.sh | 1 + recipes/gym-ignition/build_libscenario.sh | 16 +++ recipes/gym-ignition/build_scenariopy.sh | 11 ++ recipes/gym-ignition/deactivate.sh | 1 + recipes/gym-ignition/meta.yaml | 135 +++++++++++++++++++++ 6 files changed, 165 insertions(+) create mode 100644 recipes/gym-ignition/activate.sh create mode 100644 recipes/gym-ignition/build_gym_ignition.sh create mode 100644 recipes/gym-ignition/build_libscenario.sh create mode 100644 recipes/gym-ignition/build_scenariopy.sh create mode 100644 recipes/gym-ignition/deactivate.sh create mode 100644 recipes/gym-ignition/meta.yaml diff --git a/recipes/gym-ignition/activate.sh b/recipes/gym-ignition/activate.sh new file mode 100644 index 0000000000000..595856d26d5e5 --- /dev/null +++ b/recipes/gym-ignition/activate.sh @@ -0,0 +1 @@ +export IGN_GAZEBO_SYSTEM_PLUGIN_PATH="${IGN_GAZEBO_SYSTEM_PLUGIN_PATH}:${CONDA_PREFIX}/lib/scenario/plugins" diff --git a/recipes/gym-ignition/build_gym_ignition.sh b/recipes/gym-ignition/build_gym_ignition.sh new file mode 100644 index 0000000000000..9fba6d07aba86 --- /dev/null +++ b/recipes/gym-ignition/build_gym_ignition.sh @@ -0,0 +1 @@ +pip install --no-build-isolation --no-deps . diff --git a/recipes/gym-ignition/build_libscenario.sh b/recipes/gym-ignition/build_libscenario.sh new file mode 100644 index 0000000000000..8afec934ad934 --- /dev/null +++ b/recipes/gym-ignition/build_libscenario.sh @@ -0,0 +1,16 @@ +cmake \ + -S ./scenario/ \ + -B build/ \ + -GNinja \ + -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX \ + -DSCENARIO_USE_IGNITION:BOOL=ON \ + -DSCENARIO_ENABLE_BINDINGS:BOOL=OFF +cmake --build build/ +cmake --install build + +# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d. +# This will allow them to be run on environment activation. +for CHANGE in "activate" "deactivate" ; do + mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d" + cp "${RECIPE_DIR}/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh" +done diff --git a/recipes/gym-ignition/build_scenariopy.sh b/recipes/gym-ignition/build_scenariopy.sh new file mode 100644 index 0000000000000..4961b5b74d5f3 --- /dev/null +++ b/recipes/gym-ignition/build_scenariopy.sh @@ -0,0 +1,11 @@ +python \ + -m build \ + --wheel \ + --outdir dist \ + --no-isolation \ + --skip-dependency-check \ + "-C--global-option=build_ext" \ + "-C--global-option=-DSCENARIO_BUILD_SHARED_LIBRARY:BOOL=ON" \ + "-C--global-option=--component=python" \ + ./scenario/ +pip install --no-deps dist/*.whl diff --git a/recipes/gym-ignition/deactivate.sh b/recipes/gym-ignition/deactivate.sh new file mode 100644 index 0000000000000..71d5d43b91b26 --- /dev/null +++ b/recipes/gym-ignition/deactivate.sh @@ -0,0 +1 @@ +export IGN_GAZEBO_SYSTEM_PLUGIN_PATH="$(echo $IGN_GAZEBO_SYSTEM_PLUGIN_PATH | tr ':' '\n' | grep -v '/lib/scenario/plugins' | grep -v '^$' | tr '\n' ':'" diff --git a/recipes/gym-ignition/meta.yaml b/recipes/gym-ignition/meta.yaml new file mode 100644 index 0000000000000..834072db47106 --- /dev/null +++ b/recipes/gym-ignition/meta.yaml @@ -0,0 +1,135 @@ +{% set name = "gym-ignition-split" %} +{% set version = "1.3.0.post0" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://github.com/robotology/gym-ignition/archive/refs/tags/v{{ version }}.tar.gz + sha256: 6ae47711b0941f47030c1e9b7821d1259aa7e622d07914a261f1470d41d1524c + +build: + number: 0 + skip: true # [win] + +outputs: + + - name: libscenario + script: build_libscenario.sh # [unix] + build: + run_exports: + - {{ pin_subpackage("libscenario", max_pin="x.x") }} + requirements: + build: + - cmake + - ninja + - pkg-config + - {{ compiler("cxx") }} + - {{ cdt("mesa-libgl-devel") }} # [linux] + host: + - eigen + - idyntree + - libignition-gazebo6 + run: + test: + commands: + - test -f ${PREFIX}/lib/libGazeboSimulator.so # [linux] + - test -f ${PREFIX}/lib/libGazeboSimulator.dylib # [osx] + - test -f ${PREFIX}/lib/cmake/Scenario/ScenarioConfig.cmake # [unix] + - test -f ${PREFIX}/lib/cmake/ScenarioGazebo/ScenarioGazeboConfig.cmake # [unix] + + - name: scenariopy + script: build_scenariopy.sh # [unix] + build: + run_exports: + - {{ pin_subpackage("scenariopy", max_pin="x.x") }} + requirements: + build: + - cmake + - {{ compiler("cxx") }} + - {{ cdt("mesa-libgl-devel") }} # [linux] + - ninja + - pkg-config + - swig + host: + - build + - cmake-build-extension + - idyntree + - libignition-gazebo6 + - pip + - python + run: + - {{ pin_subpackage("libscenario", exact=True) }} + - packaging + test: + imports: + - scenario + commands: + - pip check + requires: + - pip + + - name: scenario + build: + run_exports: + - {{ pin_subpackage("scenario", max_pin="x.x") }} + requirements: + run: + - {{ pin_subpackage("scenariopy", exact=True) }} + - {{ pin_subpackage("libscenario", exact=True) }} + test: + imports: + - scenario + commands: + - pip check + - test -f ${PREFIX}/lib/libGazeboSimulator.so # [linux] + - test -f ${PREFIX}/lib/libGazeboSimulator.dylib # [osx] + - test -f ${PREFIX}/lib/cmake/Scenario/ScenarioConfig.cmake # [unix] + - test -f ${PREFIX}/lib/cmake/ScenarioGazebo/ScenarioGazeboConfig.cmake # [unix] + requires: + - pip + + - name: gym-ignition + build: + noarch: python + run_exports: + - {{ pin_subpackage("gym-ignition", max_pin="x.x") }} + script: build_gym_ignition.sh # [unix] + requirements: + host: + - pip + - python + run: + - gym + - gym-ignition-models + - idyntree + - lxml + - numpy + - {{ pin_subpackage("scenariopy", max_pin="x.x") }} + - scipy + test: + source_files: + - tests + - setup.cfg + imports: + - gym_ignition + commands: + # - pip check (needs idyntree installed with pip during conda build) + - sed -i "s|def test_angular_acceleration|def _test_angular_acceleration|g" tests/test_scenario/test_link_velocities.py + - pytest + requires: + - pip + - pytest + - pytest-icdiff + +about: + home: https://github.com/robotology/gym-ignition + summary: A toolkit for developing OpenAI Gym environments simulated with Ignition Gazebo. + dev_url: https://github.com/robotology/gym-ignition + license: LGPL-2.1-or-later + license_file: LICENSE + +extra: + recipe-maintainers: + - diegoferigo