You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2023/01/16 12:27:25 UTC
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #39603: [SPARK-42088][BUILD] Improve setup.py adaptation for Windows
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org