Skip to content

Commit

Permalink
Merge caa05b4 into c4ecb02
Browse files Browse the repository at this point in the history
  • Loading branch information
cculianu committed Oct 18, 2020
2 parents c4ecb02 + caa05b4 commit 9a0ba25
Show file tree
Hide file tree
Showing 250 changed files with 122 additions and 162 deletions.
8 changes: 3 additions & 5 deletions .gitignore
Expand Up @@ -17,7 +17,9 @@ env/
bin/
/app.fil
tmp/
lib/*.so.0
electroncash/*.so.0
electroncash/*.dylib
contrib/osx/*.dylib

# tox files
.cache/
Expand All @@ -37,7 +39,3 @@ xcuserdata/
# mypy
.mypy_cache/

# Some people need to set up these symlinks to get their IDE completion working
electroncash
electroncash_gui
electroncash_plugins
7 changes: 3 additions & 4 deletions MANIFEST.in
Expand Up @@ -6,12 +6,11 @@ include *.py
include electron-cash
include contrib/requirements/requirements.txt
include contrib/requirements/requirements-hw.txt
recursive-include lib *.py
recursive-include gui *.py
recursive-include plugins *.py
recursive-include electroncash *.py
recursive-include electroncash_gui *.py
recursive-include electroncash_plugins *.py
recursive-include packages *.py
recursive-include packages cacert.pem
include icons.qrc
recursive-include icons *
recursive-include scripts *

6 changes: 3 additions & 3 deletions android/Dockerfile
Expand Up @@ -31,16 +31,16 @@ COPY android/build-requirements.txt android/
RUN wget -O - https://bootstrap.pypa.io/get-pip.py | python3.6 && \
pip3 install -r android/build-requirements.txt
COPY contrib/make_locale contrib/
COPY gui gui
COPY electroncash_gui electroncash_gui
COPY ios/ElectronCash/electroncash_gui/ios_native ios/ElectronCash/electroncash_gui/ios_native
COPY plugins plugins
COPY electroncash_plugins electroncash_plugins

# The app itself. Specifically check for the keystore, otherwise it'll build an APK with no
# certificates.
COPY android android
COPY android/keystore.jks android/
COPY contrib/deterministic-build contrib/deterministic-build
COPY lib lib
COPY electroncash electroncash

RUN echo "sdk.dir=$(pwd)/android-sdk" > android/local.properties
RUN cd android && ./gradlew app:assembleMainNetRelease
23 changes: 8 additions & 15 deletions android/app/build.gradle
Expand Up @@ -21,7 +21,7 @@ android {
targetSdkVersion 29

def ecVersion = null
file("$REPO_ROOT/lib/version.py").eachLine {
file("$REPO_ROOT/electroncash/version.py").eachLine {
def matcher = it =~ / *PACKAGE_VERSION *= *'([0-9.]+)'.*/
if (matcher.matches()) {
ecVersion = matcher.group(1)
Expand Down Expand Up @@ -59,10 +59,14 @@ android {
main {
python {
srcDir REPO_ROOT
include "lib/**" // In ../.. (renamed below)
include("chaquopy/**", "electroncash_gui/**", // In src/main/python
"electroncash_plugins/**") //
include "electroncash/**"
exclude "**/*.po", "**/*.pot"
include "electroncash_gui/__init__.py"
include "electroncash_plugins/__init__.py"

// From src/main/python
include "chaquopy/**"
include "electroncash_gui/android/**"
}
res {
srcDir STRINGS_DIR // Generated by generateStrings below.
Expand Down Expand Up @@ -132,17 +136,6 @@ afterEvaluate {
}

for (variant in android.applicationVariants) {
// Rename directories to match package names, like package_dir does in setup.py.
def task = tasks.getByName("merge${variant.name.capitalize()}PythonSources")
def dstDir = task.destinationDir
task.doLast {
def src = "$dstDir/lib"
def dst = "$dstDir/electroncash"
if (! file(src).renameTo(dst)) {
throw new GradleException("Failed to rename $src to $dst")
}
}

tasks.getByName("generate${variant.name.capitalize()}Resources")
.dependsOn(stringsTask)
}
Expand Down
2 changes: 1 addition & 1 deletion android/app/generate_strings.py
Expand Up @@ -44,7 +44,7 @@ def main():
log("Running make_locale")
run([sys.executable, join(EC_ROOT, "contrib/make_locale")], check=True)

locale_dir = join(EC_ROOT, "lib/locale")
locale_dir = join(EC_ROOT, "electroncash/locale")
lang_strings = defaultdict(list)
for lang_region in [name for name in os.listdir(locale_dir)
if isdir(join(locale_dir, name)) and name != '__pycache__']:
Expand Down
Expand Up @@ -43,7 +43,7 @@ fun toSatoshis(s: String, places: Int = unitPlaces) : Long {
}
}

// We use Locale.US to be consistent with lib/exchange_rate.py, which is also locale-insensitive.
// We use Locale.US to be consistent with electroncash/exchange_rate.py, which is also locale-insensitive.
@JvmOverloads // For data binding call in address_list.xml.
fun formatSatoshis(amount: Long, places: Int = unitPlaces): String {
val unit = Math.pow(10.0, places.toDouble())
Expand Down
2 changes: 0 additions & 2 deletions android/app/src/main/python/electroncash_plugins/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion android/app/src/main/res/values/donottranslate.xml
Expand Up @@ -23,7 +23,7 @@

<string name="default_bip39_derivation">m/44\'/145\'/0\'</string>

<!-- See lib/paymentrequest.py. -->
<!-- See electroncash/paymentrequest.py. -->
<string-array name="payment_status">
<item>@string/pending</item>
<item>@string/expired</item>
Expand Down
2 changes: 1 addition & 1 deletion contrib/build-linux/appimage/_build.sh
Expand Up @@ -100,7 +100,7 @@ info "Preparing electrum-locale"
fail "Please install gettext"
fi
for i in ./locale/*; do
dir="$PROJECT_ROOT/lib/$i/LC_MESSAGES"
dir="$PROJECT_ROOT/electroncash/$i/LC_MESSAGES"
mkdir -p $dir
msgfmt --output-file="$dir/electron-cash.mo" "$i/electron-cash.po" || true
done
Expand Down
6 changes: 3 additions & 3 deletions contrib/build-wine/_build.sh
Expand Up @@ -182,9 +182,9 @@ prepare_wine() {

# libsecp256k1, libzbar & libusb
mkdir -p $WINEPREFIX/drive_c/tmp
cp "$here"/../../lib/*.dll $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libraries to their destination"
cp "$here"/../../electroncash/*.dll $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libraries to their destination"
cp libusb/libusb/.libs/libusb-1.0.dll $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libusb to its destination"
cp "$here"/../../lib/tor/bin/tor.exe $WINEPREFIX/drive_c/tmp/ || fail "Could not copy tor.exe to its destination"
cp "$here"/../../electroncash/tor/bin/tor.exe $WINEPREFIX/drive_c/tmp/ || fail "Could not copy tor.exe to its destination"

info "Installing pyscard..."
wget -O $PYSCARD_FILENAME "$PYSCARD_URL"
Expand Down Expand Up @@ -234,7 +234,7 @@ build_the_app() {
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
popd # go back to $here

cp -r "$here"/../electrum-locale/locale $WINEPREFIX/drive_c/electroncash/lib/
cp -r "$here"/../electrum-locale/locale $WINEPREFIX/drive_c/electroncash/electroncash/

# Install frozen dependencies
info "Installing frozen dependencies ..."
Expand Down
60 changes: 29 additions & 31 deletions contrib/build-wine/deterministic.spec
Expand Up @@ -49,15 +49,15 @@ binaries += [b for b in collect_dynamic_libs('PyQt5') if 'qwindowsvista' in b[0]
binaries += [('C:/python*/Lib/site-packages/smartcard/scard/_scard.cp36-win32.pyd', '.')] # Satochip

datas = [
(home+'lib/currencies.json', 'electroncash'),
(home+'lib/servers.json', 'electroncash'),
(home+'lib/servers_testnet.json', 'electroncash'),
(home+'lib/servers_testnet4.json', 'electroncash'),
(home+'lib/servers_scalenet.json', 'electroncash'),
(home+'lib/wordlist/english.txt', 'electroncash/wordlist'),
(home+'lib/locale', 'electroncash/locale'),
(home+'gui/qt/data/ecsupplemental_win.ttf', 'electroncash_gui/qt/data'),
(home+'plugins', 'electroncash_plugins'),
(home+'electroncash/currencies.json', 'electroncash'),
(home+'electroncash/servers.json', 'electroncash'),
(home+'electroncash/servers_testnet.json', 'electroncash'),
(home+'electroncash/servers_testnet4.json', 'electroncash'),
(home+'electroncash/servers_scalenet.json', 'electroncash'),
(home+'electroncash/wordlist/english.txt', 'electroncash/wordlist'),
(home+'electroncash/locale', 'electroncash/locale'),
(home+'electroncash_gui/qt/data/ecsupplemental_win.ttf', 'electroncash_gui/qt/data'),
(home+'electroncash_plugins', 'electroncash_plugins'),
]
datas += collect_data_files('trezorlib')
datas += collect_data_files('btchip')
Expand All @@ -66,31 +66,29 @@ datas += collect_data_files('mnemonic') # wordlists used by keepkeylib from lib

# 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([home+'electron-cash',
home+'gui/qt/main_window.py',
home+'gui/qt/qrreader/camera_dialog.py',
home+'gui/text.py',
home+'lib/util.py',
home+'lib/wallet.py',
home+'lib/simple_config.py',
home+'lib/bitcoin.py',
home+'lib/dnssec.py',
home+'lib/commands.py',
home+'lib/tor/controller.py',
home+'plugins/cosigner_pool/qt.py',
home+'plugins/email_requests/qt.py',
home+'plugins/trezor/clientbase.py',
home+'plugins/trezor/trezor.py',
home+'plugins/trezor/qt.py',
home+'plugins/keepkey/qt.py',
home+'plugins/ledger/qt.py',
home+'plugins/satochip/qt.py', # Satochip
home+'plugins/fusion/fusion.py', # CashFusion
home+'plugins/fusion/qt.py', # CashFusion
#home+'packages/requests/utils.py'
home+'electroncash_gui/qt/main_window.py',
home+'electroncash_gui/qt/qrreader/camera_dialog.py',
home+'electroncash_gui/text.py',
home+'electroncash/util.py',
home+'electroncash/wallet.py',
home+'electroncash/simple_config.py',
home+'electroncash/bitcoin.py',
home+'electroncash/dnssec.py',
home+'electroncash/commands.py',
home+'electroncash/tor/controller.py',
home+'electroncash_plugins/cosigner_pool/qt.py',
home+'electroncash_plugins/email_requests/qt.py',
home+'electroncash_plugins/trezor/clientbase.py',
home+'electroncash_plugins/trezor/trezor.py',
home+'electroncash_plugins/trezor/qt.py',
home+'electroncash_plugins/keepkey/qt.py',
home+'electroncash_plugins/ledger/qt.py',
home+'electroncash_plugins/satochip/qt.py', # Satochip
home+'electroncash_plugins/fusion/fusion.py', # CashFusion
home+'electroncash_plugins/fusion/qt.py', # CashFusion
],
binaries=binaries,
datas=datas,
#pathex=[home+'lib', home+'gui', home+'plugins'],
hiddenimports=hiddenimports,
hookspath=[])

Expand Down
2 changes: 1 addition & 1 deletion contrib/gen_icons.sh
Expand Up @@ -34,4 +34,4 @@ for icon in $RASTERIZE ; do
done

echo "Generating icons.py"
pyrcc5 icons.qrc -o gui/qt/icons.py
pyrcc5 icons.qrc -o electroncash_gui/qt/icons.py
14 changes: 7 additions & 7 deletions contrib/make_locale
Expand Up @@ -17,11 +17,11 @@ os.chdir('..')

code_directories = [
'android/app/src/main/python',
'gui',
'electroncash_gui',
'ios/ElectronCash/electroncash_gui', # ios/ElectronCash could contain duplicate files
# copied by make_ios_project.sh.
'lib',
'plugins',
'electroncash',
'electroncash_plugins',
]
file_types = ('*.py', '*.kv')

Expand All @@ -41,13 +41,13 @@ with open("app.fil", "w") as f:
print("Found {} files to translate".format(n))

# Generate fresh translation template
if not os.path.exists('lib/locale'):
os.mkdir('lib/locale')
cmd = 'xgettext -s --from-code UTF-8 --language Python --no-wrap -f app.fil --keyword=pgettext:1c,2 --keyword=npgettext:1c,2,3 -c --output=lib/locale/messages.pot'
if not os.path.exists('electroncash/locale'):
os.mkdir('electroncash/locale')
cmd = 'xgettext -s --from-code UTF-8 --language Python --no-wrap -f app.fil --keyword=pgettext:1c,2 --keyword=npgettext:1c,2,3 -c --output=electroncash/locale/messages.pot'
print('Generate template')
os.system(cmd)

os.chdir('lib')
os.chdir('electroncash')

crowdin_identifier = 'electron-cash'
crowdin_file_name = 'files[electron-cash-client/messages.pot]'
Expand Down
4 changes: 2 additions & 2 deletions contrib/make_secp
Expand Up @@ -32,6 +32,6 @@ make -j$WORKER_COUNT || fail "Could not build $pkgname"
make install || fail "Could not install $pkgname"
. "$here/$pkgname/dist/lib/libsecp256k1.la"
host_strip "$here/$pkgname/dist/lib/$dlname"
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$here/../lib" || fail "Could not copy the $pkgname binary to its destination"
info "$dlname has been placed in the 'lib' folder."
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$here/../electroncash/." || fail "Could not copy the $pkgname binary to its destination"
info "$dlname has been placed in the 'electroncash' folder."
popd
6 changes: 3 additions & 3 deletions contrib/make_tor
Expand Up @@ -47,8 +47,8 @@ if [ "$BUILD_TYPE" = "wine" ] ; then
binary="tor.exe"
fi
host_strip "$here/$pkgname/dist/bin/$binary"
mkdir -p "$here/../lib/tor/bin"
cp -fpv "$here/$pkgname/dist/bin/$binary" "$here/../lib/tor/bin" || fail "Could not copy the $pkgname binary to its destination"
mkdir -p "$here/../electroncash/tor/bin"
cp -fpv "$here/$pkgname/dist/bin/$binary" "$here/../electroncash/tor/bin/." || fail "Could not copy the $pkgname binary to its destination"
$SHA256_PROG "$here/$pkgname/dist/bin/$binary"
info "$binary has been placed in the 'lib' folder."
info "$binary has been placed in the 'electroncash' folder."
popd
4 changes: 2 additions & 2 deletions contrib/make_zbar
Expand Up @@ -39,6 +39,6 @@ make -j$WORKER_COUNT || fail "Could not build $pkgname"
make install || fail "Could not install $pkgname"
. "$here/$pkgname/dist/lib/libzbar.la"
host_strip "$here/$pkgname/dist/lib/$dlname"
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$here/../lib" || fail "Could not copy the $pkgname binary to its destination"
info "$dlname has been placed in the 'lib' folder."
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$here/../electroncash/." || fail "Could not copy the $pkgname binary to its destination"
info "$dlname has been placed in the 'electroncash' folder."
popd
2 changes: 1 addition & 1 deletion contrib/osx/make_osx
Expand Up @@ -266,7 +266,7 @@ if ((DARWIN_VER >= 18 && FORCE_MOJAVE_DARK)); then
fi

# Sign the Tor binary separately
DoCodeSignMaybe "tor binary" "dist/${PACKAGE}.app/Contents/Resources/electroncash/tor/bin/tor" "$APP_SIGN"
DoCodeSignMaybe "tor binary" "dist/${PACKAGE}.app/Contents/MacOS/electroncash/tor/bin/tor" "$APP_SIGN"
# Finally, codesign the whole thing
DoCodeSignMaybe ".app bundle" "dist/${PACKAGE}.app" "$APP_SIGN"

Expand Down
58 changes: 29 additions & 29 deletions contrib/osx/osx.spec
Expand Up @@ -28,14 +28,14 @@ hiddenimports += collect_submodules('satochip') # Satochip
hiddenimports += collect_submodules('smartcard') # Satochip

datas = [
(home+'lib/currencies.json', PYPKG),
(home+'lib/servers.json', PYPKG),
(home+'lib/servers_testnet.json', PYPKG),
(home+'lib/servers_testnet4.json', PYPKG),
(home+'lib/servers_scalenet.json', PYPKG),
(home+'lib/wordlist/english.txt', PYPKG + '/wordlist'),
(home+'lib/locale', PYPKG + '/locale'),
(home+'plugins', PYPKG + '_plugins'),
(home+'electroncash/currencies.json', PYPKG),
(home+'electroncash/servers.json', PYPKG),
(home+'electroncash/servers_testnet.json', PYPKG),
(home+'electroncash/servers_testnet4.json', PYPKG),
(home+'electroncash/servers_scalenet.json', PYPKG),
(home+'electroncash/wordlist/english.txt', PYPKG + '/wordlist'),
(home+'electroncash/locale', PYPKG + '/locale'),
(home+'electroncash_plugins', PYPKG + '_plugins'),
]
datas += collect_data_files('trezorlib')
datas += collect_data_files('btchip')
Expand All @@ -50,33 +50,33 @@ binaries += [(home + "contrib/osx/libsecp256k1.0.dylib", ".")]
# LibZBar for QR code scanning
binaries += [(home + "contrib/osx/libzbar.0.dylib", ".")]
# Add Tor binary
binaries += [(home + "lib/tor/bin/tor", ".")]
binaries += [(home + "electroncash/tor/bin/tor", "electroncash/tor/bin")]

# 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([home+MAIN_SCRIPT,
home+'gui/qt/main_window.py',
home+'gui/qt/qrreader/camera_dialog.py',
home+'gui/text.py',
home+'lib/util.py',
home+'lib/wallet.py',
home+'lib/simple_config.py',
home+'lib/bitcoin.py',
home+'lib/dnssec.py',
home+'lib/commands.py',
home+'lib/tor/controller.py',
home+'plugins/cosigner_pool/qt.py',
home+'plugins/email_requests/qt.py',
home+'plugins/trezor/clientbase.py',
home+'plugins/trezor/trezor.py',
home+'plugins/trezor/qt.py',
home+'plugins/keepkey/qt.py',
home+'plugins/ledger/qt.py',
home+'plugins/satochip/qt.py', # Satochip
home+'plugins/fusion/fusion.py', # CashFusion
home+'plugins/fusion/qt.py', # CashFusion
home+'electroncash_gui/qt/main_window.py',
home+'electroncash_gui/qt/qrreader/camera_dialog.py',
home+'electroncash_gui/text.py',
home+'electroncash/util.py',
home+'electroncash/wallet.py',
home+'electroncash/simple_config.py',
home+'electroncash/bitcoin.py',
home+'electroncash/dnssec.py',
home+'electroncash/commands.py',
home+'electroncash/tor/controller.py',
home+'electroncash_plugins/cosigner_pool/qt.py',
home+'electroncash_plugins/email_requests/qt.py',
home+'electroncash_plugins/trezor/clientbase.py',
home+'electroncash_plugins/trezor/trezor.py',
home+'electroncash_plugins/trezor/qt.py',
home+'electroncash_plugins/keepkey/qt.py',
home+'electroncash_plugins/ledger/qt.py',
home+'electroncash_plugins/satochip/qt.py', # Satochip
home+'electroncash_plugins/fusion/fusion.py', # CashFusion
home+'electroncash_plugins/fusion/qt.py', # CashFusion
],
binaries=binaries,
datas=datas,
Expand Down

0 comments on commit 9a0ba25

Please sign in to comment.