@@ -143,23 +143,14 @@ def patch_standard_packages(self, package_name="", to_movable=True):
143143 """patch Winpython packages in need"""
144144 import filecmp
145145
146- # Adpating to PyPy
147- if "pypy3" in Path (utils .get_python_executable (self .target )).name :
148- site_package_place = "\\ site-packages\\ "
149- else :
150- site_package_place = "\\ Lib\\ site-packages\\ "
151146 # 'pywin32' minimal post-install (pywin32_postinstall.py do too much)
152147 if package_name .lower () == "pywin32" or package_name == "" :
153- origin = self .target + site_package_place + "pywin32_system32"
154-
155- destin = self .target
156- if Path (origin ).is_dir ():
148+ origin = Path (self .target ) / "site-packages" / "pywin32_system32"
149+ destin = Path (self .target )
150+ if origin .is_dir ():
157151 for name in os .listdir (origin ):
158- here , there = (
159- str (Path (origin ) / name ),
160- str (Path (destin ) / name ),
161- )
162- if not Path (there ).exists () or not filecmp .cmp (here , there ):
152+ here , there = (origin / name ), (destin / name )
153+ if not there .exists () or not filecmp .cmp (here , there ):
163154 shutil .copyfile (here , there )
164155 # 'pip' to do movable launchers (around line 100) !!!!
165156 # rational: https://github.com/pypa/pip/issues/2328
@@ -171,27 +162,21 @@ def patch_standard_packages(self, package_name="", to_movable=True):
171162 sheb_mov1 = " executable = os.path.join(os.path.basename(get_executable()))"
172163 sheb_mov2 = " executable = os.path.join('..',os.path.basename(get_executable()))"
173164
174- # Adpating to PyPy
175- the_place = site_package_place + r"pip\_vendor\distlib\scripts.py"
165+ the_place = Path (self .target ) / "lib" / "site-packages" / "pip" / "_vendor" / "distlib" / "scripts.py"
176166 print (the_place )
177167 if to_movable :
178- utils .patch_sourcefile (self . target + the_place , sheb_fix , sheb_mov1 )
179- utils .patch_sourcefile (self . target + the_place , sheb_mov2 , sheb_mov1 )
168+ utils .patch_sourcefile (the_place , sheb_fix , sheb_mov1 )
169+ utils .patch_sourcefile (the_place , sheb_mov2 , sheb_mov1 )
180170 else :
181- utils .patch_sourcefile (self . target + the_place , sheb_mov1 , sheb_fix )
182- utils .patch_sourcefile (self . target + the_place , sheb_mov2 , sheb_fix )
171+ utils .patch_sourcefile (the_place , sheb_mov1 , sheb_fix )
172+ utils .patch_sourcefile (the_place , sheb_mov2 , sheb_fix )
183173
184174 # create movable launchers for previous package installations
185175 self .patch_all_shebang (to_movable = to_movable )
186176 if package_name .lower () == "spyder" or package_name == "" :
187177 # spyder don't goes on internet without I ask
188178 utils .patch_sourcefile (
189- self .target + (site_package_place + r"spyderlib\config\main.py" ),
190- "'check_updates_on_startup': True," ,
191- "'check_updates_on_startup': False," ,
192- )
193- utils .patch_sourcefile (
194- self .target + (site_package_place + r"spyder\config\main.py" ),
179+ Path (self .target ) / "lib" / "site-packages" / "spyder" / "config" / "main.py" ,
195180 "'check_updates_on_startup': True," ,
196181 "'check_updates_on_startup': False," ,
197182 )
0 commit comments