forked from amperka/ino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
93 lines (84 loc) · 2.77 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# run following command to install this module:
# python setup.py install
#
# run following command to uninstall this module:
# python setup.py uninstall
# OR
# cat install_*.txt | xargs rm -vrf
from setuptools import setup
import sys
# Check for uninstall in argument and do uninstall
i=0
for e in sys.argv:
if e=='uninstall':
print("running uninstall")
import glob
import os
for a in glob.glob('install_*_%s.txt' % sys.platform):
for f in file(a).read().split('\n'):
if os.path.isfile(f):
print("Remove ", f)
os.remove(f)
sys.argv.pop(i)
else:
i += 1
if len(sys.argv)<=1: quit()
install_requires = open("requirements.txt").read().split('\n')
readme_content = open("README.rst").read()
extra = {}
if sys.version_info >= (3, 0):
extra.update(
use_2to3=True,
)
def gen_data_files(package_dir, subdir):
import os.path
results = []
for root, dirs, files in os.walk(os.path.join(package_dir, subdir)):
files = [os.path.join(root, f)[len(package_dir) + 1:] for f in files]
results.extend(files)
return results
ino_package_data = (gen_data_files('ino', 'make') +
gen_data_files('ino', 'templates'))
# Look for install and --record install_*.txt file into argument for
# installation record
__version__ = '0.3.8'
for i, e in enumerate(sys.argv):
if e=='install':
# Import to verify all dependencies are satisfy, and obtain __version__
try:
import ino.runner
sys.argv.insert(i+1,'--record')
sys.argv.insert(i+2,'install_%s_%s.txt' % (__version__, sys.platform))
except ImportError as e:
print("Require module is not found: ", e.message)
quit()
break
setup(
name='ino',
version=__version__,
description='Command line toolkit for working with Arduino hardware',
long_description=readme_content,
author='Victor Nakoryakov, Amperka Team',
author_email='[email protected]',
license='MIT',
keywords="arduino build system",
url='http://inotool.org',
packages=['ino', 'ino.commands'],
scripts=['bin/ino'],
package_data={'ino': ino_package_data},
install_requires=install_requires,
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Topic :: Software Development :: Embedded Systems",
],
**extra
)