Browse Source

adapt install.sh to Qt with python3

* use python3 with Qt in travis native host
* install Qt on dockers
* update readme
master
fivepiece 7 years ago
parent
commit
0d1981eb55
  1. 3
      .travis.yml
  2. 10
      README.md
  3. 72
      install.sh
  4. 2
      test/Dockerfiles/bionic-py3.Dockerfile
  5. 2
      test/Dockerfiles/fedora27-py3.Dockerfile
  6. 2
      test/Dockerfiles/stretch-py3.Dockerfile
  7. 2
      test/Dockerfiles/xenial-py3.Dockerfile

3
.travis.yml

@ -13,7 +13,6 @@ matrix:
key_url: 'http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0xD46F45428842CE5E' key_url: 'http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0xD46F45428842CE5E'
packages: packages:
- bitcoind - bitcoind
- python-qt4 python-sip
- os: linux - os: linux
services: docker services: docker
env: DOCKER_IMG_JM=xenial-py2 env: DOCKER_IMG_JM=xenial-py2
@ -55,7 +54,7 @@ install:
- mkdir -p "$HOME/downloads" - mkdir -p "$HOME/downloads"
- mkdir -p "$TRAVIS_BUILD_DIR/deps/cache/" - mkdir -p "$TRAVIS_BUILD_DIR/deps/cache/"
- find "$HOME/downloads" -type f -exec cp -v {} "$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/" \; - on_host find "$TRAVIS_BUILD_DIR/deps/cache/" -type f -exec cp -v {} "$HOME/downloads/" \;
before_script: before_script:
- on_host source jmvenv/bin/activate - on_host source jmvenv/bin/activate

10
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.) (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. 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). 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. 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 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. 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. There is a [walkthrough](docs/JOINMARKET-QT-GUIDE.md) for what to do next.

72
install.sh

@ -353,6 +353,9 @@ parse_flags ()
echo 'ERROR: "--python" requires a non-empty option argument.' echo 'ERROR: "--python" requires a non-empty option argument.'
return 1 return 1
;; ;;
--with-qt)
with_qt='1'
;;
-?*) -?*)
echo "warning. unknown flag : $1" 1>&2 echo "warning. unknown flag : $1" 1>&2
;; ;;
@ -361,6 +364,19 @@ parse_flags ()
esac esac
shift shift
done 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 () os_is_deb ()
@ -391,45 +407,11 @@ install_get_os ()
qt_deps_install () qt_deps_install ()
{ {
if [[ ${install_os} == 'debian' ]]; then pip install \
if is_python3; then PySide2 \
if deb_deps_install "python3-pyqt4 python3-sip"; then https://github.com/sunu/qt5reactor/archive/58410aaead2185e9917ae9cac9c50fe7b70e4a60.zip
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" )"
if [[ -r "${pyqt4dir}" ]] && [[ -r ${sip_so} ]]; then return "$?"
ln -sf -t "${VIRTUAL_ENV}/lib/python2.7/site-packages/" "${sip_so}" "${pyqt4dir}"
return 0
else
return 1
fi
} }
main () main ()
@ -446,6 +428,7 @@ main ()
develop_build='' develop_build=''
no_gpg_validation='' no_gpg_validation=''
python='python2' python='python2'
with_qt=''
reinstall='false' reinstall='false'
if ! parse_flags ${@}; then if ! parse_flags ${@}; then
return 1 return 1
@ -488,20 +471,11 @@ main ()
deactivate deactivate
return 1 return 1
fi fi
if [[ ${install_os} != 'unknown' ]] && ! qt_deps_link; then if [[ ${with_qt} == 1 ]]; then
read -p " if ! qt_deps_install; then
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." echo "Qt dependencies could not be installed. Joinmarket-Qt might not work."
fi fi
fi fi
fi
deactivate deactivate
echo "Joinmarket successfully installed echo "Joinmarket successfully installed
Before executing scripts or tests, run: Before executing scripts or tests, run:

2
test/Dockerfiles/bionic-py3.Dockerfile

@ -33,5 +33,5 @@ RUN bitcoind --version | head -1
# install script # install script
WORKDIR ${repo_name} WORKDIR ${repo_name}
RUN ./install.sh --python=python3 RUN echo y | ./install.sh --python=python3
RUN source jmvenv/bin/activate && ./test/run_tests.sh RUN source jmvenv/bin/activate && ./test/run_tests.sh

2
test/Dockerfiles/fedora27-py3.Dockerfile

@ -32,5 +32,5 @@ RUN bitcoind --version | head -1
# install script # install script
WORKDIR ${repo_name} WORKDIR ${repo_name}
RUN ./install.sh --python=python3 RUN echo y | ./install.sh --python=python3
RUN source jmvenv/bin/activate && ./test/run_tests.sh RUN source jmvenv/bin/activate && ./test/run_tests.sh

2
test/Dockerfiles/stretch-py3.Dockerfile

@ -33,5 +33,5 @@ RUN bitcoind --version | head -1
# install script # install script
WORKDIR ${repo_name} WORKDIR ${repo_name}
RUN ./install.sh --python=python3 RUN echo y | ./install.sh --python=python3
RUN source jmvenv/bin/activate && ./test/run_tests.sh RUN source jmvenv/bin/activate && ./test/run_tests.sh

2
test/Dockerfiles/xenial-py3.Dockerfile

@ -33,5 +33,5 @@ RUN bitcoind --version | head -1
# install script # install script
WORKDIR ${repo_name} WORKDIR ${repo_name}
RUN ./install.sh --python=python3 RUN echo y | ./install.sh --python=python3
RUN source jmvenv/bin/activate && ./test/run_tests.sh RUN source jmvenv/bin/activate && ./test/run_tests.sh

Loading…
Cancel
Save