From e6c9ed2d11b88d27f30f9b55a1968ee401d91120 Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Sun, 21 Dec 2014 16:27:11 +0100 Subject: [PATCH] build exe with python3/pyqt5 --- dist/windows/m64py.iss.in | 5 ++--- setup.py | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/dist/windows/m64py.iss.in b/dist/windows/m64py.iss.in index b77e1fd..89e4522 100644 --- a/dist/windows/m64py.iss.in +++ b/dist/windows/m64py.iss.in @@ -29,14 +29,13 @@ Source: "m64py\*.txt"; DestDir: "{app}"; Source: "m64py\*.pyd"; DestDir: "{app}"; Source: "m64py\*.exe"; DestDir: "{app}"; Source: "m64py\*.dll"; DestDir: "{app}"; +Source: "m64py\*.zip"; DestDir: "{app}"; Source: "m64py\AUTHORS"; DestDir: "{app}"; Source: "m64py\COPYING"; DestDir: "{app}"; Source: "m64py\README.md"; DestDir: "{app}"; Source: "m64py\ChangeLog"; DestDir: "{app}"; Source: "m64py\*.v64"; DestDir: "{app}\test"; -Source: "m64py\qt5_plugins\codecs\*.dll"; DestDir: "{app}\qt5_plugins\codecs"; -Source: "m64py\qt5_plugins\iconengines\*.dll"; DestDir: "{app}\qt5_plugins\iconengines"; -Source: "m64py\qt5_plugins\imageformats\*.dll"; DestDir: "{app}\qt5_plugins\imageformats"; +Source: "m64py\qt5_plugins\platforms\*.dll"; DestDir: "{app}\qt5_plugins\platforms"; Source: "m64py\doc\*"; DestDir: "{app}\doc"; [Icons] diff --git a/setup.py b/setup.py index ee89fac..dd108e0 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,7 @@ class build_exe(Command): def copy_emulator(self): tempdir = tempfile.mkdtemp() zippath = join(tempdir, basename(self.url)) - urllib.urlretrieve(self.url, zippath) + urllib.request.urlretrieve(self.url, zippath) zf = zipfile.ZipFile(zippath) for name in zf.namelist(): if self.arch in name: @@ -101,17 +101,25 @@ class build_exe(Command): shutil.rmtree(tempdir) def copy_files(self): - tempdir = tempfile.mkdtemp() dest_path = join(self.dist_dir, "m64py") rar_dir = join(os.environ["ProgramFiles(x86)"], "Unrar") if not os.path.isfile(join(rar_dir, "UnRAR.exe")): - urllib.urlretrieve("http://www.rarlab.com/rar/unrarw32.exe", join(tempdir, "unrar.exe")) + tempdir = tempfile.mkdtemp() + urllib.request.urlretrieve("http://www.rarlab.com/rar/unrarw32.exe", join(tempdir, "unrar.exe")) subprocess.call([join(tempdir, "unrar.exe"), "-s"]) + shutil.rmtree(tempdir) shutil.copy(join(rar_dir, "UnRAR.exe"), dest_path) shutil.copy(join(rar_dir, "license.txt"), join(dest_path, "doc", "unrar-license.txt")) for file_name in ["AUTHORS", "ChangeLog", "COPYING", "LICENSES", "README.md"]: shutil.copy(join(BASE_DIR, file_name), dest_path) - shutil.rmtree(tempdir) + + import PyQt5 + qt5_dir = dirname(PyQt5.__file__) + qwindows = join(qt5_dir, "plugins", "platforms", "qwindows.dll") + qwindows_dest = join(dest_path, "qt5_plugins", "platforms") + if not os.path.exists(qwindows_dest): + os.makedirs(qwindows_dest) + shutil.copy(qwindows, qwindows_dest) def remove_files(self): dest_path = join(self.dist_dir, "m64py") @@ -251,8 +259,6 @@ def set_rthook(): hook_file += line + "\n" if "MEIPASS" in line: hook_file += "\nimport sip\n" - hook_file += "sip.setapi('QString', 2)\n" - hook_file += "sip.setapi('QVariant', 2)\n" with open(rthook, "w") as hook: hook.write(hook_file)