Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13711544
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
16 KB
Subscribers
None
View Options
diff --git a/electrum/CONTRIBUTING.md b/electrum/CONTRIBUTING.md
index 0dd0b645b..8364ccee1 100644
--- a/electrum/CONTRIBUTING.md
+++ b/electrum/CONTRIBUTING.md
@@ -1,199 +1,199 @@
# Contributing to Electrum ABC
## Main repository
The Electrum ABC source repository has been merged into the Bitcoin ABC repository,
and the development is now taking place at [reviews.bitcoinabc.org](https://reviews.bitcoinabc.org/).
Please read the main [CONTRIBUTING.md](https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/CONTRIBUTING.md)
document to familiarize yourself with the development philosophy and find out how to
set up the Bitcoin ABC repository.
The original Electrum ABC github repository is maintained as a mirror of the `electrum/`
directory in the main repository.
The rest of this document provides instructions that are specific to Electrum ABC.
## Contacting developers
[Join the Electrum ABC telegram group](https://t.me/ElectrumABC) to get in contact
with developers or to get help from the community.
## Installing dependencies
All commands in this document assume that your current working directory is the
`electrum/` directory that resides at the root of the Bitcoin ABC repository.
### Python
Python 3.9 or above is required to run Electrum ABC.
-If your system lacks Python 3.7+, you can use `pyenv` to install newer versions, or
-install an [alternative python distribution](https://www.python.org/download/alternatives/)
+If your system lacks a recent enough Python version, you can use `pyenv` to install
+newer versions, or install an [alternative python distribution](https://www.python.org/download/alternatives/)
in addition to your system's version.
### Python packages
The simplest way to install all needed packages is to run the following command:
```shell
pip install .[all]
```
This will install Electrum ABC and all its dependencies as a python package and application.
This is equivalent to:
```shell
pip install .
pip install .[gui]
pip install .[hardware]
```
If you do not want to install Electrum ABC as a package, you can install only the dependencies
using the following commands:
```shell
pip3 install -r contrib/requirements/requirements.txt
pip3 install -r contrib/requirements/requirements-binaries.txt
pip3 install -r contrib/requirements/requirements-hw.txt
```
## Running Electrum ABC from source
If you installed the application as a python package, you can run it from anywhere
using `electrum-abc` (assuming that your system has the python script directory in
its PATH).
If you installed all dependencies, you can also start the application by invoking
the `./electrum-abc` script. See the following sections for additional instructions
and optional dependencies.
### Running from source on old Linux
If your Linux distribution has a version of python 3 lower than the minimum required
version, it is recommended to do a user dir install with
[pyenv](https://github.com/pyenv/pyenv-installer). This allows Electrum ABC
to run completely independently of your system configuration.
1. Install `pyenv` in your user
account. Follow the printed instructions about updating your environment
variables and `.bashrc`, and restart your shell to ensure that they are
loaded.
2. Run `pyenv install 3.9.7`. This will download and compile that version of
python, storing it under `.pyenv` in your home directory.
3. `cd` into the Electrum ABC directory. Run `pyenv local 3.9.7` which inserts
a file `.python-version` into the current directory.
4. [Install Electrum ABC requirements](#python-packages)
5. [Compile libsecp256k1](#compiling-libsecp256k1)
### Running from source on macOS
You need to install **either** [MacPorts](https://www.macports.org) **or**
[HomeBrew](https://www.brew.sh). Follow the instructions on either site for
installing (Xcode from [Apple's developer site](https://developer.apple.com)
is required for either).
1. After installing either HomeBrew or MacPorts, clone this repository and
switch to the directory:
`git clone https://github.com/Bitcoin-ABC/ElectrumABC && cd ElectrumABC`
2. Install python 3+. For brew:
`brew install python3`
3. Install PyQt5: `python3 -m pip install --user pyqt5`
4. [Install Electrum ABC requirements](#python-packages)
5. [Compile libsecp256k1](#compiling-libsecp256k1)
## Running tests
Running unit tests:
```shell
python3 test_runner.py
```
This can also be run as a `ninja` target in the context of a Bitcoin ABC build:
```shell
ninja check-electrum
```
Functional tests can be run with the following command:
```shell
pytest electrumabc/tests/regtest
```
This requires `docker` and additional python dependencies:
```shell
pip3 install -r contrib/requirements/requirements-regtest.txt
```
## Compiling libsecp256k1
Compiling libsecp256k1 is highly-recommended when running from source, to use fast
cryptographic algorithms instead of using fallback pure-python algos.
It is required when using CashFusion, as slow participants can cause a fusion round
to fail.
On Debian or Ubuntu linux:
```shell
sudo apt-get install libtool automake
./contrib/make_secp
```
On MacOS:
```shell
brew install coreutils automake
./contrib/make_secp
```
or if using MacPorts: `sudo port install coreutils automake`
## Compiling the icons file for Qt
If you change or add any icons to the `icons` subdirectory, you need to run the following
script before you can use them in the application:
```shell
contrib/gen_icons.sh
```
This requires the `pyrcc5` command which can be installed using your package manager.
For instance for Ubuntu or Debian, run:
```
sudo apt-get install pyqt5-dev-tools
```
## Creating translations
<!-- FIXME: we are still relying on Electron Cash translations-->
```shell
sudo apt-get install python-requests gettext
./contrib/make_locale
```
## Plugin development
For plugin development, see the [plugin documentation](electrumabc_plugins/README.md).
## Creating Binaries
See the *Building the release files* section in [contrib/release.md](contrib/release.md)
## Backporting
Electrum or Electron Cash features, refactoring commits or bug fixes can be
backported into Electrum ABC.
To do this, first add the remote repositories:
```shell
git remote add electrum https://github.com/spesmilo/electrum.git
git remote add electroncash https://github.com/Electron-Cash/Electron-Cash.git
```
Then fetch the remote git history:
```shell
git fetch electrum
git fetch electroncash
```
This step must be repeated every time you want to backport a commit that is more
recent than the last time you fetched the history.
Then you can cherry-pick the relevant commits:
```shell
git cherry-pick -Xsubtree=electrum <commit hash>
```
diff --git a/electrum/setup.py b/electrum/setup.py
index 97694d18a..498e6fc9d 100644
--- a/electrum/setup.py
+++ b/electrum/setup.py
@@ -1,251 +1,245 @@
# -*- coding: utf-8 -*-
# python setup.py sdist --format=zip,gztar
import argparse
import importlib.util
import os
import platform
import sys
import setuptools.command.sdist
from setuptools import setup
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(os.path.join(REQUIREMENTS_DIR, "requirements.txt"), encoding="utf-8") as f:
requirements = f.read().splitlines()
with open(os.path.join(REQUIREMENTS_DIR, "requirements-hw.txt"), encoding="utf-8") as f:
requirements_hw = f.read().splitlines()
with open(
os.path.join(REQUIREMENTS_DIR, "requirements-binaries.txt"), encoding="utf-8"
) as f:
requirements_binaries = f.read().splitlines()
def load_module(module_path):
"""Import a module without importing the whole package"""
# [:-3] assumes a .py extension
module_name = os.path.basename(module_path)[:-3]
spec = importlib.util.spec_from_file_location(module_name, module_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
version = load_module(os.path.join(ELECTRUM_ROOT, "electrumabc", "version.py"))
constants = load_module(os.path.join(ELECTRUM_ROOT, "electrumabc", "constants.py"))
-if sys.version_info[:3] < (3, 7):
- sys.exit(f"Error: {constants.PROJECT_NAME} requires Python version >= 3.7...")
-
data_files = []
if platform.system() in ["Linux", "FreeBSD", "DragonFly"]:
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument("--user", dest="is_user", action="store_true")
parser.add_argument("--system", dest="is_user", action="store_false", default=False)
parser.add_argument("--root=", dest="root_path", metavar="dir", default="/")
parser.add_argument(
"--prefix=",
dest="prefix_path",
metavar="prefix",
nargs="?",
const="/",
default=sys.prefix,
)
opts, _ = parser.parse_known_args(sys.argv[1:])
# Use per-user */share directory if the global one is not writable or if a per-user installation
# is attempted
user_share = os.environ.get("XDG_DATA_HOME", os.path.expanduser("~/.local/share"))
system_share = os.path.join(opts.prefix_path, "share")
if not opts.is_user:
# Not neccarily a per-user installation try system directories
if os.access(opts.root_path + system_share, os.W_OK):
# Global /usr/share is writable for us so just use that
share_dir = system_share
elif not os.path.exists(opts.root_path + system_share) and os.access(
opts.root_path, os.W_OK
):
# Global /usr/share does not exist, but / is writable keep using the global directory
# (happens during packaging)
share_dir = system_share
else:
# Neither /usr/share (nor / if /usr/share doesn't exist) is writable, use the
# per-user */share directory
share_dir = user_share
else:
# Per-user installation
share_dir = user_share
data_files += [
# Menu icon
(
os.path.join(share_dir, "icons/hicolor/256x256/apps/"),
["icons/electrumABC.png"],
),
(os.path.join(share_dir, "pixmaps/"), ["icons/electrumABC.png"]),
(
os.path.join(share_dir, "icons/hicolor/scaleable/apps/"),
["icons/electrumABC.svg"],
),
# Menu entry
(os.path.join(share_dir, "applications/"), ["electrum-abc.desktop"]),
# App stream (store) metadata
(
os.path.join(share_dir, "metainfo/"),
["org.bitcoinabc.Electrum-ABC.appdata.xml"],
),
]
class MakeAllBeforeSdist(setuptools.command.sdist.sdist):
"""Does some custom stuff before calling super().run()."""
user_options = setuptools.command.sdist.sdist.user_options + [
("disable-secp", None, "Disable libsecp256k1 complilation (default)."),
("enable-secp", None, "Enable libsecp256k1 complilation."),
("disable-zbar", None, "Disable libzbar complilation (default)."),
("enable-zbar", None, "Enable libzbar complilation."),
]
def initialize_options(self):
self.disable_secp = None
self.enable_secp = None
self.disable_zbar = None
self.enable_zbar = None
super().initialize_options()
def finalize_options(self):
if self.enable_secp is None:
self.enable_secp = False
self.enable_secp = not self.disable_secp and self.enable_secp
if self.enable_zbar is None:
self.enable_zbar = False
self.enable_zbar = not self.disable_zbar and self.enable_zbar
super().finalize_options()
def run(self):
"""Run command."""
# self.announce("Running make_locale...")
# 0==os.system("contrib/make_locale") or sys.exit("Could not make locale, aborting")
# self.announce("Running make_packages...")
# 0==os.system("contrib/make_packages") or sys.exit("Could not make locale, aborting")
if self.enable_secp:
self.announce("Running make_secp...")
0 == os.system("contrib/make_secp") or sys.exit(
"Could not build libsecp256k1"
)
if self.enable_zbar:
self.announce("Running make_zbar...")
0 == os.system("contrib/make_zbar") or sys.exit("Could not build libzbar")
super().run()
platform_package_data = {}
if sys.platform in ("linux",):
platform_package_data = {
"electrumabc_gui.qt": ["data/ecsupplemental_lnx.ttf", "data/fonts.xml"],
}
if sys.platform in ("win32", "cygwin"):
platform_package_data = {
"electrumabc_gui.qt": ["data/ecsupplemental_win.ttf"],
}
setup(
cmdclass={
"sdist": MakeAllBeforeSdist,
},
name=constants.PROJECT_NAME_NO_SPACES,
version=version.PACKAGE_VERSION,
install_requires=requirements,
extras_require={
"hardware": requirements_hw,
"gui": requirements_binaries,
"all": requirements_hw + requirements_binaries,
},
+ python_requires=">=3.9",
packages=[
"electrumabc",
"electrumabc.avalanche",
"electrumabc.qrreaders",
"electrumabc.slp",
"electrumabc.tor",
"electrumabc.utils",
"electrumabc_gui",
"electrumabc_gui.qt",
"electrumabc_gui.qt.avalanche",
"electrumabc_gui.qt.qrreader",
"electrumabc_gui.qt.utils",
"electrumabc_gui.qt.utils.darkdetect",
"electrumabc_plugins",
"electrumabc_plugins.audio_modem",
"electrumabc_plugins.cosigner_pool",
"electrumabc_plugins.email_requests",
"electrumabc_plugins.hw_wallet",
"electrumabc_plugins.keepkey",
"electrumabc_plugins.ledger",
"electrumabc_plugins.trezor",
"electrumabc_plugins.digitalbitbox",
"electrumabc_plugins.virtualkeyboard",
"electrumabc_plugins.satochip",
"electrumabc_plugins.fusion",
],
package_data={
"electrumabc": [
"checkpoint.json",
"checkpoint_testnet.json",
"servers.json",
"servers_testnet.json",
"servers_regtest.json",
"currencies.json",
"www/index.html",
"wordlist/*.txt",
"libsecp256k1*",
"libzbar*",
"locale/*/LC_MESSAGES/electron-cash.mo",
],
"electrumabc_plugins.fusion": ["*.svg", "*.png"],
# On Linux and Windows this means adding electrumabc_gui/qt/data/*.ttf
# On Darwin we don't use that font, so we don't add it to save space.
**platform_package_data,
},
classifiers=[
# Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable"
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Environment :: MacOS X",
"Environment :: Win32 (MS Windows)",
"Environment :: X11 Applications :: Qt",
"Intended Audience :: End Users/Desktop",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
- "Programming Language :: Python :: 3.7",
- "Programming Language :: Python :: 3.8",
- "Programming Language :: Python :: 3.9",
- "Programming Language :: Python :: 3.10",
- "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3",
"Topic :: Security :: Cryptography",
"Topic :: Office/Business :: Financial",
],
scripts=[constants.SCRIPT_NAME],
data_files=data_files,
description="Lightweight eCash Wallet",
author=f"The {constants.PROJECT_NAME} Developers",
# author_email=
license="MIT Licence",
url=constants.REPOSITORY_URL,
long_description=long_description,
)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Apr 27, 12:40 (14 h, 28 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573573
Default Alt Text
(16 KB)
Attached To
rABC Bitcoin ABC
Event Timeline
Log In to Comment