diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 72e0c58..a2b2d1b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -126,6 +126,11 @@ jobs: catkin-test-args: --no-deps build-packages: multi_contact_controller test-packages: multi_contact_controller + - name: Check python + run: | + set -e + set -x + python -c "from distutils import sysconfig; print(sysconfig.get_config_var(\"VERSION\"))" - name: Run simulation if: env.RUN_SIMULATION_STEPS == 'true' # https://github.com/jrl-umi3218/lipm_walking_controller/blob/b564d655388ae6a6725c504e5c74a62192e58c7c/.github/workflows/build.yml#L64-L92 diff --git a/cnoid/project/CMakeLists.txt b/cnoid/project/CMakeLists.txt index ae77663..ae905fe 100644 --- a/cnoid/project/CMakeLists.txt +++ b/cnoid/project/CMakeLists.txt @@ -1,3 +1,25 @@ +if(NOT ${CHOREONOID_USE_PYTHON2}) + execute_process( + COMMAND python3 -c "import sysconfig; print(sysconfig.get_config_var(\"VERSION\"))" + OUTPUT_VARIABLE PYTHON_VERSION + RESULT_VARIABLE PYTHON_VERSION_SUCCESS + OUTPUT_STRIP_TRAILING_WHITESPACE) +else() + execute_process( + COMMAND python2 -c "from distutils import sysconfig; print(sysconfig.get_config_var(\"VERSION\"))" + OUTPUT_VARIABLE PYTHON_VERSION + RESULT_VARIABLE PYTHON_VERSION_SUCCESS + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() +if(NOT PYTHON_VERSION_SUCCESS STREQUAL 0) + execute_process( + COMMAND python -c "from distutils import sysconfig; print(sysconfig.get_config_var(\"VERSION\"))" + OUTPUT_VARIABLE PYTHON_VERSION + RESULT_VARIABLE PYTHON_VERSION_SUCCESS + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() +message("-- Python version detected: ${PYTHON_VERSION}") + set(MCC_CNOID_CONFIG_FILE_LIST rtc.conf.choreonoid robot.conf @@ -5,6 +27,7 @@ set(MCC_CNOID_CONFIG_FILE_LIST PDcontroller.conf.choreonoid PDgains_sim.dat ) + foreach(CNOID_CONFIG_FILE IN LISTS MCC_CNOID_CONFIG_FILE_LIST) execute_process(COMMAND cmake -E create_symlink "${HRPSYSBASE_PREFIX}/share/hrpsys/samples/JVRC1/${CNOID_CONFIG_FILE}" diff --git a/cnoid/project/MCC_JVRC1_SampleField.in.cnoid b/cnoid/project/MCC_JVRC1_SampleField.in.cnoid index 3cb8874..19cdd5d 100644 --- a/cnoid/project/MCC_JVRC1_SampleField.in.cnoid +++ b/cnoid/project/MCC_JVRC1_SampleField.in.cnoid @@ -530,7 +530,7 @@ OpenRTM: "deleteUnmanagedRTCsOnStartingSimulation": true Python: "moduleSearchPath": - - @HRPSYSBASE_PREFIX@/lib/python2.7/dist-packages/hrpsys + - @HRPSYSBASE_PREFIX@/lib/python@PYTHON_VERSION@/dist-packages/hrpsys viewAreas: - type: embedded