forked from piface/pifacedigitalio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
70 lines (53 loc) · 1.82 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
import sys
import subprocess
from distutils.core import setup
PY3 = sys.version_info.major >= 3
PYTHON_CMD = "python3" if PY3 else "python"
# change this to True if you just want to install the module by itself
MODULE_ONLY = False
INSTALL_PIFACECOMMON_CMD = \
"git clone https://github.com/piface/pifacecommon.git && " \
"cd pifacecommon && " \
"{} setup.py install".format(PYTHON_CMD)
class InstallFailed(Exception):
pass
def run_cmd(cmd, error_msg):
success = subprocess.call([cmd], shell=True)
if success != 0:
raise InstallFailed(error_msg)
def install_pifacecommon():
print("Installing pifacecommon.")
run_cmd(INSTALL_PIFACECOMMON_CMD, "Failed to install pifacecommon.")
def check_pifacecommon():
try:
import pifacecommon
# TODO version numbers
except ImportError:
print("pifacecommon is not installed.")
install_pifacecommon()
if "install" in sys.argv and not MODULE_ONLY:
check_pifacecommon()
setup(
name='pifacedigitalio',
version='2.0.0',
description='The PiFace Digital I/O module.',
author='Thomas Preston',
author_email='[email protected]',
url='http://piface.github.io/pifacecommon/index.html',
py_modules=['pifacedigitalio'],
long_description=open('README.md').read() + open('CHANGELOG').read(),
classifiers=[
"License :: OSI Approved :: GNU Affero General Public License v3 or "
"later (AGPLv3+)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 2",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
],
keywords='piface digital raspberrypi openlx',
license='GPLv3+',
requires=[
'pifacecommon',
]
)