From de3fd7b75eb4a9902b56d857168a019df8c5f2ac Mon Sep 17 00:00:00 2001 From: Tristan Laurent <tristan.laurent@cs-soprasteria.com> Date: Fri, 9 Aug 2024 16:09:27 +0200 Subject: [PATCH] COMP: add Python to path in after_script of windows jobs --- .gitlab-ci.yml | 2 ++ CI/dev_env.ps1 | 10 +++++----- CI/setup_python.ps1 | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 CI/setup_python.ps1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dffb59b7f7..9de0283d17 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -236,6 +236,8 @@ stages: - git checkout -f -q $CI_COMMIT_SHA # Obviously Windows does not use same executable name as linux... after_script: + #Â need to setup path to be able to use python + - . "CI\setup_python.ps1" x64 - python -u CI/cdash_handler.py # - Win10 diff --git a/CI/dev_env.ps1 b/CI/dev_env.ps1 index 95ff786400..89afcf67b1 100644 --- a/CI/dev_env.ps1 +++ b/CI/dev_env.ps1 @@ -1,5 +1,5 @@ # -# Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES) +# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES) # # This file is part of Orfeo Toolbox # @@ -74,9 +74,11 @@ $Global:HOMEPATH="\Users\otbbot" #) echo "Home dir: $HOMEDRIVE$HOMEPATH" +# Get the folder of current script +$SCRIPT_DIR=Split-Path $MyInvocation.MyCommand.Path -Parent + # Setup Python -$env:PATH="C:\tools\Python310-$ARCH;$env:PATH" -$env:PATH="C:\tools\Python310-$ARCH\Scripts;$env:PATH" +. "$SCRIPT_DIR\setup_python.ps1" $ARCH # Setup GL dlls $env:PATH="$env:PATH;C:\tools\GL\$ARCH\bin" @@ -88,8 +90,6 @@ $env:PATH="$env:PATH;C:\tools\GL\$ARCH\bin" # see official M$ answer saying they wont do the job: # https://developercommunity.visualstudio.com/t/Provide-a-PowerShell-version-of-vcvarsal/10238319 -# Get the folder of current script -$SCRIPT_DIR=Split-Path $MyInvocation.MyCommand.Path -Parent . "$SCRIPT_DIR\Invoke-CmdScript.ps1" diff --git a/CI/setup_python.ps1 b/CI/setup_python.ps1 new file mode 100644 index 0000000000..77d808b50d --- /dev/null +++ b/CI/setup_python.ps1 @@ -0,0 +1,30 @@ +# +# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if ( $args.count -lt 1 ) { + echo "No arch" + echo "Usage: $0 <compiler_arch>" + echo " <compiler_arch> : 'x86' | 'x64'" + Break +} + +$ARCH=$args[0] + +$env:PATH="C:\tools\Python310-$ARCH;$env:PATH" +$env:PATH="C:\tools\Python310-$ARCH\Scripts;$env:PATH" -- GitLab