Skip to content

Commit f31281b

Browse files
committed
fix build failing to deactivate spyder update
1 parent c13b4f0 commit f31281b

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed

generate_a_winpython_distro.bat

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ rem generate_a_winpython_distro.bat: to be launched from a winpython directory,
22
@echo on
33

44
REM Initialize variables
5-
if "%my_release_level%"=="" set my_release_level=b2
5+
if "%my_release_level%"=="" set my_release_level=b3
66
if "%my_create_installer%"=="" set my_create_installer=True
77

88
rem Set archive directory and log file
@@ -99,6 +99,7 @@ echo -------------------------------------- >>%my_archive_log%
9999
echo "(%date% %time%) Add requirement packages">>%my_archive_log%
100100
echo -------------------------------------- >>%my_archive_log%
101101
python -m pip install -r %my_requirements% -c %my_constraints% --pre --no-index --trusted-host=None --find-links=%my_find_links% >>%my_archive_log%
102+
python -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('spyder', to_movable=True)"
102103

103104
REM Archive success
104105
echo -------------------------------------- >>%my_archive_log%

winpython/wppm.py

+11-26
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)