-
Notifications
You must be signed in to change notification settings - Fork 115
/
setup.py
executable file
·141 lines (116 loc) · 4.61 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2013, 2014, 2015, 2016, 2019 Kevin Reid and the ShinySDR contributors
#
# This file is part of ShinySDR.
#
# ShinySDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ShinySDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ShinySDR. If not, see <http://www.gnu.org/licenses/>.
import os.path
import subprocess
import urllib
from setuptools import find_packages, setup, Command
from setuptools.command.build_py import build_py
ASSETS = {
'http://requirejs.org/docs/release/2.1.22/comments/require.js': 'shinysdr/deps/require.js',
'https://raw.githubusercontent.com/requirejs/text/646db27aaf2236cea92ac4107f32cbe5ae7a8d3a/text.js': 'shinysdr/deps/text.js'
}
class DownloadAssets(Command):
description = 'Download web app assets from external sites.'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
for source_url, destination_path in ASSETS.items():
if os.path.exists(destination_path):
print('skipping downloading {}, already exists'.format(destination_path))
else:
print('downloading {} to {}'.format(source_url, destination_path))
urllib.urlretrieve(source_url, destination_path)
class InitGitSubModules(Command):
description = 'Initialize Git submodules for dependencies.'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print('Initializing submodules...')
subprocess.call(['git', 'submodule', 'update', '--init'])
class FetchDeps(Command):
"""fetch dependencies command"""
description = 'gathers external dependencies from various sources'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
self.run_command('git_init')
self.run_command('retrieve_assets')
class BuildPyCommand(build_py):
"""Customized build command to ensure deps are fetched before build."""
def run(self):
self.run_command('fetch_deps')
build_py.run(self)
setup(
name='ShinySDR',
# version='...', # No versioning is defined yet
description='Software-defined radio receiver application built on GNU Radio with a web-based UI and plugins.',
url='https://github.com/kpreid/shinysdr/',
author='Kevin Reid',
author_email='[email protected]',
classifiers=[
# TODO: review/improve; this list was made by browsing <https://pypi.python.org/pypi?%3Aaction=list_classifiers>; can we add new items?
'Development Status :: 3 - Alpha',
'Environment :: Web Environment',
'Framework :: Twisted',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Natural Language :: English',
'Operating System :: OS Independent', # will probably fail on notPOSIX due to lack of portability work, not fundamentally
'Topic :: Communications :: Ham Radio', # non-exclusively ham
],
license='GPLv3+',
packages=find_packages(),
include_package_data=True,
install_requires=[
# 'gnuradio', # Not PyPI
# 'osmosdr', # Not PyPI
'twisted',
'txws',
'ephem',
'six',
'pyserial', # undeclared dependency of twisted.internet.serialport
# Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification
'service_identity',
'pyasn1>=0.4.1,<0.5.0', # required to pin pyans1 support for pyasn1-modules
'pyasn1-modules', # required for service_identity
],
dependency_links=[],
# zip_safe: TODO: Investigate. I suspect unsafe due to serving web resources relative to __file__.
zip_safe=False,
entry_points={
'console_scripts': {
'shinysdr = shinysdr.main:main',
'shinysdr-import = shinysdr.db_import.tool:import_main'
}
},
cmdclass={
'git_init': InitGitSubModules,
'retrieve_assets': DownloadAssets,
'fetch_deps': FetchDeps,
'build_py': BuildPyCommand,
},
)