From: mbs Date: Wed, 28 Jun 2023 16:37:54 +0000 (+0100) Subject: avoid 'OSError: [Errno 6] No such device or address' when calling set_env() method... X-Git-Tag: V9_12_0~70 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmbs%2Ffix_setenv;p=tools%2Fsat_salome.git avoid 'OSError: [Errno 6] No such device or address' when calling set_env() method inside a Docker container for automatic builds --- diff --git a/products/env_scripts/packagespy.py b/products/env_scripts/packagespy.py index bb5498c..b9e26f3 100644 --- a/products/env_scripts/packagespy.py +++ b/products/env_scripts/packagespy.py @@ -4,9 +4,17 @@ import os import platform import os +import getpass + +def get_login(): + try: + return os.getlogin() + except: + return getpass.getuser() + def set_env(env, prereq_dir, version): env.set("PACKAGESPY_ROOT_DIR",prereq_dir) - env.set("WORKDIR4LOG",os.path.join('tmp', os.getlogin())) + env.set("WORKDIR4LOG",os.path.join('tmp', get_login())) env.prepend('PYTHONPATH',os.path.join(prereq_dir, 'packagespy')) env.prepend('PATH',os.path.join(prereq_dir,'packagespy','bin'))