add --version flag

This commit is contained in:
Johannes Pohl
2017-12-03 10:51:55 +01:00
parent 26072bf3ec
commit 2ea6c57427
4 changed files with 17 additions and 18 deletions

View File

@@ -45,6 +45,7 @@ script:
- python3 src/urh/cythonext/build.py &> /tmp/build_log.txt
- pytest -s --cov=src/urh --cov-config .coveragerc tests 2> /tmp/test_errors.txt
- pip3 install .
- urh --version
- urh autoclose
after_failure:

View File

@@ -50,6 +50,7 @@ build_script:
- python setup.py build_ext --inplace
test_script:
- python src\urh\main.py --version
- python -m pytest
after_test:

View File

@@ -17,6 +17,7 @@ dependencies:
test:
override:
- touch tests/show_gui
- python3 src/urh/main.py --version
- python3 src/urh/cythonext/build.py
- pytest tests

View File

@@ -2,7 +2,6 @@
import locale
import re
import time
import os
import sys
@@ -53,21 +52,6 @@ def main():
print("You need at least Python 3.4 for this application!")
sys.exit(1)
t = time.time()
if GENERATE_UI and not hasattr(sys, 'frozen'):
try:
urh_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", ".."))
sys.path.append(urh_dir)
sys.path.append(os.path.join(urh_dir, "src"))
import generate_ui
generate_ui.gen()
print("Time for generating UI: %.2f seconds" % (time.time() - t))
except (ImportError, FileNotFoundError):
print("Will not regenerate UI, because script can't be found. This is okay in release.")
urh_exe = sys.executable if hasattr(sys, 'frozen') else sys.argv[0]
urh_exe = os.readlink(urh_exe) if os.path.islink(urh_exe) else urh_exe
@@ -76,10 +60,22 @@ def main():
src_dir = os.path.join(prefix, "src")
if os.path.exists(src_dir) and not prefix.startswith("/usr") and not re.match(r"(?i)c:\\program", prefix):
# Started locally, not installed
print("Adding {0} to pythonpath. This is only important when running URH from source.".format(src_dir))
# Started locally, not installed -> add directory to path
sys.path.insert(0, src_dir)
if len(sys.argv) > 1 and sys.argv[1] == "--version":
import urh.version
print(urh.version.VERSION)
sys.exit(0)
if GENERATE_UI and not hasattr(sys, 'frozen'):
try:
sys.path.append(prefix)
import generate_ui
generate_ui.gen()
except (ImportError, FileNotFoundError):
print("Will not regenerate UI, because script can't be found. This is okay in release.")
from urh.util import util
util.set_windows_lib_path()