@@ -521,18 +521,20 @@ def patch_standard_packages(
521521 """patch Winpython packages in need"""
522522 import filecmp
523523
524+ # Adpating to PyPy
525+ if 'pypy3' in osp .basename (utils .get_python_executable (self .target )):
526+ site_package_place = "\\ site-packages\\ "
527+ else :
528+ site_package_place = "\\ Lib\\ site-packages\\ "
529+
530+
524531 # 'pywin32' minimal post-install (pywin32_postinstall.py do too much)
525532 if (
526533 package_name .lower () == "pywin32"
527534 or package_name == ''
528535 ):
529- origin = self .target + (
530- r"\Lib\site-packages\pywin32_system32"
531- )
532- if 'pypy3' in sys .executable :
533- origin = self .target + (
534- r"\site-packages\pywin32_system32"
535- )
536+ origin = self .target + site_package_place + "pywin32_system32"
537+
536538 destin = self .target
537539 if osp .isdir (origin ):
538540 for name in os .listdir (origin ):
@@ -556,10 +558,9 @@ def patch_standard_packages(
556558 sheb_fix = " executable = get_executable()"
557559 sheb_mov1 = " executable = os.path.join(os.path.basename(get_executable()))"
558560 sheb_mov2 = " executable = os.path.join('..',os.path.basename(get_executable()))"
559- if 'pypy3' in sys .executable :
560- the_place = r"\site-packages\pip\_vendor\distlib\scripts.py"
561- else :
562- the_place = r"\Lib\site-packages\pip\_vendor\distlib\scripts.py"
561+
562+ # Adpating to PyPy
563+ the_place = site_package_place + r"pip\_vendor\distlib\scripts.py"
563564 print (the_place )
564565 if to_movable :
565566 utils .patch_sourcefile (
@@ -591,7 +592,7 @@ def patch_standard_packages(
591592 # will be in standard pip 8.0.3
592593 utils .patch_sourcefile (
593594 self .target
594- + (r"\Lib\site-packages\ pip\wheel.py" ),
595+ + (site_package_place + r" pip\wheel.py" ),
595596 " writer.writerow((f, h, l))" ,
596597 " writer.writerow((normpath(f, lib_dir), h, l))" ,
597598 )
@@ -606,15 +607,15 @@ def patch_standard_packages(
606607 utils .patch_sourcefile (
607608 self .target
608609 + (
609- r"\Lib\site-packages\ spyderlib\config\main.py"
610+ site_package_place + r" spyderlib\config\main.py"
610611 ),
611612 "'check_updates_on_startup': True," ,
612613 "'check_updates_on_startup': False," ,
613614 )
614615 utils .patch_sourcefile (
615616 self .target
616617 + (
617- r"\Lib\site-packages\ spyder\config\main.py"
618+ site_package_place + r" spyder\config\main.py"
618619 ),
619620 "'check_updates_on_startup': True," ,
620621 "'check_updates_on_startup': False," ,
0 commit comments