-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
202 lines (190 loc) · 6.33 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
import os
from setuptools.command.install import install
import platform
import urllib
import subprocess
import time
import httplib
import requests
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
pyqt4_exe = "https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe/download"
pyqt4_tgz = "https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.12.1/PyQt4_gpl_x11-4.12.1.tar.gz/download"
sip_tgz = "https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.8/sip-4.19.8.tar.gz/download"
# See https://medium.com/small-things-about-python/lets-talk-about-python-packaging-6d84b81f1bb5#.pjxrklmi6
class CustomInstallCommand(install):
"""Customized setuptools install command
This to handle installation of PyQt4
"""
def run(self):
def download(filename, tmp):
print "Download", filename
urllib.urlretrieve(filename, tmp)
print "download Done"
return
print "Hello, developer, how are you?"
os = platform.system()
print "Operating System is: ", os
# To test windows
# os = "Windows"
if os == "Windows":
download(pyqt4_exe, "pyqt4.exe")
print "Test Windows install"
print "Done"
exit()
try:
subprocess.Popen(pyqt4_exe)
except:
print "Windows install pyqy4 failed"
exit()
os.remove(file_)
elif os == "Linux":
# sudo apt-get install python-sip python-qt4?
print ("Linux install""pyqt4.tgz")
download(pyqt4_tgz, "pyqt4.tgz")
download(sip_tgz, "sip.tgz")
import tarfile
import os
import shutil
import subprocess
import sys
tf = tarfile.open("sip.tgz")
tfn = tf.getnames()
tfm = tf.getmembers()
sip_dir = tfn[0]
sip_lst = tfm[1:]
tf.extractall(members=sip_lst)
# print "sip names: ", tfn
# print "sip dir: ", sip_dir
# print "sip members: ", tfm
os.remove("sip.tgz")
print "Done sip"
tf = tarfile.open("pyqt4.tgz")
tfn = tf.getnames()
tfm = tf.getmembers()
pyqt4_dir = tfn[0]
pyqt4_lst = tfm[1:]
tf.extractall(members=pyqt4_lst)
os.remove("pyqt4.tgz")
print "Done pyqt4"
sip_config_file = os.path.abspath(sip_dir + "/configure.py")
# print "sip_config_file: ", sip_config_file
# sip_config = [sys.executable, sip_dir + "/config.py"]
sip_config = [sys.executable, sip_config_file]
subprocess.call(sip_config)
print "Sip config done"
return
else:
print "No install for this OS: ", os
exit()
try:
install.run(self)
except:
print "Failed install.run(self)"
print "Done install.run(self()"
return
setup(name='OGN_Flogger',
version='0.3.2a14',
scripts=['src/flogger_gui.py'], # Command to run
description='Realtime logging of glider flights from Flarm data',
long_description='Realtime logging and tracking of gliders from Flarm signals using APRS.',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering :: Information Analysis',
],
project_urls = {
'tracker': 'http://github.com/tobiz/OGN-Flogger/issues',
},
keywords='OGN Open Glider Flarm Logging Tracking',
url='http://github.com/tobiz/OGN-Flogger',
author='tobiz',
author_email='pjrobinson@metronet.co.uk',
license='GPL',
python_requires = '>=2.7, <3',
cmdclass={'install': CustomInstallCommand,
},
# packages = find_packages(), # Replaced by Manifest.ini
dependency_links=["http://www.riverbankcomputing.com/software/sip/download",
"http://www.riverbankcomputing.com/software/pyqt/download",
"https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe/download",
],
# py_modules=[
# 'flarm_db',
# 'flogger3',
# 'flogger_dump_flights',
# 'flogger_dump_IGC',
# 'flogger_dump_tracks',
# 'flogger_email_log',
# 'flogger_email_msg',
# 'flogger_find_tug',
# 'flogger_functions',
# 'flogger_get_coords',
# 'flogger_gui',
# 'flogger_landout',
# 'flogger_moviesplash',
# 'flogger_OGN_db',
## 'flogger_process_log',
## 'flogger_progress_indicator',
# 'flogger_resources_rc',
# 'flogger_settings',
# 'flogger_signals',
## 'flogger_splash',
# 'flogger_test_YorN',
# 'flogger_ui',
# 'flogger_aprs_parser',
# 'gpxTracks',
# 'open_db'
# ],
install_requires=[
'geocoder>=1.4.0',
'parse>=1.8.0',
'configobj>=4.7.2',
'geopy>=1.11.0',
'aerofiles>=0.3',
'aprslib>=0.6.46',
'gpxpy>=1.1.2',
'setuptools>=3.3',
'pytz>=2012c',
'requests>=2.13.0',
'mplleaflet>=0.0.5',
'LatLon>=1.0.2',
# 'PyQt4>=4.11.4',
'pyephem>=3.7.6.0',
'protobuf>=3.5.2.post1',
'adhocracy_pysqlite>=2.6.3',
'pysqlite3>=0.1.0',
'matplotlib',
],
data_files=[('', ['data/flogger_help_icon-1.png']),
('', ['data/flogger_icon-08.png']),
('', ['data/flogger_start.png']),
('', ['data/flogger_stop.png']),
('', ['data/flogger_settings_file.txt']),
# ('', ['data/requirements.txt']),
('', ['data/flogger_about.ui']),
('', ['data/flogger_config_1.ui']),
('', ['data/flogger_help.ui']),
('', ['data/flogger.ui']),
('', ['data/flogger_resources.qrc']),
('', ['data/flogger_schema-1.0.4.sql']),
('', ['data/ogn-logo-ani.gif']),
# ('', ['flarm_data']),
],
# packages=find_packages(),
include_package_data=True,
zip_safe=False
)