@@ -83,14 +83,22 @@ def is_external(file_: pathlib.Path) -> bool:
83
83
84
84
85
85
def find_site_packages (env_path : pathlib .Path ) -> pathlib .Path :
86
- lib_path = env_path / "lib"
86
+ if sys .platform == 'win32' :
87
+ lib_path = env_path / "Lib"
87
88
88
- # We should find one "pythonX.X" directory in here.
89
- for child in lib_path .iterdir ():
90
- if child .name .startswith ("python" ):
91
- site_packages_path = child / "site-packages"
92
- if site_packages_path .exists ():
93
- return site_packages_path
89
+ site_packages_path = lib_path / "site-packages"
90
+ if site_packages_path .exists ():
91
+ return site_packages_path
92
+
93
+ else :
94
+ lib_path = env_path / "lib"
95
+
96
+ # We should find one "pythonX.X" directory in here.
97
+ for child in lib_path .iterdir ():
98
+ if child .name .startswith ("python" ):
99
+ site_packages_path = child / "site-packages"
100
+ if site_packages_path .exists ():
101
+ return site_packages_path
94
102
95
103
raise Exception ("Unable to find site-packages path in venv" )
96
104
@@ -163,11 +171,14 @@ def entry_points(path: List[str], **params) -> importlib_metadata.EntryPoints:
163
171
164
172
def generate_console_scripts (env_path : pathlib .Path ) -> None :
165
173
site_packages = find_site_packages (env_path )
166
- bin = env_path / "bin"
174
+ if sys .platform == 'win32' :
175
+ bin_path = env_path / "Scripts"
176
+ else :
177
+ bin_path = env_path / "bin"
167
178
168
179
console_scripts = entry_points (path = [str (site_packages )], group = "console_scripts" )
169
180
for ep in console_scripts :
170
- script = bin / ep .name
181
+ script = bin_path / ep .name
171
182
if script .exists ():
172
183
continue
173
184
script .write_text (
0 commit comments