@@ -48,7 +48,7 @@ def write_if_different(path: Path, content: str) -> None:
48
48
path .write_text (content )
49
49
50
50
51
- def _create_data_dir ():
51
+ def _create_data_dir (use_symlinks = True ):
52
52
_data_dir .mkdir (parents = True , exist_ok = True )
53
53
54
54
def ln (source : str , target : str ) -> None :
@@ -58,29 +58,47 @@ def ln(source: str, target: str) -> None:
58
58
if dst .is_symlink ():
59
59
dst .unlink ()
60
60
elif dst .is_dir ():
61
- dst .rmdir ()
62
- dst .symlink_to (src , target_is_directory = True )
61
+ shutil .rmtree (dst )
62
+ else :
63
+ dst .unlink ()
64
+
65
+ if use_symlinks :
66
+ dst .symlink_to (src , target_is_directory = True )
67
+ else :
68
+ # For wheel/sdist, copy actual files instead of symlinks
69
+ if src .exists ():
70
+ shutil .copytree (src , dst , symlinks = False , dirs_exist_ok = True )
63
71
64
72
ln ("3rdparty/cutlass" , "cutlass" )
65
73
ln ("3rdparty/spdlog" , "spdlog" )
66
74
ln ("csrc" , "csrc" )
67
75
ln ("include" , "include" )
68
76
77
+ # Always ensure version.txt is present
78
+ version_file = _data_dir / "version.txt"
79
+ if not version_file .exists () or not use_symlinks :
80
+ shutil .copy (_root / "version.txt" , version_file )
81
+
69
82
70
83
def _prepare_for_wheel ():
71
- # Remove data directory
84
+ # For wheel, copy actual files instead of symlinks so they are included in the wheel
72
85
if _data_dir .exists ():
73
86
shutil .rmtree (_data_dir )
87
+ _create_data_dir (use_symlinks = False )
74
88
75
89
76
90
def _prepare_for_editable ():
77
- _create_data_dir ()
91
+ # For editable install, use symlinks so changes are reflected immediately
92
+ if _data_dir .exists ():
93
+ shutil .rmtree (_data_dir )
94
+ _create_data_dir (use_symlinks = True )
78
95
79
96
80
97
def _prepare_for_sdist ():
81
- # Remove data directory
98
+ # For sdist, copy actual files instead of symlinks so they are included in the tarball
82
99
if _data_dir .exists ():
83
100
shutil .rmtree (_data_dir )
101
+ _create_data_dir (use_symlinks = False )
84
102
85
103
86
104
def get_requires_for_build_wheel (config_settings = None ):
0 commit comments