@@ -68,7 +68,7 @@ def run(self):
6868class build_exe (Command ):
6969 """Needs PyQt5, rarfile, PyLZMA, PyWin32, PyInstaller, Inno Setup 5"""
7070 user_options = []
71- arch = "i686-w64-mingw32"
71+ arch = "i686-w64-mingw32.static "
7272 url = "https://bitbucket.org/ecsv/mupen64plus-mxe-daily/get/master.zip"
7373 dist_dir = join (BASE_DIR , "dist" , "windows" )
7474
@@ -101,6 +101,24 @@ def copy_emulator(self):
101101 zf .close ()
102102 shutil .rmtree (tempdir )
103103
104+ def move_files (self ):
105+ dest_path = join (self .dist_dir , "m64py" , "lib" )
106+ plugins_path = join (self .dist_dir , "m64py" , "qt5_plugins" )
107+ shutil .copytree (plugins_path , join (dest_path , "qt5_plugins" ))
108+ shutil .rmtree (plugins_path )
109+
110+ for file_name in glob .glob (join (self .dist_dir , "m64py" , "*.pyd" )):
111+ if "PyQt5" not in file_name :
112+ shutil .move (file_name , dest_path )
113+
114+ for file_name in glob .glob (join (self .dist_dir , "m64py" , "api*.dll" )):
115+ shutil .move (file_name , dest_path )
116+
117+ for file_name in glob .glob (join (self .dist_dir , "m64py" , "*.dll" )):
118+ print (file_name )
119+ if "python3" not in file_name and "mupen64plus" not in basename (file_name ):
120+ shutil .move (file_name , dest_path )
121+
104122 def copy_files (self ):
105123 dest_path = join (self .dist_dir , "m64py" )
106124 rar_dir = join (os .environ ["ProgramFiles(x86)" ], "Unrar" )
@@ -116,17 +134,17 @@ def copy_files(self):
116134
117135 import PyQt5
118136 qt5_dir = dirname (PyQt5 .__file__ )
119- qwindows = join (qt5_dir , "plugins" , "platforms" , "qwindows.dll" )
120- qwindows_dest = join (dest_path , "qt5_plugins" , "platforms" )
137+ qwindows = join (qt5_dir , "Qt" , " plugins" , "platforms" , "qwindows.dll" )
138+ qwindows_dest = join (dest_path , "lib" , " qt5_plugins" , "platforms" )
121139 if not os .path .exists (qwindows_dest ):
122140 os .makedirs (qwindows_dest )
123141 shutil .copy (qwindows , qwindows_dest )
124142
125143 def remove_files (self ):
126144 dest_path = join (self .dist_dir , "m64py" )
127- for dir_name in ["api" , "include" , " man6" , "applications" , "apps" ]:
128- shutil .rmtree (join (dest_path , dir_name ))
129- for file_name in glob .glob (join (dest_path , "icu*.dll " )):
145+ for dir_name in ["api" , "man6" , "applications" , "apps" ]:
146+ shutil .rmtree (join (dest_path , dir_name ), True )
147+ for file_name in glob .glob (join (dest_path , "glide*.exe " )):
130148 os .remove (file_name )
131149
132150 def run_build_installer (self ):
@@ -144,19 +162,20 @@ def run_build_installer(self):
144162 subprocess .call ([iscc , iss_out ])
145163
146164 def run_build (self ):
147- import PyInstaller .build
165+ import PyInstaller .building . build_main
148166 work_path = join (self .dist_dir , "build" )
149167 spec_file = join (self .dist_dir , "m64py.spec" )
150168 os .environ ["BASE_DIR" ] = BASE_DIR
151169 os .environ ["DIST_DIR" ] = self .dist_dir
152170 opts = {"distpath" : self .dist_dir , "workpath" : work_path , "clean_build" : True , "upx_dir" : None , "debug" : False }
153- PyInstaller .build .main (None , spec_file , True , ** opts )
171+ PyInstaller .building . build_main .main (None , spec_file , True , ** opts )
154172
155173 def run (self ):
156174 self .run_command ("build_qt" )
157175 set_rthook ()
158176 self .run_build ()
159177 self .copy_emulator ()
178+ self .move_files ()
160179 self .copy_files ()
161180 self .remove_files ()
162181 self .run_build_installer ()
@@ -197,6 +216,7 @@ def run(self):
197216 self .set_config_path ()
198217 self .run_build ()
199218 self .copy_emulator ()
219+ self .move_files ()
200220 self .copy_files ()
201221 self .remove_files ()
202222 self .run_build_zip ()
@@ -248,7 +268,7 @@ def copy_files(self):
248268 def remove_files (self ):
249269 dest_path = join (self .dist_dir , "dmg" , "M64Py.app" , "Contents" , "MacOS" )
250270 for dir_name in ["include" , "lib" ]:
251- shutil .rmtree (join (dest_path , dir_name ))
271+ shutil .rmtree (join (dest_path , dir_name ), True )
252272 os .remove (join (self .dist_dir , "dmg" , "M64Py.app" , "Contents" , "Resources" , "icon-windowed.icns" ))
253273
254274 def run_build_dmg (self ):
@@ -257,17 +277,16 @@ def run_build_dmg(self):
257277 subprocess .call (["hdiutil" , "create" , dst_path , "-srcfolder" , src_path ])
258278
259279 def run_build (self ):
260- import PyInstaller .build
280+ import PyInstaller .building . build_main
261281 work_path = join (self .dist_dir , "build" )
262282 spec_file = join (self .dist_dir , "m64py.spec" )
263283 os .environ ["BASE_DIR" ] = BASE_DIR
264284 os .environ ["DIST_DIR" ] = self .dist_dir
265285 opts = {"distpath" : self .dist_dir , "workpath" : work_path , "clean_build" : True , "upx_dir" : None , "debug" : False }
266- PyInstaller .build .main (None , spec_file , True , ** opts )
286+ PyInstaller .building . build_main .main (None , spec_file , True , ** opts )
267287
268288 def run (self ):
269289 self .run_command ("build_qt" )
270- set_rthook ()
271290 self .run_build ()
272291 self .copy_files ()
273292 self .copy_emulator ()
@@ -282,12 +301,13 @@ def set_rthook():
282301 module_dir = dirname (PyInstaller .__file__ )
283302 rthook = join (module_dir , "loader" , "rthooks" , "pyi_rth_qt5plugins.py" )
284303 with open (rthook , "r" ) as hook : data = hook .read ()
285- if "import sip" not in data :
304+ if 'sys._MEIPASS, "lib"' not in data :
286305 lines = data .split ("\n " )
287306 for line in lines :
288- hook_file += line + "\n "
289307 if "MEIPASS" in line :
290- hook_file += "\n import sip\n "
308+ hook_file += "d = os.path.join(sys._MEIPASS, \" lib\" , d)\n "
309+ else :
310+ hook_file += line + "\n "
291311 with open (rthook , "w" ) as hook : hook .write (hook_file )
292312
293313
@@ -357,7 +377,7 @@ def run(self):
357377 packages = ["m64py" , "m64py.core" , "m64py.frontend" , "m64py.ui" ],
358378 package_dir = {"" : "src" },
359379 scripts = ["m64py" ],
360- requires = ["PyQt5" ],
380+ requires = ["PyQt5" , "PySDL2" ],
361381 platforms = ["Linux" , "Windows" , "Darwin" ],
362382 cmdclass = cmdclass ,
363383 data_files = [
0 commit comments