Skip to content

Commit

Permalink
setup.py: add 'gui' extra. potentially build Qt icons files (spesmilo…
Browse files Browse the repository at this point in the history
  • Loading branch information
zebra-lucky committed Sep 3, 2018
1 parent ca8580d commit d9ad2b4
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -43,8 +46,26 @@
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_dash/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(
Expand Down Expand Up @@ -74,5 +95,8 @@
maintainer_email="[email protected]",
license="MIT License",
url="https://electrum.dash.org",
long_description="""Lightweight Dashpay Wallet"""
long_description="""Lightweight Dashpay Wallet""",
cmdclass={
'install': CustomInstallCommand,
},
)

0 comments on commit d9ad2b4

Please sign in to comment.