From f9a154aff5755fad2ede377656ad7546a3843509 Mon Sep 17 00:00:00 2001 From: mbs Date: Wed, 28 Jun 2023 17:37:54 +0100 Subject: [PATCH] avoid 'OSError: [Errno 6] No such device or address' when calling set_env() method inside a Docker container for automatic builds --- products/env_scripts/packagespy.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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')) -- 2.39.2