Skip to content

Commit e6c9ed2

Browse files
committed
build exe with python3/pyqt5
1 parent 3e23697 commit e6c9ed2

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

dist/windows/m64py.iss.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ Source: "m64py\*.txt"; DestDir: "{app}";
2929
Source: "m64py\*.pyd"; DestDir: "{app}";
3030
Source: "m64py\*.exe"; DestDir: "{app}";
3131
Source: "m64py\*.dll"; DestDir: "{app}";
32+
Source: "m64py\*.zip"; DestDir: "{app}";
3233
Source: "m64py\AUTHORS"; DestDir: "{app}";
3334
Source: "m64py\COPYING"; DestDir: "{app}";
3435
Source: "m64py\README.md"; DestDir: "{app}";
3536
Source: "m64py\ChangeLog"; DestDir: "{app}";
3637
Source: "m64py\*.v64"; DestDir: "{app}\test";
37-
Source: "m64py\qt5_plugins\codecs\*.dll"; DestDir: "{app}\qt5_plugins\codecs";
38-
Source: "m64py\qt5_plugins\iconengines\*.dll"; DestDir: "{app}\qt5_plugins\iconengines";
39-
Source: "m64py\qt5_plugins\imageformats\*.dll"; DestDir: "{app}\qt5_plugins\imageformats";
38+
Source: "m64py\qt5_plugins\platforms\*.dll"; DestDir: "{app}\qt5_plugins\platforms";
4039
Source: "m64py\doc\*"; DestDir: "{app}\doc";
4140

4241
[Icons]

setup.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def finalize_options(self):
8080
def copy_emulator(self):
8181
tempdir = tempfile.mkdtemp()
8282
zippath = join(tempdir, basename(self.url))
83-
urllib.urlretrieve(self.url, zippath)
83+
urllib.request.urlretrieve(self.url, zippath)
8484
zf = zipfile.ZipFile(zippath)
8585
for name in zf.namelist():
8686
if self.arch in name:
@@ -101,17 +101,25 @@ def copy_emulator(self):
101101
shutil.rmtree(tempdir)
102102

103103
def copy_files(self):
104-
tempdir = tempfile.mkdtemp()
105104
dest_path = join(self.dist_dir, "m64py")
106105
rar_dir = join(os.environ["ProgramFiles(x86)"], "Unrar")
107106
if not os.path.isfile(join(rar_dir, "UnRAR.exe")):
108-
urllib.urlretrieve("http://www.rarlab.com/rar/unrarw32.exe", join(tempdir, "unrar.exe"))
107+
tempdir = tempfile.mkdtemp()
108+
urllib.request.urlretrieve("http://www.rarlab.com/rar/unrarw32.exe", join(tempdir, "unrar.exe"))
109109
subprocess.call([join(tempdir, "unrar.exe"), "-s"])
110+
shutil.rmtree(tempdir)
110111
shutil.copy(join(rar_dir, "UnRAR.exe"), dest_path)
111112
shutil.copy(join(rar_dir, "license.txt"), join(dest_path, "doc", "unrar-license.txt"))
112113
for file_name in ["AUTHORS", "ChangeLog", "COPYING", "LICENSES", "README.md"]:
113114
shutil.copy(join(BASE_DIR, file_name), dest_path)
114-
shutil.rmtree(tempdir)
115+
116+
import PyQt5
117+
qt5_dir = dirname(PyQt5.__file__)
118+
qwindows = join(qt5_dir, "plugins", "platforms", "qwindows.dll")
119+
qwindows_dest = join(dest_path, "qt5_plugins", "platforms")
120+
if not os.path.exists(qwindows_dest):
121+
os.makedirs(qwindows_dest)
122+
shutil.copy(qwindows, qwindows_dest)
115123

116124
def remove_files(self):
117125
dest_path = join(self.dist_dir, "m64py")
@@ -251,8 +259,6 @@ def set_rthook():
251259
hook_file += line + "\n"
252260
if "MEIPASS" in line:
253261
hook_file += "\nimport sip\n"
254-
hook_file += "sip.setapi('QString', 2)\n"
255-
hook_file += "sip.setapi('QVariant', 2)\n"
256262
with open(rthook, "w") as hook: hook.write(hook_file)
257263

258264

0 commit comments

Comments
 (0)