forked from crgrove/automated-drone-image-analysis-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
78 lines (51 loc) · 1.55 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
#!/usr/bin/env python
import re
import os
from subprocess import check_call
from setuptools import setup, find_packages, Command
from setuptools.command.sdist import sdist
cmdclass = {}
try:
from pyqt_distutils.build_ui import build_ui
has_build_ui = True
except ImportError:
has_build_ui = False
with open('app/__init__.py') as f:
_version = re.search(r'__version__\s+=\s+\'(.*)\'', f.read()).group(1)
if has_build_ui:
class build_res(build_ui):
"""Build UI and resources."""
def run(self):
# build UI & resources
build_ui.run(self)
cmdclass['build_res'] = build_res
class custom_sdist(sdist):
"""Custom sdist command."""
def run(self):
self.run_command('build_res')
sdist.run(self)
cmdclass['sdist'] = custom_sdist
class bdist_app(Command):
"""Custom command to build the application. """
description = 'Build the application'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
self.run_command('build_res')
check_call(['pyinstaller', '-y', 'app.spec'])
cmdclass['bdist_app'] = bdist_app
setup(name='app',
version=_version,
packages=find_packages(),
description='Automated Drone Image Analysis Tool',
author='Charlie Grove',
author_email='[email protected]',
license=' AGPL-3.0',
url='https://www.texsar.org',
entry_points={
'gui_scripts': ['app=app.__main__:main'],
},
cmdclass=cmdclass)