mirror of
https://github.com/jopohl/urh.git
synced 2026-03-12 11:16:47 +01:00
* add argument parser for CLI * add pause to cli * parse messages to send * add send function * use while loop instead of hard sleep * use logger for error msg * use tabulator for progress bar * prepare rx mode * use Thread for Protocol Sniffer instead of qt signals * adapt tests * fix thread can only be started once error * enable receiving from command line * support send from file * save gain correctly * enable rx into file * remove unused signal * enable raw rx and file mode * add support for device identifier * add support for default pause * enable abort sending witt ctrl c * support encodings * make logging multiprocessing aware and add autobuild extensions to cli * move place * fix sniffer when receiving multiple messages at once * add test for modulator cli parsing and fix some bugs * extend modulator test and fix another bug * add unittests and reorder urh_cli structure * add tests * adapt CI to CLI tests * force osx * fix osx * adapt close dialog method * remove close dialog method * test read messages to send * centralize read messages method * increase timeout for ci * support loading of project files to load cli values * add sleep for ci * add cli to deployment * replace static calls with ProjectManager Class * use time sleep instead of qwait * disable gc collect call * disable gc collect for python 3.4 only * gc collect only for osx * simplify cleanup * simplify cleanup * advanced cleanup only for windows * cleanup also for osx * gc collect for osx * add unittests * consider frozen app path * init multiprocessing first * enable logging on cli for windows * use log file handler for log * add missing import
94 lines
3.2 KiB
Python
94 lines
3.2 KiB
Python
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')]
|
|
arch = "x64" if sys.maxsize > 2 ** 32 else "x86"
|
|
lib_path = os.path.join("src", "urh", "dev", "native", "lib", "win", arch)
|
|
for f in os.listdir(lib_path):
|
|
include_files.append(os.path.join(lib_path, f))
|
|
|
|
executables = [
|
|
cx_Freeze.Executable(
|
|
app_path,
|
|
targetName="urh.exe",
|
|
icon=os.path.join("data", 'icons', 'appicon.ico'),
|
|
shortcutName="Universal Radio Hacker",
|
|
shortcutDir="DesktopFolder",
|
|
base="Win32GUI"),
|
|
|
|
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")
|
|
]
|
|
|
|
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'] + plugins
|
|
},
|
|
'bdist_msi': {
|
|
"upgrade_code": "{96abcdef-1337-4711-cafe-beef4a1ce42}"
|
|
}
|
|
}
|
|
|
|
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()
|