Browse Source

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

3.2.x
ghost43 6 years ago
committed by GitHub
parent
commit
c99007bda7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      setup.py

30
setup.py

@ -2,12 +2,15 @@
# python setup.py sdist --format=zip,gztar # python setup.py sdist --format=zip,gztar
from setuptools import setup, find_packages
import os import os
import sys import sys
import platform import platform
import imp import imp
import argparse import argparse
import subprocess
from setuptools import setup, find_packages
from setuptools.command.install import install
with open('contrib/requirements/requirements.txt') as f: with open('contrib/requirements/requirements.txt') as f:
requirements = f.read().splitlines() requirements = f.read().splitlines()
@ -43,8 +46,26 @@ if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']:
extras_require = { extras_require = {
'hardware': requirements_hw, 'hardware': requirements_hw,
'fast': ['pycryptodomex'], '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( setup(
@ -75,5 +96,8 @@ setup(
author_email="thomasv@electrum.org", author_email="thomasv@electrum.org",
license="MIT Licence", license="MIT Licence",
url="https://electrum.org", url="https://electrum.org",
long_description="""Lightweight Bitcoin Wallet""" long_description="""Lightweight Bitcoin Wallet""",
cmdclass={
'install': CustomInstallCommand,
},
) )

Loading…
Cancel
Save