electrum

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

commit c99007bda73cfe88f2a054f51df7cb607135c1c8
parent 1b19cdd0f44ed5b65b30631f21db769fe5aaeefb
Author: ghost43 <somber.night@protonmail.com>
Date:   Thu, 30 Aug 2018 16:16:14 +0200

setup.py: add 'gui' extra. potentially build Qt icons files (#4647)


Diffstat:
Msetup.py | 30+++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py @@ -2,12 +2,15 @@ # python setup.py sdist --format=zip,gztar -from setuptools import setup, find_packages import os import sys import platform import imp import argparse +import subprocess + +from setuptools import setup, find_packages +from setuptools.command.install import install with open('contrib/requirements/requirements.txt') as f: requirements = f.read().splitlines() @@ -43,8 +46,26 @@ if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']: extras_require = { 'hardware': requirements_hw, 'fast': ['pycryptodomex'], + 'gui': ['pyqt5'], } -extras_require['full'] = extras_require['hardware'] + extras_require['fast'] +extras_require['full'] = [pkg for sublist in list(extras_require.values()) for pkg in sublist] + + +class CustomInstallCommand(install): + def run(self): + install.run(self) + # potentially build Qt icons file + try: + import PyQt5 + except ImportError: + pass + else: + try: + path = os.path.join(self.install_lib, "electrum/gui/qt/icons_rc.py") + if not os.path.exists(path): + subprocess.call(["pyrcc5", "icons.qrc", "-o", path]) + except Exception as e: + print('Warning: building icons file failed with {}'.format(e)) setup( @@ -75,5 +96,8 @@ setup( author_email="thomasv@electrum.org", license="MIT Licence", url="https://electrum.org", - long_description="""Lightweight Bitcoin Wallet""" + long_description="""Lightweight Bitcoin Wallet""", + cmdclass={ + 'install': CustomInstallCommand, + }, )