URI: 
       trename contrib/build-osx as contrib/osx. Move QRReader submodule there. - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit d7bf8826fc1e8c3692504edbe60523dd1327b8a0
   DIR parent db89286ec3fa19156b7a85628e93469ef1616546
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Thu, 29 Nov 2018 11:39:57 +0100
       
       rename contrib/build-osx as contrib/osx. Move QRReader submodule there.
       
       Diffstat:
         M .gitmodules                         |       4 ++--
         M README.rst                          |       2 +-
         D contrib/build-osx/README.md         |      37 -------------------------------
         D contrib/build-osx/make_osx          |     138 ------------------------------
         D contrib/build-osx/osx.spec          |     107 -------------------------------
         A contrib/osx/README.md               |      37 +++++++++++++++++++++++++++++++
         R contrib/build-osx/base.sh -> contr… |       0 
         R contrib/build-osx/cdrkit-determini… |       0 
         A contrib/osx/make_osx                |     138 ++++++++++++++++++++++++++++++
         A contrib/osx/osx.spec                |     107 +++++++++++++++++++++++++++++++
         R contrib/build-osx/package.sh -> co… |       0 
         M electrum/qrscanner.py               |       4 ++--
       
       12 files changed, 287 insertions(+), 287 deletions(-)
       ---
   DIR diff --git a/.gitmodules b/.gitmodules
       t@@ -4,6 +4,6 @@
        [submodule "contrib/deterministic-build/electrum-locale"]
                path = contrib/deterministic-build/electrum-locale
                url = https://github.com/spesmilo/electrum-locale
       -[submodule "contrib/CalinsQRReader"]
       -        path = contrib/CalinsQRReader
       +[submodule "contrib/osx/CalinsQRReader"]
       +        path = contrib/osx/CalinsQRReader
                url = https://github.com/spesmilo/CalinsQRReader
   DIR diff --git a/README.rst b/README.rst
       t@@ -101,7 +101,7 @@ This directory contains the python dependencies used by Electrum.
        Mac OS X / macOS
        --------
        
       -See `contrib/build-osx/`.
       +See `contrib/osx/`.
        
        Windows
        -------
   DIR diff --git a/contrib/build-osx/README.md b/contrib/build-osx/README.md
       t@@ -1,36 +0,0 @@
       -Building Mac OS binaries
       -========================
       -
       -This guide explains how to build Electrum binaries for macOS systems.
       -
       -The build process consists of two steps:
       -
       -## 1. Building the binary
       -
       -This needs to be done on a system running macOS or OS X. We use El Capitan (10.11.6) as building it on High Sierra
       -makes the binaries incompatible with older versions. 
       -
       -Before starting, make sure that the Xcode command line tools are installed (e.g. you have `git`).
       -
       -
       -    cd electrum
       -    ./contrib/build-osx/make_osx
       -    
       -This creates a folder named Electrum.app.
       -
       -## 2. Building the image 
       -The usual way to distribute macOS applications is to use image files containing the 
       -application. Although these images can be created on a Mac with the built-in `hdiutil`,
       -they are not deterministic.
       -
       -Instead, we use the toolchain that Bitcoin uses: genisoimage and libdmg-hfsplus.
       -These tools do not work on macOS, so you need a separate Linux machine (or VM).
       -
       -Copy the Electrum.app directory over and install the dependencies, e.g.:
       -
       -    apt install libcap-dev cmake make gcc faketime
       -    
       -Then you can just invoke `package.sh` with the path to the app:
       -
       -    cd electrum
       -    ./contrib/build-osx/package.sh ~/Electrum.app/
       -\ No newline at end of file
   DIR diff --git a/contrib/build-osx/make_osx b/contrib/build-osx/make_osx
       t@@ -1,138 +0,0 @@
       -#!/usr/bin/env bash
       -
       -# Parameterize
       -PYTHON_VERSION=3.6.4
       -BUILDDIR=/tmp/electrum-build
       -PACKAGE=Electrum
       -GIT_REPO=https://github.com/spesmilo/electrum
       -LIBSECP_VERSION=452d8e4d2a2f9f1b5be6b02e18f1ba102e5ca0b4
       -
       -. $(dirname "$0")/base.sh
       -
       -src_dir=$(dirname "$0")
       -cd $src_dir/../..
       -
       -export PYTHONHASHSEED=22
       -VERSION=`git describe --tags --dirty --always`
       -
       -which brew > /dev/null 2>&1 || fail "Please install brew from https://brew.sh/ to continue"
       -which xcodebuild > /dev/null 2>&1 || fail "Please install Xcode and xcode command line tools to continue"
       -
       -# Code Signing: See https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html
       -APP_SIGN=""
       -if [ -n "$1" ]; then
       -    # Test the identity is valid for signing by doing this hack. There is no other way to do this.
       -    cp -f /bin/ls ./CODESIGN_TEST
       -    codesign -s "$1" --dryrun -f ./CODESIGN_TEST > /dev/null 2>&1
       -    res=$?
       -    rm -f ./CODESIGN_TEST
       -    if ((res)); then
       -        fail "Code signing identity \"$1\" appears to be invalid."
       -    fi
       -    unset res
       -    APP_SIGN="$1"
       -    info "Code signing enabled using identity \"$APP_SIGN\""
       -else
       -    warn "Code signing DISABLED. Specify a valid macOS Developer identity installed on the system as the first argument to this script to enable signing."
       -fi
       -
       -info "Installing Python $PYTHON_VERSION"
       -export PATH="~/.pyenv/bin:~/.pyenv/shims:~/Library/Python/3.6/bin:$PATH"
       -if [ -d "~/.pyenv" ]; then
       -  pyenv update
       -else
       -  curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash > /dev/null 2>&1
       -fi
       -PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install -s $PYTHON_VERSION && \
       -pyenv global $PYTHON_VERSION || \
       -fail "Unable to use Python $PYTHON_VERSION"
       -
       -
       -info "Installing pyinstaller"
       -python3 -m pip install -I --user pyinstaller==3.4 || fail "Could not install pyinstaller"
       -
       -info "Using these versions for building $PACKAGE:"
       -sw_vers
       -python3 --version
       -echo -n "Pyinstaller "
       -pyinstaller --version
       -
       -rm -rf ./dist
       -
       -git submodule init
       -git submodule update
       -
       -rm  -rf $BUILDDIR > /dev/null 2>&1
       -mkdir $BUILDDIR
       -
       -cp -R ./contrib/deterministic-build/electrum-locale/locale/ ./electrum/locale/
       -cp    ./contrib/deterministic-build/electrum-icons/icons_rc.py ./electrum/gui/qt/
       -
       -
       -info "Downloading libusb..."
       -curl https://homebrew.bintray.com/bottles/libusb-1.0.22.el_capitan.bottle.tar.gz | \
       -tar xz --directory $BUILDDIR
       -cp $BUILDDIR/libusb/1.0.22/lib/libusb-1.0.dylib contrib/build-osx
       -DoCodeSignMaybe "libusb" "contrib/build-osx/libusb-1.0.dylib" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       -
       -info "Building libsecp256k1"
       -brew install autoconf automake libtool
       -git clone https://github.com/bitcoin-core/secp256k1 $BUILDDIR/secp256k1
       -pushd $BUILDDIR/secp256k1
       -git reset --hard $LIBSECP_VERSION
       -git clean -f -x -q
       -./autogen.sh
       -./configure --enable-module-recovery --enable-experimental --enable-module-ecdh --disable-jni
       -make
       -popd
       -cp $BUILDDIR/secp256k1/.libs/libsecp256k1.0.dylib contrib/build-osx
       -DoCodeSignMaybe "libsecp256k1" "contrib/build-osx/libsecp256k1.0.dylib" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       -
       -info "Building CalinsQRReader..."
       -d=contrib/CalinsQRReader
       -pushd $d
       -rm -fr build
       -xcodebuild || fail "Could not build CalinsQRReader"
       -popd
       -DoCodeSignMaybe "CalinsQRReader.app" "${d}/build/Release/CalinsQRReader.app" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       -
       -
       -info "Installing requirements..."
       -python3 -m pip install -Ir ./contrib/deterministic-build/requirements.txt --user && \
       -python3 -m pip install -Ir ./contrib/deterministic-build/requirements-binaries.txt --user || \
       -fail "Could not install requirements"
       -
       -info "Installing hardware wallet requirements..."
       -python3 -m pip install -Ir ./contrib/deterministic-build/requirements-hw.txt --user || \
       -fail "Could not install hardware wallet requirements"
       -
       -info "Building $PACKAGE..."
       -python3 setup.py install --user > /dev/null || fail "Could not build $PACKAGE"
       -
       -info "Faking timestamps..."
       -for d in ~/Library/Python/ ~/.pyenv .; do
       -  pushd $d
       -  find . -exec touch -t '200101220000' {} +
       -  popd
       -done
       -
       -info "Building binary"
       -pyinstaller --noconfirm --ascii --clean --name $VERSION contrib/build-osx/osx.spec || fail "Could not build binary"
       -
       -info "Adding bitcoin URI types to Info.plist"
       -plutil -insert 'CFBundleURLTypes' \
       -        -xml '<array><dict> <key>CFBundleURLName</key> <string>bitcoin</string> <key>CFBundleURLSchemes</key> <array><string>bitcoin</string></array> </dict></array>' \
       -        -- dist/$PACKAGE.app/Contents/Info.plist \
       -        || fail "Could not add keys to Info.plist. Make sure the program 'plutil' exists and is installed."
       -
       -DoCodeSignMaybe "app bundle" "dist/${PACKAGE}.app" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       -
       -info "Creating .DMG"
       -hdiutil create -fs HFS+ -volname $PACKAGE -srcfolder dist/$PACKAGE.app dist/electrum-$VERSION.dmg || fail "Could not create .DMG"
       -
       -DoCodeSignMaybe ".DMG" "dist/electrum-${VERSION}.dmg" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       -
       -if [ -z "$APP_SIGN" ]; then
       -    warn "App was built successfully but was not code signed. Users may get security warnings from macOS."
       -    warn "Specify a valid code signing identity as the first argument to this script to enable code signing."
       -fi
   DIR diff --git a/contrib/build-osx/osx.spec b/contrib/build-osx/osx.spec
       t@@ -1,107 +0,0 @@
       -# -*- mode: python -*-
       -
       -from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
       -
       -import sys
       -import os
       -
       -PACKAGE='Electrum'
       -PYPKG='electrum'
       -MAIN_SCRIPT='run_electrum'
       -ICONS_FILE='electrum.icns'
       -
       -for i, x in enumerate(sys.argv):
       -    if x == '--name':
       -        VERSION = sys.argv[i+1]
       -        break
       -else:
       -    raise Exception('no version')
       -
       -electrum = os.path.abspath(".") + "/"
       -block_cipher = None
       -
       -# see https://github.com/pyinstaller/pyinstaller/issues/2005
       -hiddenimports = []
       -hiddenimports += collect_submodules('trezorlib')
       -hiddenimports += collect_submodules('safetlib')
       -hiddenimports += collect_submodules('btchip')
       -hiddenimports += collect_submodules('keepkeylib')
       -hiddenimports += collect_submodules('websocket')
       -hiddenimports += collect_submodules('ckcc')
       -
       -datas = [
       -    (electrum + PYPKG + '/*.json', PYPKG),
       -    (electrum + PYPKG + '/wordlist/english.txt', PYPKG + '/wordlist'),
       -    (electrum + PYPKG + '/locale', PYPKG + '/locale'),
       -    (electrum + PYPKG + '/plugins', PYPKG + '/plugins'),
       -]
       -datas += collect_data_files('trezorlib')
       -datas += collect_data_files('safetlib')
       -datas += collect_data_files('btchip')
       -datas += collect_data_files('keepkeylib')
       -datas += collect_data_files('ckcc')
       -
       -# Add the QR Scanner helper app
       -datas += [(electrum + "contrib/CalinsQRReader/build/Release/CalinsQRReader.app", "./contrib/CalinsQRReader/build/Release/CalinsQRReader.app")]
       -
       -# Add libusb so Trezor and Safe-T mini will work
       -binaries = [(electrum + "contrib/build-osx/libusb-1.0.dylib", ".")]
       -binaries += [(electrum + "contrib/build-osx/libsecp256k1.0.dylib", ".")]
       -
       -# Workaround for "Retro Look":
       -binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]]
       -
       -# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports
       -a = Analysis([electrum+ MAIN_SCRIPT,
       -              electrum+'electrum/gui/qt/main_window.py',
       -              electrum+'electrum/gui/text.py',
       -              electrum+'electrum/util.py',
       -              electrum+'electrum/wallet.py',
       -              electrum+'electrum/simple_config.py',
       -              electrum+'electrum/bitcoin.py',
       -              electrum+'electrum/dnssec.py',
       -              electrum+'electrum/commands.py',
       -              electrum+'electrum/plugins/cosigner_pool/qt.py',
       -              electrum+'electrum/plugins/email_requests/qt.py',
       -              electrum+'electrum/plugins/trezor/client.py',
       -              electrum+'electrum/plugins/trezor/qt.py',
       -              electrum+'electrum/plugins/safe_t/client.py',
       -              electrum+'electrum/plugins/safe_t/qt.py',
       -              electrum+'electrum/plugins/keepkey/qt.py',
       -              electrum+'electrum/plugins/ledger/qt.py',
       -              electrum+'electrum/plugins/coldcard/qt.py',
       -              ],
       -             binaries=binaries,
       -             datas=datas,
       -             hiddenimports=hiddenimports,
       -             hookspath=[])
       -
       -# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal
       -for d in a.datas:
       -    if 'pyconfig' in d[0]:
       -        a.datas.remove(d)
       -        break
       -
       -pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
       -
       -exe = EXE(pyz,
       -          a.scripts,
       -          a.binaries,
       -          a.datas,
       -          name=PACKAGE,
       -          debug=False,
       -          strip=False,
       -          upx=True,
       -          icon=electrum+ICONS_FILE,
       -          console=False)
       -
       -app = BUNDLE(exe,
       -             version = VERSION,
       -             name=PACKAGE + '.app',
       -             icon=electrum+ICONS_FILE,
       -             bundle_identifier=None,
       -             info_plist={
       -                'NSHighResolutionCapable': 'True',
       -                'NSSupportsAutomaticGraphicsSwitching': 'True'
       -             }
       -)
   DIR diff --git a/contrib/osx/README.md b/contrib/osx/README.md
       t@@ -0,0 +1,36 @@
       +Building Mac OS binaries
       +========================
       +
       +This guide explains how to build Electrum binaries for macOS systems.
       +
       +The build process consists of two steps:
       +
       +## 1. Building the binary
       +
       +This needs to be done on a system running macOS or OS X. We use El Capitan (10.11.6) as building it on High Sierra
       +makes the binaries incompatible with older versions. 
       +
       +Before starting, make sure that the Xcode command line tools are installed (e.g. you have `git`).
       +
       +
       +    cd electrum
       +    ./contrib/osx/make_osx
       +    
       +This creates a folder named Electrum.app.
       +
       +## 2. Building the image 
       +The usual way to distribute macOS applications is to use image files containing the 
       +application. Although these images can be created on a Mac with the built-in `hdiutil`,
       +they are not deterministic.
       +
       +Instead, we use the toolchain that Bitcoin uses: genisoimage and libdmg-hfsplus.
       +These tools do not work on macOS, so you need a separate Linux machine (or VM).
       +
       +Copy the Electrum.app directory over and install the dependencies, e.g.:
       +
       +    apt install libcap-dev cmake make gcc faketime
       +    
       +Then you can just invoke `package.sh` with the path to the app:
       +
       +    cd electrum
       +    ./contrib/osx/package.sh ~/Electrum.app/
       +\ No newline at end of file
   DIR diff --git a/contrib/build-osx/base.sh b/contrib/osx/base.sh
   DIR diff --git a/contrib/build-osx/cdrkit-deterministic.patch b/contrib/osx/cdrkit-deterministic.patch
   DIR diff --git a/contrib/osx/make_osx b/contrib/osx/make_osx
       t@@ -0,0 +1,138 @@
       +#!/usr/bin/env bash
       +
       +# Parameterize
       +PYTHON_VERSION=3.6.4
       +BUILDDIR=/tmp/electrum-build
       +PACKAGE=Electrum
       +GIT_REPO=https://github.com/spesmilo/electrum
       +LIBSECP_VERSION=452d8e4d2a2f9f1b5be6b02e18f1ba102e5ca0b4
       +
       +. $(dirname "$0")/base.sh
       +
       +src_dir=$(dirname "$0")
       +cd $src_dir/../..
       +
       +export PYTHONHASHSEED=22
       +VERSION=`git describe --tags --dirty --always`
       +
       +which brew > /dev/null 2>&1 || fail "Please install brew from https://brew.sh/ to continue"
       +which xcodebuild > /dev/null 2>&1 || fail "Please install Xcode and xcode command line tools to continue"
       +
       +# Code Signing: See https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html
       +APP_SIGN=""
       +if [ -n "$1" ]; then
       +    # Test the identity is valid for signing by doing this hack. There is no other way to do this.
       +    cp -f /bin/ls ./CODESIGN_TEST
       +    codesign -s "$1" --dryrun -f ./CODESIGN_TEST > /dev/null 2>&1
       +    res=$?
       +    rm -f ./CODESIGN_TEST
       +    if ((res)); then
       +        fail "Code signing identity \"$1\" appears to be invalid."
       +    fi
       +    unset res
       +    APP_SIGN="$1"
       +    info "Code signing enabled using identity \"$APP_SIGN\""
       +else
       +    warn "Code signing DISABLED. Specify a valid macOS Developer identity installed on the system as the first argument to this script to enable signing."
       +fi
       +
       +info "Installing Python $PYTHON_VERSION"
       +export PATH="~/.pyenv/bin:~/.pyenv/shims:~/Library/Python/3.6/bin:$PATH"
       +if [ -d "~/.pyenv" ]; then
       +  pyenv update
       +else
       +  curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash > /dev/null 2>&1
       +fi
       +PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install -s $PYTHON_VERSION && \
       +pyenv global $PYTHON_VERSION || \
       +fail "Unable to use Python $PYTHON_VERSION"
       +
       +
       +info "Installing pyinstaller"
       +python3 -m pip install -I --user pyinstaller==3.4 || fail "Could not install pyinstaller"
       +
       +info "Using these versions for building $PACKAGE:"
       +sw_vers
       +python3 --version
       +echo -n "Pyinstaller "
       +pyinstaller --version
       +
       +rm -rf ./dist
       +
       +git submodule init
       +git submodule update
       +
       +rm  -rf $BUILDDIR > /dev/null 2>&1
       +mkdir $BUILDDIR
       +
       +cp -R ./contrib/deterministic-build/electrum-locale/locale/ ./electrum/locale/
       +cp    ./contrib/deterministic-build/electrum-icons/icons_rc.py ./electrum/gui/qt/
       +
       +
       +info "Downloading libusb..."
       +curl https://homebrew.bintray.com/bottles/libusb-1.0.22.el_capitan.bottle.tar.gz | \
       +tar xz --directory $BUILDDIR
       +cp $BUILDDIR/libusb/1.0.22/lib/libusb-1.0.dylib contrib/osx
       +DoCodeSignMaybe "libusb" "contrib/osx/libusb-1.0.dylib" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       +
       +info "Building libsecp256k1"
       +brew install autoconf automake libtool
       +git clone https://github.com/bitcoin-core/secp256k1 $BUILDDIR/secp256k1
       +pushd $BUILDDIR/secp256k1
       +git reset --hard $LIBSECP_VERSION
       +git clean -f -x -q
       +./autogen.sh
       +./configure --enable-module-recovery --enable-experimental --enable-module-ecdh --disable-jni
       +make
       +popd
       +cp $BUILDDIR/secp256k1/.libs/libsecp256k1.0.dylib contrib/osx
       +DoCodeSignMaybe "libsecp256k1" "contrib/osx/libsecp256k1.0.dylib" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       +
       +info "Building CalinsQRReader..."
       +d=contrib/osx/CalinsQRReader
       +pushd $d
       +rm -fr build
       +xcodebuild || fail "Could not build CalinsQRReader"
       +popd
       +DoCodeSignMaybe "CalinsQRReader.app" "${d}/build/Release/CalinsQRReader.app" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       +
       +
       +info "Installing requirements..."
       +python3 -m pip install -Ir ./contrib/deterministic-build/requirements.txt --user && \
       +python3 -m pip install -Ir ./contrib/deterministic-build/requirements-binaries.txt --user || \
       +fail "Could not install requirements"
       +
       +info "Installing hardware wallet requirements..."
       +python3 -m pip install -Ir ./contrib/deterministic-build/requirements-hw.txt --user || \
       +fail "Could not install hardware wallet requirements"
       +
       +info "Building $PACKAGE..."
       +python3 setup.py install --user > /dev/null || fail "Could not build $PACKAGE"
       +
       +info "Faking timestamps..."
       +for d in ~/Library/Python/ ~/.pyenv .; do
       +  pushd $d
       +  find . -exec touch -t '200101220000' {} +
       +  popd
       +done
       +
       +info "Building binary"
       +pyinstaller --noconfirm --ascii --clean --name $VERSION contrib/osx/osx.spec || fail "Could not build binary"
       +
       +info "Adding bitcoin URI types to Info.plist"
       +plutil -insert 'CFBundleURLTypes' \
       +        -xml '<array><dict> <key>CFBundleURLName</key> <string>bitcoin</string> <key>CFBundleURLSchemes</key> <array><string>bitcoin</string></array> </dict></array>' \
       +        -- dist/$PACKAGE.app/Contents/Info.plist \
       +        || fail "Could not add keys to Info.plist. Make sure the program 'plutil' exists and is installed."
       +
       +DoCodeSignMaybe "app bundle" "dist/${PACKAGE}.app" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       +
       +info "Creating .DMG"
       +hdiutil create -fs HFS+ -volname $PACKAGE -srcfolder dist/$PACKAGE.app dist/electrum-$VERSION.dmg || fail "Could not create .DMG"
       +
       +DoCodeSignMaybe ".DMG" "dist/electrum-${VERSION}.dmg" "$APP_SIGN" # If APP_SIGN is empty will be a noop
       +
       +if [ -z "$APP_SIGN" ]; then
       +    warn "App was built successfully but was not code signed. Users may get security warnings from macOS."
       +    warn "Specify a valid code signing identity as the first argument to this script to enable code signing."
       +fi
   DIR diff --git a/contrib/osx/osx.spec b/contrib/osx/osx.spec
       t@@ -0,0 +1,107 @@
       +# -*- mode: python -*-
       +
       +from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
       +
       +import sys
       +import os
       +
       +PACKAGE='Electrum'
       +PYPKG='electrum'
       +MAIN_SCRIPT='run_electrum'
       +ICONS_FILE='electrum.icns'
       +
       +for i, x in enumerate(sys.argv):
       +    if x == '--name':
       +        VERSION = sys.argv[i+1]
       +        break
       +else:
       +    raise Exception('no version')
       +
       +electrum = os.path.abspath(".") + "/"
       +block_cipher = None
       +
       +# see https://github.com/pyinstaller/pyinstaller/issues/2005
       +hiddenimports = []
       +hiddenimports += collect_submodules('trezorlib')
       +hiddenimports += collect_submodules('safetlib')
       +hiddenimports += collect_submodules('btchip')
       +hiddenimports += collect_submodules('keepkeylib')
       +hiddenimports += collect_submodules('websocket')
       +hiddenimports += collect_submodules('ckcc')
       +
       +datas = [
       +    (electrum + PYPKG + '/*.json', PYPKG),
       +    (electrum + PYPKG + '/wordlist/english.txt', PYPKG + '/wordlist'),
       +    (electrum + PYPKG + '/locale', PYPKG + '/locale'),
       +    (electrum + PYPKG + '/plugins', PYPKG + '/plugins'),
       +]
       +datas += collect_data_files('trezorlib')
       +datas += collect_data_files('safetlib')
       +datas += collect_data_files('btchip')
       +datas += collect_data_files('keepkeylib')
       +datas += collect_data_files('ckcc')
       +
       +# Add the QR Scanner helper app
       +datas += [(electrum + "contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app", "./contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app")]
       +
       +# Add libusb so Trezor and Safe-T mini will work
       +binaries = [(electrum + "contrib/osx/libusb-1.0.dylib", ".")]
       +binaries += [(electrum + "contrib/osx/libsecp256k1.0.dylib", ".")]
       +
       +# Workaround for "Retro Look":
       +binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]]
       +
       +# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports
       +a = Analysis([electrum+ MAIN_SCRIPT,
       +              electrum+'electrum/gui/qt/main_window.py',
       +              electrum+'electrum/gui/text.py',
       +              electrum+'electrum/util.py',
       +              electrum+'electrum/wallet.py',
       +              electrum+'electrum/simple_config.py',
       +              electrum+'electrum/bitcoin.py',
       +              electrum+'electrum/dnssec.py',
       +              electrum+'electrum/commands.py',
       +              electrum+'electrum/plugins/cosigner_pool/qt.py',
       +              electrum+'electrum/plugins/email_requests/qt.py',
       +              electrum+'electrum/plugins/trezor/client.py',
       +              electrum+'electrum/plugins/trezor/qt.py',
       +              electrum+'electrum/plugins/safe_t/client.py',
       +              electrum+'electrum/plugins/safe_t/qt.py',
       +              electrum+'electrum/plugins/keepkey/qt.py',
       +              electrum+'electrum/plugins/ledger/qt.py',
       +              electrum+'electrum/plugins/coldcard/qt.py',
       +              ],
       +             binaries=binaries,
       +             datas=datas,
       +             hiddenimports=hiddenimports,
       +             hookspath=[])
       +
       +# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal
       +for d in a.datas:
       +    if 'pyconfig' in d[0]:
       +        a.datas.remove(d)
       +        break
       +
       +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
       +
       +exe = EXE(pyz,
       +          a.scripts,
       +          a.binaries,
       +          a.datas,
       +          name=PACKAGE,
       +          debug=False,
       +          strip=False,
       +          upx=True,
       +          icon=electrum+ICONS_FILE,
       +          console=False)
       +
       +app = BUNDLE(exe,
       +             version = VERSION,
       +             name=PACKAGE + '.app',
       +             icon=electrum+ICONS_FILE,
       +             bundle_identifier=None,
       +             info_plist={
       +                'NSHighResolutionCapable': 'True',
       +                'NSSupportsAutomaticGraphicsSwitching': 'True'
       +             }
       +)
   DIR diff --git a/contrib/build-osx/package.sh b/contrib/osx/package.sh
   DIR diff --git a/electrum/qrscanner.py b/electrum/qrscanner.py
       t@@ -73,9 +73,9 @@ def scan_barcode_osx(*args_ignored, **kwargs_ignored):
            import subprocess
            # NOTE: This code needs to be modified if the positions of this file changes with respect to the helper app!
            # This assumes the built macOS .app bundle which ends up putting the helper app in
       -    # .app/contrib/CalinsQRReader/build/Release/CalinsQRReader.app.
       +    # .app/contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app.
            root_ec_dir = os.path.abspath(os.path.dirname(__file__) + "/../")
       -    prog = root_ec_dir + "/" + "contrib/CalinsQRReader/build/Release/CalinsQRReader.app/Contents/MacOS/CalinsQRReader"
       +    prog = root_ec_dir + "/" + "contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app/Contents/MacOS/CalinsQRReader"
            if not os.path.exists(prog):
                raise RuntimeError("Cannot start QR scanner; helper app not found.")
            data = ''