diff --git a/README.md b/README.md index 43c5e9efb8..d31b0f0e0b 100644 --- a/README.md +++ b/README.md @@ -67,11 +67,14 @@ sudo pip3 install urh ### Windows -1. Install [Visual C++ Build Tools 2015](http://landinghub.visualstudio.com/visual-cpp-build-tools). -2. Install [Python 3 for Windows](https://www.python.org/downloads/windows/). Choose a __64 Bit__ version! -3. (Optional) Open a terminal (__cmd__) and type: ``` pip install numpy ``` - _This speeds the installation up a bit._ -4. In a terminal, type: ``` pip install urh ```. -5. Type ``` urh ``` in a terminal or search for ``` urh ``` in search bar. +If you run a Python 3.4 you need to install [Visual C++ Build Tools 2015](http://landinghub.visualstudio.com/visual-cpp-build-tools) first. It is recommended to use Python 3.5 or later on Windows, so no C++ compiler needs to be installed. +1. Install [Python 3 for Windows](https://www.python.org/downloads/windows/). + - Make sure you tick the _Add Python to PATH_ checkbox on first page in python installer. + - Choose a __64 Bit__ version for native device support! +2. Open a terminal (__cmd__) and type: ``` pip install numpy ```. + - If you do not have a C++ Compiler on your system it is essential to install numpy before URH! +3. In a terminal, type: ``` pip install urh ```. +4. Type ``` urh ``` in a terminal or search for ``` urh ``` in search bar to start the application. ### Mac OS X 1. Install [Python 3 for Mac OS X](https://www.python.org/downloads/mac-osx/). diff --git a/appveyor.yml b/appveyor.yml index abbb4a6b6f..bc4c95626c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,10 @@ environment: + TWINE_USERNAME: + secure: qqioSb3Yu/QTOdDKx10sDQ== + TWINE_PASSWORD: + secure: y8XwCStmwBEwWyXQ108iC7I+WFje6C7rbc0ypp56Q2g= + TWINE_REPOSITORY_URL: + 'https://pypi.python.org/pypi/' matrix: - PYTHON: "C:\\Python35" PYTHON_VERSION: "3.5.x" @@ -54,7 +60,7 @@ install: # pip will build them from source using the MSVC compiler matching the # target Python version and architecture - pip install -r requirements.txt - - pip install pytest wheel + - pip install pytest wheel twine build_script: # Build the compiled extension @@ -65,17 +71,17 @@ test_script: - python -m pytest -s - pip install . - urh autoclose + - pip uninstall -y urh -#after_test: -# # If tests are successful, create binary packages for the project. -# - python setup.py bdist_wheel +after_test: + # If tests are successful, create binary packages for the project. + - python setup.py bdist_wheel # - python setup.py bdist_wininst -# - ps: "ls dist" + - ps: "ls dist" -#artifacts: +artifacts: # # Archive the generated packages in the ci.appveyor.com build report. -# - path: dist\* + - path: dist\* -#on_success: -# - TODO: upload the content of dist/*.whl to a public wheelhouse -# +on_success: + - ps: If ($env:APPVEYOR_REPO_TAG -eq "true" -And $env:APPVEYOR_REPO_BRANCH -eq "master") { Invoke-Expression "twine upload --skip-existing dist/*" } Else { write-output "Only deploy to PyPi for tags on master!"} diff --git a/setup.py b/setup.py index 28da816df4..93c23f4247 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import src.urh.version as version if sys.platform == "win32": - OPEN_MP_FLAG = "-openmp" + OPEN_MP_FLAG = "/openmp" elif sys.platform == "darwin": OPEN_MP_FLAG = "" # no OpenMP support in default Mac OSX compiler else: @@ -71,8 +71,6 @@ def get_package_data(): for plugin in PLUGINS: package_data["urh.plugins." + plugin] = ['*.ui', "*.txt"] - is_release = os.path.isfile("/tmp/urh_releasing") # make sure precompiled binding are uploaded to PyPi - package_data["urh.dev.native.lib"] = ["*.cpp", "*.c", "*.pyx", "*.pxd"] # Bundle headers @@ -83,9 +81,9 @@ def get_package_data(): rel_dir_path = os.path.relpath(os.path.join(dirpath, dir_name), include_dir) package_data["urh.dev.native.includes."+rel_dir_path.replace(os.sep, ".")] = ["*.h"] - if sys.platform == "win32" or is_release: - # we use precompiled device backends on windows - package_data["urh.dev.native.lib.win"] = ["*"] + # we use precompiled device backends on windows + package_data["urh.dev.native.lib.win.x64"] = ["*"] + package_data["urh.dev.native.lib.win.x86"] = ["*"] return package_data diff --git a/src/urh/dev/native/ExtensionHelper.py b/src/urh/dev/native/ExtensionHelper.py index 3645c3dc69..2415c559ab 100644 --- a/src/urh/dev/native/ExtensionHelper.py +++ b/src/urh/dev/native/ExtensionHelper.py @@ -37,7 +37,7 @@ def get_device_extensions(use_cython: bool, library_dirs=None): return [] # only 64 bit python supported for native device backends result = [] - lib_dir = os.path.realpath(os.path.join(cur_dir, "lib/win")) + lib_dir = os.path.realpath(os.path.join(cur_dir, "lib/win/x64")) for dev_name, params in DEVICES.items(): result.append(get_device_extension(dev_name, [params["lib"]], [lib_dir], include_dirs)) diff --git a/src/urh/dev/native/lib/win/COPYING.libusbx b/src/urh/dev/native/lib/win/x64/COPYING.libusbx similarity index 100% rename from src/urh/dev/native/lib/win/COPYING.libusbx rename to src/urh/dev/native/lib/win/x64/COPYING.libusbx diff --git a/src/urh/dev/native/lib/win/COPYING.pthreads-win32 b/src/urh/dev/native/lib/win/x64/COPYING.pthreads-win32 similarity index 100% rename from src/urh/dev/native/lib/win/COPYING.pthreads-win32 rename to src/urh/dev/native/lib/win/x64/COPYING.pthreads-win32 diff --git a/src/urh/dev/native/lib/win/FTD3XX.dll b/src/urh/dev/native/lib/win/x64/FTD3XX.dll similarity index 100% rename from src/urh/dev/native/lib/win/FTD3XX.dll rename to src/urh/dev/native/lib/win/x64/FTD3XX.dll diff --git a/src/urh/dev/native/lib/win/LimeSuite.dll b/src/urh/dev/native/lib/win/x64/LimeSuite.dll similarity index 100% rename from src/urh/dev/native/lib/win/LimeSuite.dll rename to src/urh/dev/native/lib/win/x64/LimeSuite.dll diff --git a/src/urh/dev/native/lib/win/LimeSuite.lib b/src/urh/dev/native/lib/win/x64/LimeSuite.lib similarity index 100% rename from src/urh/dev/native/lib/win/LimeSuite.lib rename to src/urh/dev/native/lib/win/x64/LimeSuite.lib diff --git a/src/urh/dev/native/lib/win/airspy.dll b/src/urh/dev/native/lib/win/x64/airspy.dll similarity index 100% rename from src/urh/dev/native/lib/win/airspy.dll rename to src/urh/dev/native/lib/win/x64/airspy.dll diff --git a/src/urh/dev/native/lib/win/airspy.lib b/src/urh/dev/native/lib/win/x64/airspy.lib similarity index 100% rename from src/urh/dev/native/lib/win/airspy.lib rename to src/urh/dev/native/lib/win/x64/airspy.lib diff --git a/src/urh/dev/native/lib/win/hackrf.dll b/src/urh/dev/native/lib/win/x64/hackrf.dll similarity index 100% rename from src/urh/dev/native/lib/win/hackrf.dll rename to src/urh/dev/native/lib/win/x64/hackrf.dll diff --git a/src/urh/dev/native/lib/win/hackrf.lib b/src/urh/dev/native/lib/win/x64/hackrf.lib similarity index 100% rename from src/urh/dev/native/lib/win/hackrf.lib rename to src/urh/dev/native/lib/win/x64/hackrf.lib diff --git a/src/urh/dev/native/lib/win/libusb-1.0.dll b/src/urh/dev/native/lib/win/x64/libusb-1.0.dll similarity index 100% rename from src/urh/dev/native/lib/win/libusb-1.0.dll rename to src/urh/dev/native/lib/win/x64/libusb-1.0.dll diff --git a/src/urh/dev/native/lib/win/msvcp110.dll b/src/urh/dev/native/lib/win/x64/msvcp110.dll similarity index 100% rename from src/urh/dev/native/lib/win/msvcp110.dll rename to src/urh/dev/native/lib/win/x64/msvcp110.dll diff --git a/src/urh/dev/native/lib/win/msvcp140.dll b/src/urh/dev/native/lib/win/x64/msvcp140.dll similarity index 100% rename from src/urh/dev/native/lib/win/msvcp140.dll rename to src/urh/dev/native/lib/win/x64/msvcp140.dll diff --git a/src/urh/dev/native/lib/win/msvcr100.dll b/src/urh/dev/native/lib/win/x64/msvcr100.dll similarity index 100% rename from src/urh/dev/native/lib/win/msvcr100.dll rename to src/urh/dev/native/lib/win/x64/msvcr100.dll diff --git a/src/urh/dev/native/lib/win/msvcr110.dll b/src/urh/dev/native/lib/win/x64/msvcr110.dll similarity index 100% rename from src/urh/dev/native/lib/win/msvcr110.dll rename to src/urh/dev/native/lib/win/x64/msvcr110.dll diff --git a/src/urh/dev/native/lib/win/pthreadVC2.dll b/src/urh/dev/native/lib/win/x64/pthreadVC2.dll similarity index 100% rename from src/urh/dev/native/lib/win/pthreadVC2.dll rename to src/urh/dev/native/lib/win/x64/pthreadVC2.dll diff --git a/src/urh/dev/native/lib/win/rtlsdr.dll b/src/urh/dev/native/lib/win/x64/rtlsdr.dll similarity index 100% rename from src/urh/dev/native/lib/win/rtlsdr.dll rename to src/urh/dev/native/lib/win/x64/rtlsdr.dll diff --git a/src/urh/dev/native/lib/win/rtlsdr.lib b/src/urh/dev/native/lib/win/x64/rtlsdr.lib similarity index 100% rename from src/urh/dev/native/lib/win/rtlsdr.lib rename to src/urh/dev/native/lib/win/x64/rtlsdr.lib diff --git a/src/urh/dev/native/lib/win/uhd.dll b/src/urh/dev/native/lib/win/x64/uhd.dll similarity index 100% rename from src/urh/dev/native/lib/win/uhd.dll rename to src/urh/dev/native/lib/win/x64/uhd.dll diff --git a/src/urh/dev/native/lib/win/uhd.lib b/src/urh/dev/native/lib/win/x64/uhd.lib similarity index 100% rename from src/urh/dev/native/lib/win/uhd.lib rename to src/urh/dev/native/lib/win/x64/uhd.lib diff --git a/src/urh/dev/native/lib/win/x64/vcomp140.dll b/src/urh/dev/native/lib/win/x64/vcomp140.dll new file mode 100644 index 0000000000..2f0d02da0c Binary files /dev/null and b/src/urh/dev/native/lib/win/x64/vcomp140.dll differ diff --git a/src/urh/dev/native/lib/win/vcruntime140.dll b/src/urh/dev/native/lib/win/x64/vcruntime140.dll similarity index 100% rename from src/urh/dev/native/lib/win/vcruntime140.dll rename to src/urh/dev/native/lib/win/x64/vcruntime140.dll diff --git a/src/urh/dev/native/lib/win/x86/vcomp140.dll b/src/urh/dev/native/lib/win/x86/vcomp140.dll new file mode 100644 index 0000000000..701ec87d27 Binary files /dev/null and b/src/urh/dev/native/lib/win/x86/vcomp140.dll differ diff --git a/src/urh/main.py b/src/urh/main.py index 2fa1507c79..dd13943a86 100755 --- a/src/urh/main.py +++ b/src/urh/main.py @@ -23,15 +23,6 @@ def main(): print("You need at least Python 3.4 for this application!") sys.exit(1) - if sys.platform == "win32": - urh_dir = os.path.dirname(os.path.realpath(__file__)) if not os.path.islink(__file__) \ - else os.path.dirname(os.path.realpath(os.readlink(__file__))) - assert os.path.isdir(urh_dir) - - dll_dir = os.path.realpath(os.path.join(urh_dir, "dev", "native", "lib", "win")) - print("Using DLLs from:", dll_dir) - os.environ['PATH'] = dll_dir + ';' + os.environ['PATH'] - t = time.time() if GENERATE_UI and not hasattr(sys, 'frozen'): try: @@ -59,6 +50,9 @@ def main(): print("Adding {0} to pythonpath. This is only important when running URH from source.".format(src_dir)) sys.path.insert(0, src_dir) + from urh.util import util + util.set_windows_lib_path() + try: import urh.cythonext.signalFunctions import urh.cythonext.path_creator diff --git a/src/urh/util/util.py b/src/urh/util/util.py new file mode 100644 index 0000000000..fd15f71da4 --- /dev/null +++ b/src/urh/util/util.py @@ -0,0 +1,15 @@ +import os +import sys + + +def set_windows_lib_path(): + if sys.platform == "win32": + util_dir = os.path.dirname(os.path.realpath(__file__)) if not os.path.islink(__file__) \ + else os.path.dirname(os.path.realpath(os.readlink(__file__))) + urh_dir = os.path.realpath(os.path.join(util_dir, "..")) + assert os.path.isdir(urh_dir) + + arch = "x64" if sys.maxsize > 2**32 else "x86" + dll_dir = os.path.realpath(os.path.join(urh_dir, "dev", "native", "lib", "win", arch)) + print("Using DLLs from:", dll_dir) + os.environ['PATH'] = os.environ['PATH'] + ";" + dll_dir diff --git a/src/urh/version.py b/src/urh/version.py index a8bbb494e3..3820b17b10 100644 --- a/src/urh/version.py +++ b/src/urh/version.py @@ -1 +1 @@ -VERSION = "1.6.4.2" +VERSION = "1.6.4.3" diff --git a/tests/HackRFTests.py b/tests/HackRFTests.py index 194e970fc3..645ab2c2b0 100644 --- a/tests/HackRFTests.py +++ b/tests/HackRFTests.py @@ -5,11 +5,9 @@ import numpy as np import sys -if sys.platform == "win32": - import os - cur_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__)) - dll_dir = os.path.realpath(os.path.join(cur_dir, "..", "src", "urh", "dev", "native", "lib", "win")) - os.environ['PATH'] = dll_dir + ';' + os.environ['PATH'] +from urh.util import util + +util.set_windows_lib_path() from urh.dev.native.HackRF import HackRF diff --git a/tests/TestLimeSDR.py b/tests/TestLimeSDR.py index fdd9d11015..adaaa781e2 100644 --- a/tests/TestLimeSDR.py +++ b/tests/TestLimeSDR.py @@ -11,12 +11,9 @@ import numpy as np -if sys.platform == "win32": +from urh.util import util - - cur_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__)) - dll_dir = os.path.realpath(os.path.join(cur_dir, "..", "src", "urh", "dev", "native", "lib", "win")) - os.environ['PATH'] = dll_dir + ';' + os.environ['PATH'] +util.set_windows_lib_path() from urh.dev.native.lib import limesdr diff --git a/tests/TestRTLSDR.py b/tests/TestRTLSDR.py index fd284679ec..aa9b6e8084 100644 --- a/tests/TestRTLSDR.py +++ b/tests/TestRTLSDR.py @@ -4,11 +4,9 @@ import numpy as np -if sys.platform == "win32": - import os - cur_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__)) - dll_dir = os.path.realpath(os.path.join(cur_dir, "..", "src", "urh", "dev", "native", "lib", "win")) - os.environ['PATH'] = dll_dir + ';' + os.environ['PATH'] +from urh.util import util + +util.set_windows_lib_path() from urh.dev.native.RTLSDR import RTLSDR try: diff --git a/tests/TestUSRP.py b/tests/TestUSRP.py index 921963c7ca..b56eca90c0 100644 --- a/tests/TestUSRP.py +++ b/tests/TestUSRP.py @@ -2,11 +2,9 @@ import sys -if sys.platform == "win32": - import os - cur_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__)) - dll_dir = os.path.realpath(os.path.join(cur_dir, "..", "src", "urh", "dev", "native", "lib", "win")) - os.environ['PATH'] = dll_dir + ';' + os.environ['PATH'] +from urh.util import util + +util.set_windows_lib_path() from urh.dev.native.USRP import USRP diff --git a/tests/test_win_native_backend.py b/tests/test_win_native_backend.py index 2f93fdeba3..239e2abb19 100644 --- a/tests/test_win_native_backend.py +++ b/tests/test_win_native_backend.py @@ -8,11 +8,9 @@ class TestWinNativeBackend(QtTestCase): def test_native_backends_installed(self): if sys.platform == "win32": if platform.architecture()[0] == "64bit": - import os - cur_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname( - os.readlink(__file__)) - dll_dir = os.path.realpath(os.path.join(cur_dir, "..", "src", "urh", "dev", "native", "lib", "win")) - os.environ['PATH'] = dll_dir + ';' + os.environ['PATH'] + from urh.util import util + + util.set_windows_lib_path() # noinspection PyUnresolvedReferences from urh.dev.native.lib import hackrf