HyukjinKwon commented on code in PR #39603:
URL: https://github.com/apache/spark/pull/39603#discussion_r1071181872
##########
python/setup.py:
##########
@@ -104,7 +105,16 @@
def _supports_symlinks():
"""Check if the system supports symlinks (e.g. *nix) or not."""
- return getattr(os, "symlink", None) is not None
+ return hasattr(os, "symlink") and (
+ (not hasattr(ctypes, "windll")) # Non-Windows
+ or (
+ # In some Windows, `os.symlink` works only for admins.
+ hasattr(ctypes, "windll")
+ and hasattr(ctypes.windll, "shell32")
Review Comment:
```suggestion
hasattr(ctypes.windll, "shell32")
```
##########
python/setup.py:
##########
@@ -104,7 +105,16 @@
def _supports_symlinks():
"""Check if the system supports symlinks (e.g. *nix) or not."""
- return getattr(os, "symlink", None) is not None
+ return hasattr(os, "symlink") and (
+ (not hasattr(ctypes, "windll")) # Non-Windows
+ or (
+ # In some Windows, `os.symlink` works only for admins.
Review Comment:
```suggestion
# In some Windows, `os.symlink` works but only for admins.
```
##########
python/setup.py:
##########
@@ -104,7 +105,16 @@
def _supports_symlinks():
"""Check if the system supports symlinks (e.g. *nix) or not."""
- return getattr(os, "symlink", None) is not None
+ return hasattr(os, "symlink") and (
+ (not hasattr(ctypes, "windll")) # Non-Windows
+ or (
+ # In some Windows, `os.symlink` works only for admins.
+ hasattr(ctypes, "windll")
+ and hasattr(ctypes.windll, "shell32")
+ and hasattr(ctypes.windll.shell32, "IsUserAnAdmin")
+ and ctypes.windll.shell32.IsUserAnAdmin() != 0
Review Comment:
```suggestion
and bool(ctypes.windll.shell32.IsUserAnAdmin())
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]