diff --git a/electrum/contrib/base.sh b/electrum/contrib/base.sh --- a/electrum/contrib/base.sh +++ b/electrum/contrib/base.sh @@ -300,8 +300,3 @@ # This variable is set to avoid sourcing base.sh multiple times export _BASE_SH_SOURCED=1 - -function get_electrum_version() -{ - grep ^VERSION_TUPLE ${ELECTRUM_ROOT}/electrumabc/version.py | sed 's/.*(\([0-9, ]*\))/\1/' | sed 's/, /./g' -} diff --git a/electrum/contrib/build-linux/appimage/_build.sh b/electrum/contrib/build-linux/appimage/_build.sh --- a/electrum/contrib/build-linux/appimage/_build.sh +++ b/electrum/contrib/build-linux/appimage/_build.sh @@ -16,8 +16,6 @@ # pinned versions PKG2APPIMAGE_COMMIT="eb8f3acdd9f11ab19b78f5cb15daa772367daf15" -APPIMAGE="$DISTDIR/$PACKAGE-${ELECTRUM_VERSION}-x86_64.AppImage" - rm -rf "$BUILDDIR" mkdir -p "$APPDIR" "$CACHEDIR" "$DISTDIR" @@ -101,6 +99,10 @@ "$python" -m pip install --no-deps --no-warn-script-location --no-binary :all: --only-binary hidapi --cache-dir "$CACHEDIR/pip_cache" -r "$CONTRIB/deterministic-build/requirements-hw.txt" "$python" -m pip install --no-deps --no-warn-script-location --cache-dir "$CACHEDIR/pip_cache" "${ELECTRUM_ROOT}" + +# setup.py depends on the build tools (setuptools), so get the version before uninstalling them +ELECTRUM_VERSION=$($python ${ELECTRUM_ROOT}/setup.py --version) + "$python" -m pip uninstall -y -r "$CONTRIB/requirements/requirements-build-uninstall.txt" @@ -217,6 +219,8 @@ "$BUILDDIR/squashfs-root/usr/lib/appimagekit/mksquashfs_orig" \$args EOF chmod +x "$BUILDDIR/squashfs-root/usr/lib/appimagekit/mksquashfs" + + APPIMAGE="$DISTDIR/$PACKAGE-${ELECTRUM_VERSION}-x86_64.AppImage" env VERSION="${ELECTRUM_VERSION}" ARCH=x86_64 ./squashfs-root/AppRun --no-appstream --verbose "$APPDIR" "$APPIMAGE" \ || fail "AppRun failed" ) || fail "Could not create the AppImage" diff --git a/electrum/contrib/build-linux/appimage/build.sh b/electrum/contrib/build-linux/appimage/build.sh --- a/electrum/contrib/build-linux/appimage/build.sh +++ b/electrum/contrib/build-linux/appimage/build.sh @@ -44,7 +44,6 @@ -e HOME="$MAPPED_DIR/contrib/build-linux/appimage/home" \ -e BUILD_DEBUG="$BUILD_DEBUG" \ -e ELECTRUM_ROOT=${MAPPED_DIR} \ - -e ELECTRUM_VERSION=$(get_electrum_version) \ --name $CONTAINERNAME \ -v ${ELECTRUM_ROOT}:$MAPPED_DIR:delegated \ --rm \ diff --git a/electrum/contrib/build-wine/_build.sh b/electrum/contrib/build-wine/_build.sh --- a/electrum/contrib/build-wine/_build.sh +++ b/electrum/contrib/build-wine/_build.sh @@ -207,9 +207,9 @@ done popd_pkg - pushd "$here"/../.. # go to top level + ELECTRUM_VERSION=$($PYTHON ${ELECTRUM_ROOT}/setup.py --version | tr -d '\r') info "Version to release: ${ELECTRUM_VERSION}" info "Fudging timestamps on all files for determinism ..." find -exec touch -d '2000-11-11T11:11:11+00:00' {} + diff --git a/electrum/contrib/build-wine/build.sh b/electrum/contrib/build-wine/build.sh --- a/electrum/contrib/build-wine/build.sh +++ b/electrum/contrib/build-wine/build.sh @@ -55,7 +55,6 @@ -u $USER_ID:$GROUP_ID \ -e HOME=/homedir \ -e ELECTRUM_ROOT=${MAPPED_DIR} \ - -e ELECTRUM_VERSION=$(get_electrum_version) \ -e GIT_COMMIT_HASH=$(git rev-parse HEAD) \ -e WIN_ARCH="$WIN_ARCH" \ -e BUILD_DEBUG="$BUILD_DEBUG" \ diff --git a/electrum/contrib/osx/make_osx b/electrum/contrib/osx/make_osx --- a/electrum/contrib/osx/make_osx +++ b/electrum/contrib/osx/make_osx @@ -51,7 +51,7 @@ cd "$build_dir/../.." -VERSION=`git describe --tags` +VERSION=$(python3 ${ELECTRUM_ROOT}/setup.py --version) GIT_COMMIT_HASH=$(git rev-parse HEAD) # Paramterize diff --git a/electrum/setup.py b/electrum/setup.py --- a/electrum/setup.py +++ b/electrum/setup.py @@ -11,25 +11,28 @@ import setuptools.command.sdist from setuptools import setup -with open("README.md", "r", encoding="utf-8") as f: +ELECTRUM_ROOT = os.path.dirname(os.path.abspath(__file__)) +REQUIREMENTS_DIR = os.path.join(ELECTRUM_ROOT, "contrib", "requirements") + +with open(os.path.join(ELECTRUM_ROOT, "README.md"), "r", encoding="utf-8") as f: long_description = f.read() -with open("contrib/requirements/requirements.txt", encoding="utf-8") as f: +with open(os.path.join(REQUIREMENTS_DIR, "requirements.txt"), encoding="utf-8") as f: requirements = f.read().splitlines() -with open("contrib/requirements/requirements-hw.txt", encoding="utf-8") as f: +with open(os.path.join(REQUIREMENTS_DIR, "requirements-hw.txt"), encoding="utf-8") as f: requirements_hw = f.read().splitlines() -with open("contrib/requirements/requirements-binaries.txt", encoding="utf-8") as f: +with open( + os.path.join(REQUIREMENTS_DIR, "requirements-binaries.txt"), encoding="utf-8" +) as f: requirements_binaries = f.read().splitlines() # We use this convoluted way of importing version.py and constants.py # because the setup.py scripts tends to be called with python option # -O, which is not allowed for electrumabc (see comment in module # electrumabc/bitcoin.py). A regular import would trigger this issue. -dirname = os.path.dirname(os.path.abspath(__file__)) -ec_package_dirname = os.path.join(dirname, "electrumabc") -sys.path.insert(0, ec_package_dirname) +sys.path.insert(0, os.path.join(ELECTRUM_ROOT, "electrumabc")) def get_version():