electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

setup.py (3416B)


      1 #!/usr/bin/env python3
      2 
      3 # python setup.py sdist --format=zip,gztar
      4 
      5 import os
      6 import sys
      7 import platform
      8 import importlib.util
      9 import argparse
     10 import subprocess
     11 
     12 from setuptools import setup, find_packages
     13 from setuptools.command.install import install
     14 
     15 MIN_PYTHON_VERSION = "3.6.1"
     16 _min_python_version_tuple = tuple(map(int, (MIN_PYTHON_VERSION.split("."))))
     17 
     18 
     19 if sys.version_info[:3] < _min_python_version_tuple:
     20     sys.exit("Error: Electrum requires Python version >= %s..." % MIN_PYTHON_VERSION)
     21 
     22 with open('contrib/requirements/requirements.txt') as f:
     23     requirements = f.read().splitlines()
     24 
     25 with open('contrib/requirements/requirements-hw.txt') as f:
     26     requirements_hw = f.read().splitlines()
     27 
     28 # load version.py; needlessly complicated alternative to "imp.load_source":
     29 version_spec = importlib.util.spec_from_file_location('version', 'electrum/version.py')
     30 version_module = version = importlib.util.module_from_spec(version_spec)
     31 version_spec.loader.exec_module(version_module)
     32 
     33 data_files = []
     34 
     35 if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']:
     36     parser = argparse.ArgumentParser()
     37     parser.add_argument('--root=', dest='root_path', metavar='dir', default='/')
     38     opts, _ = parser.parse_known_args(sys.argv[1:])
     39     usr_share = os.path.join(sys.prefix, "share")
     40     icons_dirname = 'pixmaps'
     41     if not os.access(opts.root_path + usr_share, os.W_OK) and \
     42        not os.access(opts.root_path, os.W_OK):
     43         icons_dirname = 'icons'
     44         if 'XDG_DATA_HOME' in os.environ.keys():
     45             usr_share = os.environ['XDG_DATA_HOME']
     46         else:
     47             usr_share = os.path.expanduser('~/.local/share')
     48     data_files += [
     49         (os.path.join(usr_share, 'applications/'), ['electrum.desktop']),
     50         (os.path.join(usr_share, icons_dirname), ['electrum/gui/icons/electrum.png']),
     51     ]
     52 
     53 extras_require = {
     54     'hardware': requirements_hw,
     55     'gui': ['pyqt5'],
     56     'crypto': ['cryptography>=2.6'],
     57     'tests': ['pycryptodomex>=3.7', 'cryptography>=2.6', 'pyaes>=0.1a1'],
     58 }
     59 # 'full' extra that tries to grab everything an enduser would need (except for libsecp256k1...)
     60 extras_require['full'] = [pkg for sublist in
     61                           (extras_require['hardware'], extras_require['gui'], extras_require['crypto'])
     62                           for pkg in sublist]
     63 # legacy. keep 'fast' extra working
     64 extras_require['fast'] = extras_require['crypto']
     65 
     66 
     67 setup(
     68     name="Electrum",
     69     version=version.ELECTRUM_VERSION,
     70     python_requires='>={}'.format(MIN_PYTHON_VERSION),
     71     install_requires=requirements,
     72     extras_require=extras_require,
     73     packages=[
     74         'electrum',
     75         'electrum.gui',
     76         'electrum.gui.qt',
     77         'electrum.plugins',
     78     ] + [('electrum.plugins.'+pkg) for pkg in find_packages('electrum/plugins')],
     79     package_dir={
     80         'electrum': 'electrum'
     81     },
     82     package_data={
     83         '': ['*.txt', '*.json', '*.ttf', '*.otf', '*.csv'],
     84         'electrum': [
     85             'wordlist/*.txt',
     86             'locale/*/LC_MESSAGES/electrum.mo',
     87             'lnwire/*.csv',
     88         ],
     89         'electrum.gui': [
     90             'icons/*',
     91         ],
     92     },
     93     scripts=['electrum/electrum'],
     94     data_files=data_files,
     95     description="Lightweight Bitcoin Wallet",
     96     author="Thomas Voegtlin",
     97     author_email="thomasv@electrum.org",
     98     license="MIT Licence",
     99     url="https://electrum.org",
    100     long_description="""Lightweight Bitcoin Wallet""",
    101 )