From 0b9914e2f524194167373da72b9685e5e21bfca1 Mon Sep 17 00:00:00 2001 From: Paul Ferrell <51765748+Paul-Ferrell@users.noreply.github.com> Date: Thu, 7 Oct 2021 13:18:35 -0600 Subject: Fix for license symlinking issue. (#26576) When a symlink to a license file exists but is broken, the license symlink post-install hook fails because os.path.exists() checks the existence of the target not the symlink itself. os.path.lexists() is the proper function to use. --- lib/spack/spack/hooks/licensing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/spack/hooks/licensing.py b/lib/spack/spack/hooks/licensing.py index 8e789d9635..739da8bde6 100644 --- a/lib/spack/spack/hooks/licensing.py +++ b/lib/spack/spack/hooks/licensing.py @@ -175,7 +175,7 @@ def symlink_license(pkg): mkdirp(license_dir) # If example file already exists, overwrite it with a symlink - if os.path.exists(link_name): + if os.path.lexists(link_name): os.remove(link_name) if os.path.exists(target): -- cgit v1.2.3-60-g2f50