From 0d1981eb552499c14b1b1405c995afa38b27ecd0 Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 15 Dec 2018 15:33:17 +0200 Subject: [PATCH] adapt install.sh to Qt with python3 * use python3 with Qt in travis native host * install Qt on dockers * update readme --- .travis.yml | 3 +- README.md | 10 +++- install.sh | 74 ++++++++---------------- test/Dockerfiles/bionic-py3.Dockerfile | 2 +- test/Dockerfiles/fedora27-py3.Dockerfile | 2 +- test/Dockerfiles/stretch-py3.Dockerfile | 2 +- test/Dockerfiles/xenial-py3.Dockerfile | 2 +- 7 files changed, 37 insertions(+), 58 deletions(-) diff --git a/.travis.yml b/.travis.yml index a122150..f5e7b89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ matrix: key_url: 'http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0xD46F45428842CE5E' packages: - bitcoind - - python-qt4 python-sip - os: linux services: docker env: DOCKER_IMG_JM=xenial-py2 @@ -55,7 +54,7 @@ install: - mkdir -p "$HOME/downloads" - mkdir -p "$TRAVIS_BUILD_DIR/deps/cache/" - find "$HOME/downloads" -type f -exec cp -v {} "$TRAVIS_BUILD_DIR/deps/cache/" \; - - on_host ./install.sh --develop + - on_host ./install.sh --develop --python=python3 --with-qt - on_host find "$TRAVIS_BUILD_DIR/deps/cache/" -type f -exec cp -v {} "$HOME/downloads/" \; before_script: - on_host source jmvenv/bin/activate diff --git a/README.md b/README.md index e86ecba..e7b420c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ Once you've downloaded this repo, either as a zip file, and extracted it, or via (You can omit `-p python3` if you want to use Python2. You can also add `--develop` as an extra flag to `install.sh` to make the Joinmarket code editable in-place.) +For the Qt GUI, pass the `--with-qt` flag to `install.sh` as well : + + ./install.sh -p python3 --with-qt + +Do note, Python 2 is incompatible with the Qt GUI. + You should now be able to run the scripts like `python wallet-tool.py` etc., just as you did in the previous Joinmarket version. Alternative to this "quickstart" (including for MacOS): follow the [install guide](docs/INSTALL.md). @@ -47,11 +53,11 @@ It's possible but unlikely that the Python2 version will be fixed, but in any ca If binaries are built, they will be gpg signed and announced on the Releases page. -To run the script `joinmarket-qt.py` from the command line, you need to install two more packages: use these 2 commands: +If you haven't used the `--with-qt` flag during installation with `install.sh`, then to run the script `joinmarket-qt.py` from the command line you will need to install two more packages. Use these 2 commands while the `jmvenv` virtual environment is activated: ``` pip install PySide2 -pip install git+git://github.com/sunu/qt5reactor.git@58410aaead2185e9917ae9cac9c50fe7b70e4a60 +pip install https://github.com/sunu/qt5reactor/archive/58410aaead2185e9917ae9cac9c50fe7b70e4a60.zip ``` After this, the command `python joinmarket-qt.py` from within the `scripts` subdirectory should work. There is a [walkthrough](docs/JOINMARKET-QT-GUIDE.md) for what to do next. diff --git a/install.sh b/install.sh index a24f145..65a6252 100755 --- a/install.sh +++ b/install.sh @@ -353,6 +353,9 @@ parse_flags () echo 'ERROR: "--python" requires a non-empty option argument.' return 1 ;; + --with-qt) + with_qt='1' + ;; -?*) echo "warning. unknown flag : $1" 1>&2 ;; @@ -361,6 +364,19 @@ parse_flags () esac shift done + + if [[ ${with_qt} == 1 ]] && [[ ${python} == python2 ]]; then + echo "ERROR: Joinmarket-Qt is currently only available for Python 3 + Use the flag '--python=python3' to enable a python3 install." + return 1 + elif [[ ${with_qt} != 1 ]] && [[ ${python} == python3 ]]; then + read -p " + INFO: Joinmarket-Qt for GUI Taker and Tumbler modes is available. + Install Qt dependencies (~160mb) ? [y|n] : " + if [[ ${REPLY} =~ y|Y ]]; then + with_qt='1' + fi + fi } os_is_deb () @@ -391,45 +407,11 @@ install_get_os () qt_deps_install () { - if [[ ${install_os} == 'debian' ]]; then - if is_python3; then - if deb_deps_install "python3-pyqt4 python3-sip"; then - return 0; - fi - else - if deb_deps_install "python-qt4 python-sip"; then - return 0; - fi - fi - else - return 1 - fi -} - -qt_deps_link () -{ - if [[ ${install_os} == 'debian' ]]; then - if deb_qt_deps_link; then - return 0 - else - return 1 - fi - else - return 1 - fi -} - -deb_qt_deps_link () -{ - pyqt4dir="$( dpkg-query -L python-qt4 | grep -m1 "/PyQt4$" )" - sip_so="$( dpkg-query -L python-sip | grep -m1 "sip.*\.so" )" + pip install \ + PySide2 \ + https://github.com/sunu/qt5reactor/archive/58410aaead2185e9917ae9cac9c50fe7b70e4a60.zip - if [[ -r "${pyqt4dir}" ]] && [[ -r ${sip_so} ]]; then - ln -sf -t "${VIRTUAL_ENV}/lib/python2.7/site-packages/" "${sip_so}" "${pyqt4dir}" - return 0 - else - return 1 - fi + return "$?" } main () @@ -446,6 +428,7 @@ main () develop_build='' no_gpg_validation='' python='python2' + with_qt='' reinstall='false' if ! parse_flags ${@}; then return 1 @@ -488,18 +471,9 @@ main () deactivate return 1 fi - if [[ ${install_os} != 'unknown' ]] && ! qt_deps_link; then - read -p " - Install Joinmarket-Qt? (may require additional dependencies) - (y/n) " - if [[ ${REPLY} =~ y|Y ]]; then - if qt_deps_install; then - if ! qt_deps_link; then - echo "Qt dependencies installed but could not be found." - fi - else - echo "Qt dependencies could not be installed. Joinmarket-Qt might not work." - fi + if [[ ${with_qt} == 1 ]]; then + if ! qt_deps_install; then + echo "Qt dependencies could not be installed. Joinmarket-Qt might not work." fi fi deactivate diff --git a/test/Dockerfiles/bionic-py3.Dockerfile b/test/Dockerfiles/bionic-py3.Dockerfile index 38e0147..6921ab2 100755 --- a/test/Dockerfiles/bionic-py3.Dockerfile +++ b/test/Dockerfiles/bionic-py3.Dockerfile @@ -33,5 +33,5 @@ RUN bitcoind --version | head -1 # install script WORKDIR ${repo_name} -RUN ./install.sh --python=python3 +RUN echo y | ./install.sh --python=python3 RUN source jmvenv/bin/activate && ./test/run_tests.sh diff --git a/test/Dockerfiles/fedora27-py3.Dockerfile b/test/Dockerfiles/fedora27-py3.Dockerfile index 233e480..3fab3c5 100755 --- a/test/Dockerfiles/fedora27-py3.Dockerfile +++ b/test/Dockerfiles/fedora27-py3.Dockerfile @@ -32,5 +32,5 @@ RUN bitcoind --version | head -1 # install script WORKDIR ${repo_name} -RUN ./install.sh --python=python3 +RUN echo y | ./install.sh --python=python3 RUN source jmvenv/bin/activate && ./test/run_tests.sh diff --git a/test/Dockerfiles/stretch-py3.Dockerfile b/test/Dockerfiles/stretch-py3.Dockerfile index d979a99..a31f3da 100755 --- a/test/Dockerfiles/stretch-py3.Dockerfile +++ b/test/Dockerfiles/stretch-py3.Dockerfile @@ -33,5 +33,5 @@ RUN bitcoind --version | head -1 # install script WORKDIR ${repo_name} -RUN ./install.sh --python=python3 +RUN echo y | ./install.sh --python=python3 RUN source jmvenv/bin/activate && ./test/run_tests.sh diff --git a/test/Dockerfiles/xenial-py3.Dockerfile b/test/Dockerfiles/xenial-py3.Dockerfile index d53b379..47e360e 100755 --- a/test/Dockerfiles/xenial-py3.Dockerfile +++ b/test/Dockerfiles/xenial-py3.Dockerfile @@ -33,5 +33,5 @@ RUN bitcoind --version | head -1 # install script WORKDIR ${repo_name} -RUN ./install.sh --python=python3 +RUN echo y | ./install.sh --python=python3 RUN source jmvenv/bin/activate && ./test/run_tests.sh