2017-02-28 14:51:49 +01:00
|
|
|
#!/usr/bin/env python2.7
|
|
|
|
|
2017-02-24 16:49:53 +01:00
|
|
|
import os
|
2020-04-30 21:05:11 +02:00
|
|
|
import platform
|
2017-03-24 12:51:46 +01:00
|
|
|
import shutil
|
2020-02-20 13:14:25 +01:00
|
|
|
import sys
|
2018-05-18 16:56:47 +02:00
|
|
|
|
2021-08-27 15:23:59 +02:00
|
|
|
from importlib import import_module
|
2017-09-21 13:43:01 +02:00
|
|
|
from setuptools import setup, Extension
|
|
|
|
from setuptools.command.install import install
|
2017-02-24 16:49:53 +01:00
|
|
|
|
|
|
|
from src.version import softwareVersion
|
|
|
|
|
2018-05-18 16:56:47 +02:00
|
|
|
|
|
|
|
EXTRAS_REQUIRE = {
|
2024-02-28 17:05:05 +01:00
|
|
|
'docs': ['sphinx'],
|
2018-05-18 16:56:47 +02:00
|
|
|
'gir': ['pygobject'],
|
2018-10-25 23:19:07 +02:00
|
|
|
'json': ['jsonrpclib'],
|
2018-05-18 16:56:47 +02:00
|
|
|
'notify2': ['notify2'],
|
2018-04-20 09:17:58 +02:00
|
|
|
'opencl': ['pyopencl', 'numpy'],
|
2018-05-18 16:56:47 +02:00
|
|
|
'prctl': ['python_prctl'], # Named threads
|
|
|
|
'qrcode': ['qrcode'],
|
2018-05-26 14:43:21 +02:00
|
|
|
'sound;platform_system=="Windows"': ['winsound'],
|
2019-07-23 17:57:19 +02:00
|
|
|
'tor': ['stem'],
|
2019-05-06 17:30:21 +02:00
|
|
|
'xdg': ['pyxdg'],
|
|
|
|
'xml': ['defusedxml']
|
2018-05-18 16:56:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-25 10:48:45 +01:00
|
|
|
class InstallCmd(install):
|
2021-08-27 15:23:59 +02:00
|
|
|
"""Custom setuptools install command preparing icons"""
|
2021-08-20 18:34:28 +02:00
|
|
|
|
2017-03-25 10:48:45 +01:00
|
|
|
def run(self):
|
2017-03-24 12:51:46 +01:00
|
|
|
# prepare icons directories
|
2017-09-21 19:57:34 +02:00
|
|
|
try:
|
|
|
|
os.makedirs('desktop/icons/scalable')
|
|
|
|
except os.error:
|
|
|
|
pass
|
2017-03-24 12:51:46 +01:00
|
|
|
shutil.copyfile(
|
|
|
|
'desktop/can-icon.svg', 'desktop/icons/scalable/pybitmessage.svg')
|
2017-09-21 19:57:34 +02:00
|
|
|
try:
|
|
|
|
os.makedirs('desktop/icons/24x24')
|
|
|
|
except os.error:
|
|
|
|
pass
|
2017-03-24 12:51:46 +01:00
|
|
|
shutil.copyfile(
|
|
|
|
'desktop/icon24.png', 'desktop/icons/24x24/pybitmessage.png')
|
|
|
|
|
2017-03-25 10:48:45 +01:00
|
|
|
return install.run(self)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2017-02-24 16:49:53 +01:00
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
with open(os.path.join(here, 'README.md')) as f:
|
|
|
|
README = f.read()
|
|
|
|
|
2018-04-20 09:17:58 +02:00
|
|
|
with open(os.path.join(here, 'requirements.txt'), 'r') as f:
|
|
|
|
requirements = list(f.readlines())
|
|
|
|
|
2017-02-28 14:51:49 +01:00
|
|
|
bitmsghash = Extension(
|
|
|
|
'pybitmessage.bitmsghash.bitmsghash',
|
|
|
|
sources=['src/bitmsghash/bitmsghash.cpp'],
|
|
|
|
libraries=['pthread', 'crypto'],
|
2017-02-24 16:49:53 +01:00
|
|
|
)
|
|
|
|
|
2020-11-06 10:58:36 +01:00
|
|
|
installRequires = ['six']
|
2017-06-12 12:54:44 +02:00
|
|
|
packages = [
|
|
|
|
'pybitmessage',
|
|
|
|
'pybitmessage.bitmessageqt',
|
|
|
|
'pybitmessage.bitmessagecurses',
|
2019-04-22 12:38:39 +02:00
|
|
|
'pybitmessage.fallback',
|
2017-06-12 12:54:44 +02:00
|
|
|
'pybitmessage.messagetypes',
|
|
|
|
'pybitmessage.network',
|
2019-04-22 12:38:39 +02:00
|
|
|
'pybitmessage.plugins',
|
2017-06-12 12:54:44 +02:00
|
|
|
'pybitmessage.pyelliptic',
|
2022-08-24 13:24:48 +02:00
|
|
|
'pybitmessage.storage'
|
2017-06-12 12:54:44 +02:00
|
|
|
]
|
2022-10-10 15:53:43 +02:00
|
|
|
package_data = {'': [
|
|
|
|
'bitmessageqt/*.ui', 'bitmsghash/*.cl', 'sslkeys/*.pem',
|
|
|
|
'translations/*.ts', 'translations/*.qm', 'default.ini', 'sql/*.sql',
|
|
|
|
'images/*.png', 'images/*.ico', 'images/*.icns',
|
|
|
|
'bitmessagekivy/main.kv', 'bitmessagekivy/screens_data.json',
|
2022-12-01 15:57:07 +01:00
|
|
|
'bitmessagekivy/kv/*.kv', 'images/kivy/payment/*.png', 'images/kivy/*.gif',
|
|
|
|
'images/kivy/text_images*.png'
|
2022-10-10 15:53:43 +02:00
|
|
|
]}
|
2017-09-21 13:43:01 +02:00
|
|
|
|
2021-06-11 19:14:57 +02:00
|
|
|
if sys.version_info[0] == 3:
|
2022-08-31 09:07:54 +02:00
|
|
|
packages.extend(
|
|
|
|
[
|
|
|
|
'pybitmessage.bitmessagekivy',
|
|
|
|
'pybitmessage.bitmessagekivy.baseclass'
|
|
|
|
]
|
|
|
|
)
|
2021-06-11 19:14:57 +02:00
|
|
|
|
2022-08-30 14:55:01 +02:00
|
|
|
if os.environ.get('INSTALL_TESTS', False):
|
2024-03-22 09:52:02 +01:00
|
|
|
packages.extend(['pybitmessage.mockbm', 'pybitmessage.backend', 'pybitmessage.bitmessagekivy.tests'])
|
2022-10-10 15:53:43 +02:00
|
|
|
package_data[''].extend(['bitmessagekivy/tests/sampleData/*.dat'])
|
2022-08-30 14:55:01 +02:00
|
|
|
|
2017-06-12 12:54:44 +02:00
|
|
|
# this will silently accept alternative providers of msgpack
|
|
|
|
# if they are already installed
|
2017-03-17 19:25:19 +01:00
|
|
|
|
2017-03-01 11:29:38 +01:00
|
|
|
try:
|
2017-09-21 13:43:01 +02:00
|
|
|
import msgpack
|
2019-04-19 16:06:55 +02:00
|
|
|
installRequires.append(
|
2021-06-10 15:41:44 +02:00
|
|
|
"msgpack-python" if msgpack.version[:2] < (0, 6) else "msgpack")
|
2017-09-21 13:43:01 +02:00
|
|
|
except ImportError:
|
|
|
|
try:
|
2021-08-27 15:23:59 +02:00
|
|
|
import_module('umsgpack')
|
2017-09-21 13:43:01 +02:00
|
|
|
installRequires.append("umsgpack")
|
|
|
|
except ImportError:
|
2019-04-22 12:38:39 +02:00
|
|
|
packages += ['pybitmessage.fallback.umsgpack']
|
2017-09-21 13:43:01 +02:00
|
|
|
|
2020-04-30 21:05:11 +02:00
|
|
|
data_files = [
|
|
|
|
('share/applications/',
|
|
|
|
['desktop/pybitmessage.desktop']),
|
|
|
|
('share/icons/hicolor/scalable/apps/',
|
|
|
|
['desktop/icons/scalable/pybitmessage.svg']),
|
|
|
|
('share/icons/hicolor/24x24/apps/',
|
|
|
|
['desktop/icons/24x24/pybitmessage.png'])
|
|
|
|
]
|
|
|
|
|
2021-02-06 21:59:57 +01:00
|
|
|
try:
|
|
|
|
if platform.dist()[0] in ('Debian', 'Ubuntu'):
|
|
|
|
data_files += [
|
|
|
|
("etc/apparmor.d/",
|
|
|
|
['packages/apparmor/pybitmessage'])
|
|
|
|
]
|
|
|
|
except AttributeError:
|
|
|
|
pass # FIXME: use distro for more recent python
|
2020-04-30 21:05:11 +02:00
|
|
|
|
2017-09-21 13:43:01 +02:00
|
|
|
dist = setup(
|
|
|
|
name='pybitmessage',
|
|
|
|
version=softwareVersion,
|
|
|
|
description="Reference client for Bitmessage: "
|
|
|
|
"a P2P communications protocol",
|
|
|
|
long_description=README,
|
|
|
|
license='MIT',
|
|
|
|
# TODO: add author info
|
|
|
|
url='https://bitmessage.org',
|
|
|
|
# TODO: add keywords
|
|
|
|
install_requires=installRequires,
|
2018-04-20 09:17:58 +02:00
|
|
|
tests_require=requirements,
|
2021-02-06 20:07:42 +01:00
|
|
|
test_suite='tests.unittest_discover',
|
2018-05-18 16:56:47 +02:00
|
|
|
extras_require=EXTRAS_REQUIRE,
|
2017-09-21 13:43:01 +02:00
|
|
|
classifiers=[
|
|
|
|
"License :: OSI Approved :: MIT License"
|
|
|
|
"Operating System :: OS Independent",
|
|
|
|
"Programming Language :: Python :: 2.7 :: Only",
|
|
|
|
"Topic :: Internet",
|
|
|
|
"Topic :: Security :: Cryptography",
|
|
|
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
|
|
],
|
|
|
|
package_dir={'pybitmessage': 'src'},
|
|
|
|
packages=packages,
|
2022-10-10 15:53:43 +02:00
|
|
|
package_data=package_data,
|
2020-04-30 21:05:11 +02:00
|
|
|
data_files=data_files,
|
2017-09-21 13:43:01 +02:00
|
|
|
ext_modules=[bitmsghash],
|
|
|
|
zip_safe=False,
|
|
|
|
entry_points={
|
|
|
|
'bitmessage.gui.menu': [
|
2017-03-07 14:44:48 +01:00
|
|
|
'address.qrcode = pybitmessage.plugins.menu_qrcode [qrcode]'
|
2017-03-01 11:29:38 +01:00
|
|
|
],
|
2017-09-21 13:43:01 +02:00
|
|
|
'bitmessage.notification.message': [
|
|
|
|
'notify2 = pybitmessage.plugins.notification_notify2'
|
|
|
|
'[gir, notify2]'
|
2017-03-24 12:51:46 +01:00
|
|
|
],
|
2017-09-21 13:43:01 +02:00
|
|
|
'bitmessage.notification.sound': [
|
|
|
|
'theme.canberra = pybitmessage.plugins.sound_canberra',
|
|
|
|
'file.gstreamer = pybitmessage.plugins.sound_gstreamer'
|
|
|
|
'[gir]',
|
|
|
|
'file.fallback = pybitmessage.plugins.sound_playfile'
|
|
|
|
'[sound]'
|
|
|
|
],
|
|
|
|
'bitmessage.indicator': [
|
|
|
|
'libmessaging ='
|
|
|
|
'pybitmessage.plugins.indicator_libmessaging [gir]'
|
|
|
|
],
|
2019-05-06 17:30:21 +02:00
|
|
|
'bitmessage.desktop': [
|
|
|
|
'freedesktop = pybitmessage.plugins.desktop_xdg [xdg]'
|
|
|
|
],
|
2019-07-23 17:57:19 +02:00
|
|
|
'bitmessage.proxyconfig': [
|
|
|
|
'stem = pybitmessage.plugins.proxyconfig_stem [tor]'
|
|
|
|
],
|
2020-02-20 13:14:25 +01:00
|
|
|
'console_scripts': [
|
|
|
|
'pybitmessage = pybitmessage.bitmessagemain:main'
|
|
|
|
] if sys.platform[:3] == 'win' else []
|
2017-09-21 13:43:01 +02:00
|
|
|
},
|
|
|
|
scripts=['src/pybitmessage'],
|
2019-10-11 17:50:35 +02:00
|
|
|
cmdclass={'install': InstallCmd},
|
|
|
|
command_options={
|
|
|
|
'build_sphinx': {
|
|
|
|
'source_dir': ('setup.py', 'docs')}
|
|
|
|
}
|
2017-09-21 13:43:01 +02:00
|
|
|
)
|