Skip to content

Commit e80da40

Browse files
Add Windows development setup script
- Create setup-windows-dev.py to handle symlink issues on Windows - Script replaces symlink directories with actual directories - Enables 'pip install -e .' and test execution on Windows - Addresses issue #2427 point 1
1 parent 4fea258 commit e80da40

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

setup-windows-dev.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Windows Development Setup Script for Kubernetes Python Client
4+
5+
This script helps Windows developers set up the repository by handling
6+
symlink directories that don't work properly on Windows.
7+
"""
8+
9+
import os
10+
import shutil
11+
import sys
12+
import subprocess
13+
14+
def is_windows():
15+
return sys.platform.startswith('win')
16+
17+
def setup_windows_directories():
18+
"""Replace symlink directories with actual directories for Windows development."""
19+
if not is_windows():
20+
print("This script is only needed on Windows systems.")
21+
return
22+
23+
symlink_dirs = [
24+
('kubernetes/config', 'kubernetes/base/config'),
25+
('kubernetes/watch', 'kubernetes/base/watch')
26+
]
27+
28+
for symlink_path, target_path in symlink_dirs:
29+
if os.path.exists(symlink_path):
30+
# Check if it's a symlink or text file (broken symlink on Windows)
31+
if os.path.isfile(symlink_path):
32+
print(f"Removing broken symlink file: {symlink_path}")
33+
os.remove(symlink_path)
34+
elif os.path.islink(symlink_path):
35+
print(f"Removing symlink: {symlink_path}")
36+
os.unlink(symlink_path)
37+
38+
if os.path.exists(target_path):
39+
print(f"Creating directory copy: {symlink_path} -> {target_path}")
40+
shutil.copytree(target_path, symlink_path)
41+
else:
42+
print(f"Warning: Target directory not found: {target_path}")
43+
44+
def main():
45+
print("Setting up Kubernetes Python Client for Windows development...")
46+
setup_windows_directories()
47+
print("Setup complete! You can now run 'pip install -e .' and tests.")
48+
49+
if __name__ == "__main__":
50+
main()

0 commit comments

Comments
 (0)