summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-12-06 16:17:15 +0100
committerGitHub <noreply@github.com>2022-12-06 15:17:15 +0000
commite3bf7358d72976f3fa5821fc0fb0eb7470f4ea49 (patch)
tree939d44838b2ec23525d4d699597e8293f929f2f4 /lib
parentb58ec9e2b9bb969ba034b35ffe7412db6648e760 (diff)
downloadspack-e3bf7358d72976f3fa5821fc0fb0eb7470f4ea49.tar.gz
spack-e3bf7358d72976f3fa5821fc0fb0eb7470f4ea49.tar.bz2
spack-e3bf7358d72976f3fa5821fc0fb0eb7470f4ea49.tar.xz
spack-e3bf7358d72976f3fa5821fc0fb0eb7470f4ea49.zip
Avoid stat call in `llnl.util.symlink` on non-windows (#34321)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/symlink.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/symlink.py b/lib/spack/llnl/util/symlink.py
index 2b71441d4b..56d88e3f6c 100644
--- a/lib/spack/llnl/util/symlink.py
+++ b/lib/spack/llnl/util/symlink.py
@@ -23,7 +23,10 @@ def symlink(real_path, link_path):
On Windows, use junctions if os.symlink fails.
"""
- if not is_windows or _win32_can_symlink():
+ if not is_windows:
+ os.symlink(real_path, link_path)
+ elif _win32_can_symlink():
+ # Windows requires target_is_directory=True when the target is a dir.
os.symlink(real_path, link_path, target_is_directory=os.path.isdir(real_path))
else:
try: