From: Serge Rehbinder Date: Mon, 7 Nov 2016 08:36:25 +0000 (+0100) Subject: fix bug in package: sometimes, os.getcwd can fail X-Git-Tag: 5.0.0a1~55 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=92b4229dcf4a009e67dbcaca5c7c2a7286aff9af;p=tools%2Fsat.git fix bug in package: sometimes, os.getcwd can fail --- diff --git a/commands/package.py b/commands/package.py index d372807..4e5400b 100644 --- a/commands/package.py +++ b/commands/package.py @@ -363,16 +363,21 @@ def source_package(sat, config, logger, options, tmp_working_dir): tmp_sat = add_salomeTools(config, tmp_working_dir) d_sat = {"salomeTools" : (tmp_sat, "salomeTools")} - # Add a sat symbolic link - tmp_satlink_path = os.path.join(tmp_working_dir, 'sat') - t = os.getcwd() - os.chdir(tmp_working_dir) - if os.path.lexists(tmp_satlink_path): - os.remove(tmp_satlink_path) - os.symlink(os.path.join('salomeTools', 'sat'), 'sat') - os.chdir(t) - - d_sat["sat link"] = (tmp_satlink_path, "sat") + # Add a sat symbolic link if not win + if not src.architecture.is_windows(): + tmp_satlink_path = os.path.join(tmp_working_dir, 'sat') + try: + t = os.getcwd() + except: + # In the jobs, os.getcwd() can fail + t = config.USER.workdir + os.chdir(tmp_working_dir) + if os.path.lexists(tmp_satlink_path): + os.remove(tmp_satlink_path) + os.symlink(os.path.join('salomeTools', 'sat'), 'sat') + os.chdir(t) + + d_sat["sat link"] = (tmp_satlink_path, "sat") return src.merge_dicts(d_archives, d_archives_vcs, d_project, d_sat)