11 import sys |
11 import sys |
12 import shutil |
12 import shutil |
13 import zipfile |
13 import zipfile |
14 import compileall |
14 import compileall |
15 import glob |
15 import glob |
16 try: # Py3 |
16 import contextlib |
17 import urllib.parse as parse |
17 import urllib.parse |
18 except (ImportError): |
|
19 import urlparse as parse # __IGNORE_WARNING__ |
|
20 |
18 |
21 from PyQt5.QtCore import pyqtSlot, Qt, QDir, QFileInfo |
19 from PyQt5.QtCore import pyqtSlot, Qt, QDir, QFileInfo |
22 from PyQt5.QtWidgets import ( |
20 from PyQt5.QtWidgets import ( |
23 QWidget, QDialogButtonBox, QAbstractButton, QApplication, QDialog, |
21 QWidget, QDialogButtonBox, QAbstractButton, QApplication, QDialog, |
24 QVBoxLayout |
22 QVBoxLayout |
265 archive = archiveFilename |
263 archive = archiveFilename |
266 destination = self.destinationCombo.itemData( |
264 destination = self.destinationCombo.itemData( |
267 self.destinationCombo.currentIndex()) |
265 self.destinationCombo.currentIndex()) |
268 |
266 |
269 # check if archive is a local url |
267 # check if archive is a local url |
270 url = parse.urlparse(archive) |
268 url = urllib.parse.urlparse(archive) |
271 if url[0].lower() == 'file': |
269 if url[0].lower() == 'file': |
272 archive = url[2] |
270 archive = url[2] |
273 |
271 |
274 # check, if the archive exists |
272 # check, if the archive exists |
275 if not os.path.exists(archive): |
273 if not os.path.exists(archive): |
349 elif line.startswith("needsRestart"): |
347 elif line.startswith("needsRestart"): |
350 tokens = line.split("=") |
348 tokens = line.split("=") |
351 needsRestart = tokens[1].strip() == "True" |
349 needsRestart = tokens[1].strip() == "True" |
352 elif line.startswith("pyqtApi"): |
350 elif line.startswith("pyqtApi"): |
353 tokens = line.split("=") |
351 tokens = line.split("=") |
354 try: |
352 with contextlib.suppress(ValueError): |
355 pyqtApi = int(tokens[1].strip()) |
353 pyqtApi = int(tokens[1].strip()) |
356 except ValueError: |
|
357 pass |
|
358 elif line.startswith("doNotCompile"): |
354 elif line.startswith("doNotCompile"): |
359 tokens = line.split("=") |
355 tokens = line.split("=") |
360 if tokens[1].strip() == "True": |
356 if tokens[1].strip() == "True": |
361 doCompile = False |
357 doCompile = False |
362 elif line.startswith("# End-Of-Header"): |
358 elif line.startswith("# End-Of-Header"): |