diff --git a/.travis.yml b/.travis.yml index b4202e6dba9f1ef4eac64f06868f5143a5c842f3..6b3a32653d50b62d35695d16a1f2d9a09b7ee2a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,75 +1,31 @@ -sudo: false -language: python -python: - # We don't actually use the Travis Python, but this keeps it organized. - - "3.4" -addons: - apt: - packages: - - libxcb1 - - libxcb1-dev - - libx11-xcb1 - - libx11-xcb-dev - - libxcb-keysyms1 - - libxcb-keysyms1-dev - - libxcb-image0 - - libxcb-image0-dev - - libxcb-shm0 - - libxcb-shm0-dev - - libxcb-icccm4 - - libxcb-icccm4-dev - - libxcb-sync0 - - libxcb-sync0-dev - - libxcb-xfixes0-dev - - libxrender-dev - - libxcb-shape0-dev - - libxcb-randr0-dev - - libxcb-render-util0 - - libxcb-render-util0-dev - - libxcb-glx0-dev - - libgl1-mesa-dri - - libegl1-mesa - - libpcre3-dev +os: linux +matrix: + include: + - os: osx + - dist: trusty + sudo: required + exclude: + - os: linux -before_install: - # Update - - pwd - # Install and configure conda - - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" - - hash -r - - conda config --set always_yes yes --set changeps1 no - - conda config --add channels inso/channel/sakia - - conda config --add channels pyzo - - conda update -q conda - # Useful for debugging any issues with conda - - conda info -a +env: +- PYENV_PYTHON_VERSION=3.4.3 +before_install: +- ci/travis/before_install.sh install: - - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION cx_freeze pyqt5 libpng=1.5.13 libsodium=1.0.3 - - source activate test-environment - - ldd $HOME/miniconda/envs/test-environment/lib/qt5/plugins/platforms/*.so - - pip install coveralls - - pip install -r requirements.txt - - python gen_resources.py - - python gen_translations.py - - python setup.py build - -before_script: - # screen must be 24bpp otherwise pyqt5 crashes - # see: https://github.com/pytest-dev/pytest-qt/issues/35 - - export XVFBARGS="-screen 0 1280x1024x24" - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - - sleep 3 - +- ci/travis/build.sh script: - - export QT_QPA_PLATFORM_PLUGIN_PATH=$HOME/miniconda/envs/test-environment/lib/qt5/plugins/platforms; - - export QT_PLUGIN_PATH=$HOME/miniconda/envs/test-environment/lib/qt5/plugins - - export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb - - coverage run --source=sakia.core,sakia.gui,sakia.models run_tests.py - +- ci/travis/test.sh after_success: - - coverage -rm - - coveralls +- ci/travis/after_success.sh +before_deploy: +- ci/travis/before_deploy.sh + +deploy: + provider: releases + api_key: + secure: MUdvTDBeCxO9d/EpzIhr+QYra/KxgYkXX6177SjqWCWDqw9xB3fwSUj8I9ht9DGtwVdadtveumtvLw3pbtVIR0GtIPC9pyvtNz4j6T4Ei3TSE6+StXdMK4NnInvPeTRlobGL+9sZt9MwheJwZ8YGewhBcR0F5UzVfxWeSSrxmyk= + file: sakia-${TRAVIS_OS_NAME}.zip + skip_cleanup: true + on: + tags: true diff --git a/ci/travis/after_success.sh b/ci/travis/after_success.sh new file mode 100755 index 0000000000000000000000000000000000000000..0211ad359a565119a92b904116b0030ed42fdc99 --- /dev/null +++ b/ci/travis/after_success.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +eval "$(pyenv init -)" +eval "$(pyenv virtualenv-init -)" + +cd $HOME/build/ucoin-io/sakia +pyenv activate sakia-env + +coverage -rm +coveralls \ No newline at end of file diff --git a/ci/travis/before_deploy.sh b/ci/travis/before_deploy.sh new file mode 100755 index 0000000000000000000000000000000000000000..f80fb656c0d199f73f5dc5acf48a68053a9c7eac --- /dev/null +++ b/ci/travis/before_deploy.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [ $TRAVIS_OS_NAME == "osx" ] +then + zip -r sakia-${TRAVIS_OS_NAME}.zip build/*.dmg +elif [ $TRAVIS_OS_NAME == "linux" ] +then + zip -r sakia-${TRAVIS_OS_NAME}.zip build/exe* +fi diff --git a/ci/travis/before_install.sh b/ci/travis/before_install.sh new file mode 100755 index 0000000000000000000000000000000000000000..679c5c359219d24967e843e06b2d05d009335b17 --- /dev/null +++ b/ci/travis/before_install.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +if [ $TRAVIS_OS_NAME == "osx" ] +then + brew update + brew install libsodium + ## Ensure your brew QT version is up to date. (brew install qt -> qt 4.8) + brew install qt5 + brew link --force qt5 + brew install pyenv-virtualenv +elif [ $TRAVIS_OS_NAME == "linux" ] +then + sudo apt-get update + sudo apt-get install -qq -y libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 \ + libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev \ + libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 \ + libxcb-render-util0-dev libxcb-glx0-dev libgl1-mesa-dri libegl1-mesa libpcre3-dev \ + curl qt5-qmake qtbase5-dev qttools5-dev-tools libqt5svg5-dev libdbus-1-dev libdbus-glib-1-dev autoconf automake libtool + wget http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsodium/libsodium13_1.0.1-1_amd64.deb + sudo dpkg -i libsodium13_1.0.1-1_amd64.deb + curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash +fi + +eval "$(pyenv init -)" +eval "$(pyenv virtualenv-init -)" + +pyenv activate sakia-env +if [ $? -ne 0 ] +then + echo "Sakia env cache cleared, rebuilding it..." + if [ $TRAVIS_OS_NAME == "osx" ] + then + env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install $PYENV_PYTHON_VERSION + elif [ $TRAVIS_OS_NAME == "linux" ] + then + PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_PYTHON_VERSION + fi + + pyenv shell $PYENV_PYTHON_VERSION + pyenv virtualenv sakia-env + + cd $HOME + + wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.17/sip-4.17.tar.gz + tar xzf sip-4.17.tar.gz + cd sip-4.17/ + pyenv activate sakia-env + python configure.py + make && make install + pyenv rehash + + cd $HOME + + wget http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5.1/PyQt-gpl-5.5.1.tar.gz + tar xzf PyQt-gpl-5.5.1.tar.gz + cd PyQt-gpl-5.5.1/ + pyenv activate sakia-env + if [ $TRAVIS_OS_NAME == "osx" ] + then + python configure.py --confirm-license + elif [ $TRAVIS_OS_NAME == "linux" ] + then + python configure.py --qmake "/usr/lib/x86_64-linux-gnu/qt5/bin/qmake" --confirm-license + fi + + make -j 2 && make install + pyenv rehash + +fi \ No newline at end of file diff --git a/ci/travis/build.sh b/ci/travis/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..b6a5457fa974aa5f467c56f969072d69320e3f43 --- /dev/null +++ b/ci/travis/build.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +eval "$(pyenv init -)" +eval "$(pyenv virtualenv-init -)" + +cd $HOME/build/ucoin-io/sakia +pyenv activate sakia-env +pip install coveralls +pip install cx_Freeze +pip install -r requirements.txt +if [ $TRAVIS_OS_NAME == "linux" ] +then + pip install -U git+https://github.com/posborne/dbus-python.git + pip install notify2 +fi + +python gen_resources.py +python gen_translations.py + +if [ $TRAVIS_OS_NAME == "osx" ] +then + python setup.py bdist_dmg +elif [ $TRAVIS_OS_NAME == "linux" ] +then + python setup.py build + cp ~/.pyenv/versions/$PYENV_PYTHON_VERSION/lib/libpython3.*m.so.1.0 build/exe.linux-x86_64-3.4/ +fi + diff --git a/ci/travis/test.sh b/ci/travis/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..0c74cc97326915cce665d953ea123be28eb2520d --- /dev/null +++ b/ci/travis/test.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +eval "$(pyenv init -)" +eval "$(pyenv virtualenv-init -)" + +cd $HOME/build/ucoin-io/sakia +pyenv activate sakia-env + +if [ $TRAVIS_OS_NAME == "linux" ] +then + export XVFBARGS="-screen 0 1280x1024x24" + export DISPLAY=:99.0 + sh -e /etc/init.d/xvfb start + sleep 3 +fi + +coverage run --source=sakia.core,sakia.gui,sakia.models run_tests.py + diff --git a/setup.py b/setup.py index fb1a7ce11c195b5125da87d1240bb194798de24e..fce9ef0e21cd30532c686692b0c3cf96de456633 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ includes = ["sip", "re", "json", "logging", "ucoinpy", "pylibscrypt", "aiohttp", "asyncio", "quamash", "jsonschema"] exclude = ['.git'] -packages = ["libnacl", "encodings", "jsonschema"] +packages = ["libnacl", "encodings"] includefiles = [] zipincludes = [] @@ -53,21 +53,24 @@ if sys.platform == "win32": includefiles.append((os.path.join(path, "Scripts", "plugins", "iconengines", f), os.path.join("iconengines", f) )) includefiles.append(libEGL_path) includefiles.append(libsodium_path) -elif sys.platform == "darwin": - pass else: - libsodium_path = "" - print(QtCore.QCoreApplication.libraryPaths()) schemas = os.path.join(site.getsitepackages()[0], "jsonschema", "schemas") onlyfiles = [ f for f in listdir(schemas) if isfile(join(schemas,f)) ] for f in onlyfiles: zipincludes.append((os.path.join(schemas, f), os.path.join("jsonschema", "schemas", f))) - # Check if we are in Conda env - if 'CONDA_ENV_PATH' in os.environ: - libsodium_path = os.path.join(os.environ['CONDA_ENV_PATH'], "lib", - "libsodium.so.13") - includefiles.append((libsodium_path, "libsodium.so.13")) +if sys.platform == "darwin": + info = subprocess.check_output(["brew", "info", "libsodium"]) + info = info.decode().splitlines(keepends=False) + if len(info) > 1: + library_path = info[3].split(" ")[0] + libsodium_path = os.path.join(library_path, "lib", + "libsodium.dylib") + includefiles.append(libsodium_path) + print(libsodium_path) + else: + print("Erreur : libsodium not found. Please install it with brew install libsodium.") + print("Includes : ") @@ -80,6 +83,7 @@ print("Zip files : ") print(zipincludes) print("Packages : ") print(packages) +print("Sys.path : ") print(sys.path) options = {"path": sys.path, diff --git a/src/sakia/gui/import_account.py b/src/sakia/gui/import_account.py index 0a453fc05caae61dc1bbef5322981f3c4976fadf..a7ee0dbb1368d95aaa07f5ff506d4999a21b43a5 100644 --- a/src/sakia/gui/import_account.py +++ b/src/sakia/gui/import_account.py @@ -24,6 +24,7 @@ class ImportAccountDialog(QDialog, Ui_ImportAccountDialog): self.setupUi(self) self.app = app self.main_window = parent + self.selected_file = "" self.button_box.button(QDialogButtonBox.Ok).setEnabled(False) def accept(self): diff --git a/src/sakia/main.py b/src/sakia/main.py index 9ae7dd602a51555bbbcf207c0054b07347adc45e..65844f363335e26a36e549b38bc3f29c00c1f34a 100755 --- a/src/sakia/main.py +++ b/src/sakia/main.py @@ -10,6 +10,9 @@ import logging import os import traceback +# To debug missing spec +import jsonschema + # To force cx_freeze import import PyQt5.QtSvg