Skip to content

Commit 78fef09

Browse files
authored
Merge pull request #973 from stonebig/master
PyPy compatibility preparation step4
2 parents 8550258 + 6e0416d commit 78fef09

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

make.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,7 @@ def make_all(
22192219
source_dirs=None,
22202220
toolsdirs=None,
22212221
docsdirs=None,
2222+
python_target_release=None, # 37101 for 3.7.10
22222223
):
22232224
"""Make WinPython distribution, for a given base directory and
22242225
architecture:
@@ -2298,7 +2299,20 @@ def make_all(
22982299
)
22992300
while not my_x.isdigit() and len(my_x) > 0:
23002301
my_x = my_x[:-1]
2301-
my_winpydir = (
2302+
2303+
# simplify for PyPy
2304+
if not python_target_release == None :
2305+
my_winpydir = (
2306+
'WPy'
2307+
+ ('%s' % architecture)
2308+
+ '-'
2309+
+ python_target_release
2310+
+ ''
2311+
+ ('%s' % build_number)
2312+
) + release_level
2313+
# + flavor
2314+
else:
2315+
my_winpydir = (
23022316
'WPy'
23032317
+ ('%s' % architecture)
23042318
+ '-'

winpython/wppm.py

+15-14
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)