diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2022-12-06 16:17:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 15:17:15 +0000 |
commit | e3bf7358d72976f3fa5821fc0fb0eb7470f4ea49 (patch) | |
tree | 939d44838b2ec23525d4d699597e8293f929f2f4 /lib | |
parent | b58ec9e2b9bb969ba034b35ffe7412db6648e760 (diff) | |
download | spack-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.py | 5 |
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: |