From 6a86a888ec4e84a86a8e3d4523841a82fdb02783 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 16:51:24 +0100 Subject: [PATCH 01/27] fix freeze support --- src/urh/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/urh/main.py b/src/urh/main.py index db3bc0ad68..1f26c0f4e7 100755 --- a/src/urh/main.py +++ b/src/urh/main.py @@ -4,6 +4,8 @@ import re import os import sys +import multiprocessing + from PyQt5.QtCore import QTimer, Qt from PyQt5.QtGui import QPalette, QIcon, QColor @@ -153,9 +155,8 @@ def main(): constants.SEND_INDICATOR_COLOR = selection_color main_window = MainController() - import multiprocessing as mp # allow usage of prange (OpenMP) in Processes - mp.set_start_method("spawn") + multiprocessing.set_start_method("spawn") if sys.platform == "darwin": menu_bar = main_window.menuBar() @@ -164,8 +165,6 @@ def main(): # Ensure we get the app icon in windows taskbar import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("jopohl.urh") - import multiprocessing as mp - mp.freeze_support() main_window.showMaximized() # main_window.setFixedSize(1920, 1080 - 30) # Youtube @@ -182,4 +181,7 @@ def main(): if __name__ == "__main__": + if hasattr(sys, "frozen"): + multiprocessing.freeze_support() + main() From a673e595c45ca6dda6b33f1250f0476f6a5e7c11 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 16:55:49 +0100 Subject: [PATCH 02/27] try pyinstaller build --- data/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index e390ae1bf3..31f4d31300 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -126,7 +126,7 @@ jobs: displayName: "Build extensions" - script: | - pip install wheel twine six appdirs packaging cx_freeze + pip install wheel twine six appdirs packaging pyinstaller pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build dependencies" @@ -134,7 +134,7 @@ jobs: - script: python setup.py bdist_wheel displayName: "Build python wheel" - - script: python data\build_cx.py + - script: pyinstaller --windowed --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=urh.plugins.InsertSine.InsertSinePlugin --add-data "src/urh/plugins/InsertSine/*:urh/plugins/InsertSine" --add-data "src/urh/dev/native/lib/shared:." --exclude-module=matplotlib src/urhmain.py condition: eq(variables['python.version'], '3.6') displayName: "Build MSI" From 1346f509f232aeed8645e40068ad04968f3bc4e8 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 17:37:45 +0100 Subject: [PATCH 03/27] try pyinstaller --- data/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 31f4d31300..2165103daa 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -134,7 +134,7 @@ jobs: - script: python setup.py bdist_wheel displayName: "Build python wheel" - - script: pyinstaller --windowed --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=urh.plugins.InsertSine.InsertSinePlugin --add-data "src/urh/plugins/InsertSine/*:urh/plugins/InsertSine" --add-data "src/urh/dev/native/lib/shared:." --exclude-module=matplotlib src/urhmain.py + - script: pyinstaller --windowed --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=numpy.core._methods --hidden-import=numpy.core._dtype_ctyaddpes --add-data "src/urh/plugins;urh/plugins" --add-data "src/urh/dev/native/lib/shared;." --exclude-module=matplotlib src/urh/main.py condition: eq(variables['python.version'], '3.6') displayName: "Build MSI" From 626a7e4c120b2ce67c83702e3afbe95323522773 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 17:45:55 +0100 Subject: [PATCH 04/27] add hidden import --- data/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 2165103daa..077ef551f0 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -134,7 +134,7 @@ jobs: - script: python setup.py bdist_wheel displayName: "Build python wheel" - - script: pyinstaller --windowed --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=numpy.core._methods --hidden-import=numpy.core._dtype_ctyaddpes --add-data "src/urh/plugins;urh/plugins" --add-data "src/urh/dev/native/lib/shared;." --exclude-module=matplotlib src/urh/main.py + - script: pyinstaller --windowed --hidden-import=setuptools._vendor --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=numpy.core._methods --hidden-import=numpy.core._dtype_ctyaddpes --add-data "src/urh/plugins;urh/plugins" --add-data "src/urh/dev/native/lib/shared;." --exclude-module=matplotlib src/urh/main.py condition: eq(variables['python.version'], '3.6') displayName: "Build MSI" From 0f31b3811675741bcbf28cd90725375449a3b505 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 17:54:47 +0100 Subject: [PATCH 05/27] install setuptools --- data/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 077ef551f0..6e66a118b6 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -126,7 +126,7 @@ jobs: displayName: "Build extensions" - script: | - pip install wheel twine six appdirs packaging pyinstaller + pip install wheel twine six appdirs packaging setuptools pyinstaller pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build dependencies" @@ -134,7 +134,7 @@ jobs: - script: python setup.py bdist_wheel displayName: "Build python wheel" - - script: pyinstaller --windowed --hidden-import=setuptools._vendor --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=numpy.core._methods --hidden-import=numpy.core._dtype_ctyaddpes --add-data "src/urh/plugins;urh/plugins" --add-data "src/urh/dev/native/lib/shared;." --exclude-module=matplotlib src/urh/main.py + - script: pyinstaller --windowed --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=numpy.core._methods --hidden-import=numpy.core._dtype_ctyaddpes --add-data "src/urh/plugins;urh/plugins" --add-data "src/urh/dev/native/lib/shared;." --exclude-module=matplotlib src/urh/main.py condition: eq(variables['python.version'], '3.6') displayName: "Build MSI" From 06edd054c777e018a2d83a42112e12d84b097ebc Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 18:02:52 +0100 Subject: [PATCH 06/27] add upgrade to setuptools --- data/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 6e66a118b6..90635e3802 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -126,7 +126,7 @@ jobs: displayName: "Build extensions" - script: | - pip install wheel twine six appdirs packaging setuptools pyinstaller + pip install --upgrade wheel twine six appdirs packaging setuptools pyinstaller pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build dependencies" From 341cc794ab0d9113d898f8c5d6b074b68eabe867 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 19:06:55 +0100 Subject: [PATCH 07/27] add helper script --- data/azure-pipelines.yml | 2 +- data/pyinstaller_helper.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 data/pyinstaller_helper.py diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 90635e3802..421fe2e8fa 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -134,7 +134,7 @@ jobs: - script: python setup.py bdist_wheel displayName: "Build python wheel" - - script: pyinstaller --windowed --hidden-import=packaging.specifiers --hidden-import=packaging.requirements --hidden-import=numpy.core._methods --hidden-import=numpy.core._dtype_ctyaddpes --add-data "src/urh/plugins;urh/plugins" --add-data "src/urh/dev/native/lib/shared;." --exclude-module=matplotlib src/urh/main.py + - script: python data/pyinstaller_helper.py condition: eq(variables['python.version'], '3.6') displayName: "Build MSI" diff --git a/data/pyinstaller_helper.py b/data/pyinstaller_helper.py new file mode 100644 index 0000000000..282d019488 --- /dev/null +++ b/data/pyinstaller_helper.py @@ -0,0 +1,28 @@ +import os +import sys +from subprocess import call + +HIDDEN_IMPORTS = ["packaging.specifiers", "packaging.requirements", "numpy.core._methods", + "numpy.core._dtype_ctyaddpes"] +DATA = [("src/urh/dev/native/lib/shared", "."), ("src/urh/plugins", "urh/plugins"), ] +EXCLUDE = ["matplotlib"] + +cmd = ["pyinstaller", "--windowed"] + +for hidden_import in HIDDEN_IMPORTS: + cmd.append("--hidden-import={}".format(hidden_import)) + +for src, dst in DATA: + cmd.append("--add-data") + cmd.append('"{}{}{}"'.format(src, os.pathsep, dst)) + +for exclude in EXCLUDE: + cmd.append("--exclude-module={}".format(exclude)) + +cmd.extend(["--distpath", "./dist-{}".format(64 if sys.maxsize > 2**32 else 32)]) + +urh_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) +cmd.append(os.path.join(urh_path, "src/urh/main.py")) +cmd = " ".join(cmd) +print(cmd) +call(cmd, shell=True) From 413b11bdc02a0051f3668cd720f4c3ea1b2541f3 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Wed, 20 Feb 2019 19:18:40 +0100 Subject: [PATCH 08/27] add dep --- data/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 421fe2e8fa..86582158a6 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -126,7 +126,7 @@ jobs: displayName: "Build extensions" - script: | - pip install --upgrade wheel twine six appdirs packaging setuptools pyinstaller + pip install --upgrade wheel twine six appdirs packaging setuptools pyinstaller pywin32 pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build dependencies" From 09fafbb7b2ed8a196a1d635456d2540eae50221e Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Thu, 21 Feb 2019 21:21:03 +0100 Subject: [PATCH 09/27] add icon to windows --- data/pyinstaller_helper.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/pyinstaller_helper.py b/data/pyinstaller_helper.py index 282d019488..621fe1e53e 100644 --- a/data/pyinstaller_helper.py +++ b/data/pyinstaller_helper.py @@ -8,6 +8,8 @@ EXCLUDE = ["matplotlib"] cmd = ["pyinstaller", "--windowed"] +if sys.platform == "darwin": + cmd.append("--onefile") for hidden_import in HIDDEN_IMPORTS: cmd.append("--hidden-import={}".format(hidden_import)) @@ -22,6 +24,7 @@ cmd.extend(["--distpath", "./dist-{}".format(64 if sys.maxsize > 2**32 else 32)]) urh_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) +cmd.append('--icon="{}"'.format(os.path.join(urh_path, "data/icons/appicon.ico"))) cmd.append(os.path.join(urh_path, "src/urh/main.py")) cmd = " ".join(cmd) print(cmd) From d8db3a4940e854edbe83ddb41d2102c355025079 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Thu, 21 Feb 2019 21:36:21 +0100 Subject: [PATCH 10/27] proper naming --- data/pyinstaller_helper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/pyinstaller_helper.py b/data/pyinstaller_helper.py index 621fe1e53e..1d520d177b 100644 --- a/data/pyinstaller_helper.py +++ b/data/pyinstaller_helper.py @@ -29,3 +29,9 @@ cmd = " ".join(cmd) print(cmd) call(cmd, shell=True) + +suffix = "" +if sys.platform == "win32": + suffix = "-x{}".format(64 if sys.maxsize > 2**32 else 86) + +os.rename("./dist/main", "./dist/urh{}".format(suffix)) From e73d5c5d1132625b3db5fe47e6d676293c630e21 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Thu, 21 Feb 2019 21:46:16 +0100 Subject: [PATCH 11/27] proper naming --- data/pyinstaller_helper.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/data/pyinstaller_helper.py b/data/pyinstaller_helper.py index 1d520d177b..f1b3f3b417 100644 --- a/data/pyinstaller_helper.py +++ b/data/pyinstaller_helper.py @@ -21,8 +21,6 @@ for exclude in EXCLUDE: cmd.append("--exclude-module={}".format(exclude)) -cmd.extend(["--distpath", "./dist-{}".format(64 if sys.maxsize > 2**32 else 32)]) - urh_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) cmd.append('--icon="{}"'.format(os.path.join(urh_path, "data/icons/appicon.ico"))) cmd.append(os.path.join(urh_path, "src/urh/main.py")) From e8cdc09b1ffcadbc55f179d3bb3dc912fd143706 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 09:57:48 +0100 Subject: [PATCH 12/27] add innosetup --- data/azure-pipelines.yml | 10 +++++++++- data/inno.iss | 34 ++++++++++++++++++++++++++++++++++ data/pyinstaller_helper.py | 9 ++++----- src/urh/version.py | 4 ++++ 4 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 data/inno.iss diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 86582158a6..9bd54a6aae 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -136,7 +136,15 @@ jobs: - script: python data/pyinstaller_helper.py condition: eq(variables['python.version'], '3.6') - displayName: "Build MSI" + displayName: "Run PyInstaller" + + - script: | + choco install innosetup + python src/urh/version.py > C:\urh_version.txt + set /p URHVERSION= 2**32 else 86) - -os.rename("./dist/main", "./dist/urh{}".format(suffix)) + os.rename("./dist/urh", "./dist/urh-x{}".format(64 if sys.maxsize > 2**32 else 86)) diff --git a/src/urh/version.py b/src/urh/version.py index 7c38ef3ef7..a2f22966f8 100644 --- a/src/urh/version.py +++ b/src/urh/version.py @@ -1 +1,5 @@ VERSION = "2.5.5" + +if __name__ == '__main__': + # To read out version easy on command line for InnoSetup + print(VERSION) From f471ce3c25a308562f8de980d8ee3a3e6f7fe765 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 10:08:12 +0100 Subject: [PATCH 13/27] try other path --- data/inno.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/inno.iss b/data/inno.iss index 4ab1fdd76f..59d62bbfda 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -23,7 +23,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl" Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "..\dist\urh\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: dist\urh\*; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] From 2f59823293795597b1e8a9a37b3a84059667bb0a Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 10:18:28 +0100 Subject: [PATCH 14/27] fix name --- data/azure-pipelines.yml | 2 +- data/inno.iss | 2 +- data/pyinstaller_helper.py | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 9bd54a6aae..55db1df7e1 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -142,7 +142,7 @@ jobs: choco install innosetup python src/urh/version.py > C:\urh_version.txt set /p URHVERSION= 2**32 else 86)) From da7c0fed36fc20d155fe44a6efe2fb0f5a4552dc Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 10:20:57 +0100 Subject: [PATCH 15/27] change folder --- data/azure-pipelines.yml | 2 +- data/inno.iss | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 55db1df7e1..5d827d9b40 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -148,7 +148,7 @@ jobs: - task: PublishBuildArtifacts@1 inputs: - pathtoPublish: dist/ + pathtoPublish: C:dist/ artifactName: 'dist' displayName: "Publish Build Artifacts" diff --git a/data/inno.iss b/data/inno.iss index 4ab1fdd76f..4c516c64e6 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -12,6 +12,7 @@ AppUpdatesURL=https://github.com/jopohl/urh DefaultDirName={pf}\Universal Radio Hacker DisableProgramGroupPage=yes LicenseFile=..\LICENSE +OutputDir=c:\dist OutputBaseFilename=Universal.Radio.Hacker-{#Arch} Compression=lzma2/max SolidCompression=yes From 574a8c3b42b26bb8776e595c975b5fb03ea58f73 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 10:34:26 +0100 Subject: [PATCH 16/27] fix path --- data/azure-pipelines.yml | 2 +- data/inno.iss | 4 ++-- data/pyinstaller_helper.py | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 5d827d9b40..55db1df7e1 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -148,7 +148,7 @@ jobs: - task: PublishBuildArtifacts@1 inputs: - pathtoPublish: C:dist/ + pathtoPublish: dist/ artifactName: 'dist' displayName: "Publish Build Artifacts" diff --git a/data/inno.iss b/data/inno.iss index 4c516c64e6..bfef42d83d 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -12,7 +12,7 @@ AppUpdatesURL=https://github.com/jopohl/urh DefaultDirName={pf}\Universal Radio Hacker DisableProgramGroupPage=yes LicenseFile=..\LICENSE -OutputDir=c:\dist +OutputDir=..\dist OutputBaseFilename=Universal.Radio.Hacker-{#Arch} Compression=lzma2/max SolidCompression=yes @@ -24,7 +24,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl" Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "..\dist\urh\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "..\pyinstaller\urh\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff --git a/data/pyinstaller_helper.py b/data/pyinstaller_helper.py index 4f8bb47c2a..5597f718f6 100644 --- a/data/pyinstaller_helper.py +++ b/data/pyinstaller_helper.py @@ -24,6 +24,8 @@ urh_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) cmd.append('--icon="{}"'.format(os.path.join(urh_path, "data/icons/appicon.ico"))) +cmd.extend(["--distpath", "./pyinstaller"]) + os.rename(os.path.join(urh_path, "src/urh/main.py"), os.path.join(urh_path, "src/urh/urh.py")) cmd.append(os.path.join(urh_path, "src/urh/urh.py")) cmd = " ".join(cmd) From 313225cd8037594db219a6e7c78a129332c4b9fd Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 11:06:12 +0100 Subject: [PATCH 17/27] fix var --- data/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 55db1df7e1..98f9b2b240 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -142,7 +142,7 @@ jobs: choco install innosetup python src/urh/version.py > C:\urh_version.txt set /p URHVERSION= Date: Fri, 22 Feb 2019 11:18:39 +0100 Subject: [PATCH 18/27] use ultra compression --- data/inno.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/inno.iss b/data/inno.iss index bfef42d83d..414474b895 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -14,7 +14,7 @@ DisableProgramGroupPage=yes LicenseFile=..\LICENSE OutputDir=..\dist OutputBaseFilename=Universal.Radio.Hacker-{#Arch} -Compression=lzma2/max +Compression=lzma2/ultra SolidCompression=yes [Languages] From c086fd59a97c2aebb4566dd3ff5f9deded6c46aa Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 11:23:25 +0100 Subject: [PATCH 19/27] fix name --- data/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 98f9b2b240..511f4d3ef3 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -168,7 +168,7 @@ jobs: action: 'edit' tag: $(Build.SourceBranchName) repositoryName: jopohl/urh - assets: 'dist/*.msi' + assets: 'dist/*.exe' assetUploadMode: 'replace' addChangeLog: true From 97cc9b9eb8392acedaa2451afd8cc869c965eb77 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 13:43:49 +0100 Subject: [PATCH 20/27] bundle URH CLI --- data/inno.iss | 3 ++- data/pyinstaller_helper.py | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/data/inno.iss b/data/inno.iss index 414474b895..43bcdebe43 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -2,9 +2,10 @@ ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{8A0E36A6-DE56-46B8-BCC3-C16D1BC759CC} +AppId={{96abcdef-1337-4711-cafe-beef4a1ce42} AppName=Universal Radio Hacker AppVersion={#MyAppVersion} +VersionInfoVersion={#MyAppVersion} AppPublisher=Johannes Pohl AppPublisherURL=https://github.com/jopohl/urh AppSupportURL=https://github.com/jopohl/urh diff --git a/data/pyinstaller_helper.py b/data/pyinstaller_helper.py index 5597f718f6..8435e85084 100644 --- a/data/pyinstaller_helper.py +++ b/data/pyinstaller_helper.py @@ -1,13 +1,14 @@ import os +import shutil import sys from subprocess import call -HIDDEN_IMPORTS = ["packaging.specifiers", "packaging.requirements", "numpy.core._methods", - "numpy.core._dtype_ctyaddpes"] +HIDDEN_IMPORTS = ["packaging.specifiers", "packaging.requirements", + "numpy.core._methods", "numpy.core._dtype_ctypes"] DATA = [("src/urh/dev/native/lib/shared", "."), ("src/urh/plugins", "urh/plugins"), ] EXCLUDE = ["matplotlib"] -cmd = ["pyinstaller", "--windowed"] +cmd = ["pyinstaller"] if sys.platform == "darwin": cmd.append("--onefile") @@ -27,7 +28,13 @@ cmd.extend(["--distpath", "./pyinstaller"]) os.rename(os.path.join(urh_path, "src/urh/main.py"), os.path.join(urh_path, "src/urh/urh.py")) -cmd.append(os.path.join(urh_path, "src/urh/urh.py")) -cmd = " ".join(cmd) -print(cmd) -call(cmd, shell=True) +urh_cmd = cmd + ["--windowed", os.path.join(urh_path, "src/urh/urh.py")] +cli_cmd = cmd + [os.path.join(urh_path, "src/urh/cli/urh_cli.py")] + +for cmd in (urh_cmd, cli_cmd): + cmd = " ".join(cmd) + print(cmd) + sys.stdout.flush() + call(cmd, shell=True) + +shutil.copy("./pyinstaller/urh_cli/urh_cli.exe", "./pyinstaller/urh/urh_cli.exe") From 77922fd7851bf8357f25e2e24856e16513d1f0af Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 14:02:05 +0100 Subject: [PATCH 21/27] restore app ID --- data/inno.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/inno.iss b/data/inno.iss index 43bcdebe43..282524b4b1 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -2,7 +2,7 @@ ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{96abcdef-1337-4711-cafe-beef4a1ce42} +AppId={{8A0E36A6-DE56-46B8-BCC3-C16D1BC759CC} AppName=Universal Radio Hacker AppVersion={#MyAppVersion} VersionInfoVersion={#MyAppVersion} From 9f4f311cd15a4abfc8cb3f5de4ebc2dc51e6b4d0 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 14:07:25 +0100 Subject: [PATCH 22/27] change display name --- data/inno.iss | 1 + 1 file changed, 1 insertion(+) diff --git a/data/inno.iss b/data/inno.iss index 282524b4b1..6133872287 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -6,6 +6,7 @@ AppId={{8A0E36A6-DE56-46B8-BCC3-C16D1BC759CC} AppName=Universal Radio Hacker AppVersion={#MyAppVersion} VersionInfoVersion={#MyAppVersion} +UninstallDisplayName=Universal Radio Hacker AppPublisher=Johannes Pohl AppPublisherURL=https://github.com/jopohl/urh AppSupportURL=https://github.com/jopohl/urh From a3366e05cb0cd00dbe24e164c1cc4e229b35cf0c Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 14:08:02 +0100 Subject: [PATCH 23/27] exisiting app id --- data/inno.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/inno.iss b/data/inno.iss index 6133872287..5f9d806bc2 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -2,7 +2,7 @@ ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{8A0E36A6-DE56-46B8-BCC3-C16D1BC759CC} +AppId={{96abcdef-1337-4711-cafe-beef4a1ce42} AppName=Universal Radio Hacker AppVersion={#MyAppVersion} VersionInfoVersion={#MyAppVersion} From 06f070a110ec993478fa61aa15027606a49b011b Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 14:41:50 +0100 Subject: [PATCH 24/27] add 64 bit mode --- data/inno.iss | 1 + 1 file changed, 1 insertion(+) diff --git a/data/inno.iss b/data/inno.iss index 5f9d806bc2..586d34933b 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -6,6 +6,7 @@ AppId={{96abcdef-1337-4711-cafe-beef4a1ce42} AppName=Universal Radio Hacker AppVersion={#MyAppVersion} VersionInfoVersion={#MyAppVersion} +ArchitecturesInstallIn64BitMode=x64 UninstallDisplayName=Universal Radio Hacker AppPublisher=Johannes Pohl AppPublisherURL=https://github.com/jopohl/urh From 6c413fdf62d15c471000792d251fa716221668c1 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 14:55:38 +0100 Subject: [PATCH 25/27] restore app id --- data/inno.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/inno.iss b/data/inno.iss index 586d34933b..36437bc0bb 100644 --- a/data/inno.iss +++ b/data/inno.iss @@ -2,7 +2,7 @@ ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{96abcdef-1337-4711-cafe-beef4a1ce42} +AppId={{8A0E36A6-DE56-46B8-BCC3-C16D1BC759CC} AppName=Universal Radio Hacker AppVersion={#MyAppVersion} VersionInfoVersion={#MyAppVersion} From c679faf50981ed0dc18f08d4c240fa131b95dc2c Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 15:23:56 +0100 Subject: [PATCH 26/27] remove build_cx --- data/build_cx.py | 117 ----------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 data/build_cx.py diff --git a/data/build_cx.py b/data/build_cx.py deleted file mode 100644 index 69c50c8693..0000000000 --- a/data/build_cx.py +++ /dev/null @@ -1,117 +0,0 @@ -import os -import sys - -import cx_Freeze - - -def build_exe(build_cmd='build'): - # have to make sure args looks right - sys.argv = sys.argv[:1] + [build_cmd] - - root_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) - os.chdir(root_path) - - app_path = os.path.join("src", "urh", "main.py") - assert os.path.isfile(app_path) - - cli_path = os.path.join("src", "urh", "cli", "urh_cli.py") - assert os.path.isfile(cli_path) - - src_dir = os.path.join(os.curdir, "src") - assert os.path.isdir(src_dir) - sys.path.insert(0, src_dir) - - import urh.version as version - - if sys.platform == 'win32': - include_files = [os.path.join("data", 'icons', 'appicon.ico')] - lib_path = os.path.join("src", "urh", "dev", "native", "lib", "shared") - for f in os.listdir(lib_path): - if f.endswith(".dll") or f.endswith(".txt"): - include_files.append(os.path.join(lib_path, f)) - - shortcut_table = [ - ("DesktopShortcut", # Shortcut - "DesktopFolder", # Directory_ - "Universal Radio Hacker", # Name - "TARGETDIR", # Component_ - "[TARGETDIR]urh.exe", # Target - None, # Arguments - None, # Description - None, # Hotkey - None, # Icon - None, # IconIndex - None, # ShowCmd - 'TARGETDIR' # WkDir - ), - ] - - executables = [ - cx_Freeze.Executable( - app_path, - targetName="urh.exe", - icon=os.path.join("data", 'icons', 'appicon.ico'), - copyright="Copyright (C) 2019 Johannes Pohl, Andreas Noack", - base="Win32GUI"), - - cx_Freeze.Executable( - app_path, - targetName="urh_debug.exe", - copyright="Copyright (C) 2019 Johannes Pohl, Andreas Noack"), - - cx_Freeze.Executable(cli_path, targetName="urh_cli.exe") - ] - else: - include_files = [os.path.join("data", 'icons', 'appicon.png')] - executables = [ - cx_Freeze.Executable(app_path, targetName="urh", icon=os.path.join("data", 'icons', 'appicon.png')), - cx_Freeze.Executable(cli_path, targetName="urh_cli.exe") - ] - - shortcut_table = None - - for f in os.listdir(os.path.join("src", "urh", "dev", "gr", "scripts")): - if f.endswith(".py"): - include_files.append(os.path.join("src", "urh", "dev", "gr", "scripts", f)) - - plugins = [] - plugin_path = os.path.join("src", "urh", "plugins") - for plugin in os.listdir(plugin_path): - if os.path.isdir(os.path.join(plugin_path, plugin)): - for f in os.listdir(os.path.join(plugin_path, plugin)): - if f.endswith(".py") and f != "__init__.py": - plugins.append("urh.plugins.{0}.{1}".format(plugin, f.replace(".py", ""))) - - options = { - 'build_exe': { - "include_files": include_files, - "include_msvcr": True, - "excludes": ["tkinter"], - "includes": ['numpy.core._methods', 'numpy.lib.format', 'six', 'appdirs', 'pyaudio', - 'packaging', 'packaging.version', 'packaging.specifiers', 'packaging.requirements', - 'setuptools.msvc', 'html.parser'] + plugins - }, - 'bdist_msi': { - "upgrade_code": "{96abcdef-1337-4711-cafe-beef4a1ce42}", - "data": {"Shortcut": shortcut_table} - } - } - - cx_Freeze.setup( - name="Universal Radio Hacker", - description="Universal Radio Hacker: investigate wireless protocols like a boss", - author="Johannes Pohl", - author_email="Johannes.Pohl90@gmail.com", - url="https://github.com/jopohl/urh", - license="GNU General Public License (GPL) 3", - version=version.VERSION, - executables=executables, - options=options - ) - - -if __name__ == '__main__': - if sys.platform == "win32": - build_exe("bdist_msi") - else: - build_exe() From 67793d565ffbf7483409bb91ae8d02a5442754fa Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Fri, 22 Feb 2019 15:26:04 +0100 Subject: [PATCH 27/27] add debug exe --- data/pyinstaller_helper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data/pyinstaller_helper.py b/data/pyinstaller_helper.py index 8435e85084..54ae49d9f9 100644 --- a/data/pyinstaller_helper.py +++ b/data/pyinstaller_helper.py @@ -27,14 +27,17 @@ cmd.extend(["--distpath", "./pyinstaller"]) -os.rename(os.path.join(urh_path, "src/urh/main.py"), os.path.join(urh_path, "src/urh/urh.py")) +shutil.copy(os.path.join(urh_path, "src/urh/main.py"), os.path.join(urh_path, "src/urh/urh.py")) +shutil.copy(os.path.join(urh_path, "src/urh/main.py"), os.path.join(urh_path, "src/urh/urh_debug.py")) urh_cmd = cmd + ["--windowed", os.path.join(urh_path, "src/urh/urh.py")] +urh_debug_cmd = cmd + [os.path.join(urh_path, "src/urh/urh_debug.py")] cli_cmd = cmd + [os.path.join(urh_path, "src/urh/cli/urh_cli.py")] -for cmd in (urh_cmd, cli_cmd): +for cmd in (urh_cmd, cli_cmd, urh_debug_cmd): cmd = " ".join(cmd) print(cmd) sys.stdout.flush() call(cmd, shell=True) shutil.copy("./pyinstaller/urh_cli/urh_cli.exe", "./pyinstaller/urh/urh_cli.exe") +shutil.copy("./pyinstaller/urh_debug/urh_debug.exe", "./pyinstaller/urh/urh_debug.exe")