From 19c70fbb7470b66e6ca7ea64783e16cd888c5e25 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Tue, 14 May 2024 17:03:37 +0200
Subject: [PATCH] getPlatform: fix possibly using before assignment

---
 jenkins/getPlatform.py | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/jenkins/getPlatform.py b/jenkins/getPlatform.py
index 224ff69487..3d84a27a26 100755
--- a/jenkins/getPlatform.py
+++ b/jenkins/getPlatform.py
@@ -13,15 +13,9 @@ import distro # replacement of platform.linux_distribution https://github.com/ni
 arch = platform.machine()
 
 system = platform.system()
-flagarch = 0
-flagcxx=0
 #---Determine external architecture and extra options----------------
-if os.getenv('ARCHITECTURE'):
-   architecture = os.getenv('ARCHITECTURE')
-   flagarch = 1
-if os.getenv('CXXOPTIONS'):
-   cxxoptions = os.getenv('cxxoptions')
-   flagcxx = 1
+architecture = os.getenv('ARCHITECTURE', None)
+cxxoptions = os.getenv('cxxoptions', None)
 #---Determine the OS and version--------------------------------------
 if system == 'Darwin' :
    if int(platform.mac_ver()[0].split('.')[0]) > 10 :
@@ -107,11 +101,11 @@ if buildtype == 'Release' : bt = 'opt'
 elif buildtype == 'Debug' : bt = 'dbg'
 else : bt = 'unk'
 
-if flagarch==1:
+if architecture:
    print('%s+%s-%s-%s-%s' %  (arch, architecture, osvers, compiler, bt))
-elif flagcxx==1:
+elif cxxoptions:
    print('%s+%s-%s-%s-%s' %  (arch, cxxoptions, osvers, compiler, bt))
-elif flagarch==1 and flagcxx==1:
+elif architecture and cxxoptions:  # we can never get here
    print('%s+%s+%s-%s-%s-%s' %  (arch, architecture, cxxoptions, osvers, compiler, bt))
 else:
    print('%s-%s-%s-%s' %  (arch, osvers, compiler, bt))
-- 
GitLab