Skip to content

Commit

Permalink
Add a CLI (#440)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jopohl authored Jun 1, 2018
1 parent 2dd16d9 commit 26e5bbb
Show file tree
Hide file tree
Showing 33 changed files with 954 additions and 176 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ install:
if [[ $TRAVIS_OS_NAME == "osx" ]]
then
brew upgrade python
rm '/usr/local/include/c++'
brew install hackrf librtlsdr
else
sudo apt-get install libhackrf-dev librtlsdr-dev
fi
- |
if [[ $TRAVIS_PYTHON_VERSION == "3.4"* ]]
Expand Down
20 changes: 14 additions & 6 deletions data/build_cx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def build_exe(build_cmd='build'):

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)
Expand All @@ -25,19 +29,23 @@ def build_exe(build_cmd='build'):
for f in os.listdir(lib_path):
include_files.append(os.path.join(lib_path, f))

executables = [cx_Freeze.Executable(
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")]
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'))]
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"):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def read_long_description():
entry_points={
'console_scripts': [
'urh = urh.main:main',
'urh_cli = urh.cli.urh_cli:main',
]}
)

Expand Down
Empty file added src/urh/cli/__init__.py
Empty file.
Loading

0 comments on commit 26e5bbb

Please sign in to comment.