forked from AlterCodex/nxppy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
66 lines (56 loc) · 2.67 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
from setuptools import setup
from distutils.core import Extension
from distutils.command.build import build
import os
import sys
from subprocess import call
import multiprocessing
from glob import glob
nxppy = Extension('nxppy',
define_macros = [('LINUX',None),('NATIVE_C_CODE',None),('NXPBUILD_CUSTOMER_HEADER_INCLUDED',None),('NXPBUILD__PHHAL_HW_RC523',None)],
extra_compile_args=['-O0',
'-std=gnu99',
'-isystemnxp/nxprdlib/NxpRdLib/intfs',
'-isystemnxp/nxprdlib/NxpRdLib/types',
'-isystemnxp/nxprdlib/NxpRdLib',
'-isystemnxp/linux/intfs',
'-isystemnxp/linux/comps/phbalReg/src/Linux',
'-isystemnxp/linux/shared',
'-isystemnxp/examples/NfcrdlibEx4_MIFAREClassic/intfs',
'-isystemnxp/nxprdlib/NxpRdLib/comps/phbalReg/src/Stub',
'-isystemnxp/linux/comps/phPlatform/src/Posix',
'-isystemnxp/linux/comps/phOsal/src/Posix'
],
extra_link_args=['nxp/build/linux/libNxpRdLibLinuxPN512.a','-lpthread','-lrt'],
sources = ['Mifare.c', 'nxppy.c']
)
class build_nxppy(build):
def run(self):
def compile(extra_preargs=None):
if sys.version_info >= (3, 0):
python_lib = 'python3-dev'
elif sys.version_info >= (2, 7):
python_lib = 'python2.7-dev'
else:
raise ValueError("Python version not supported")
call('./get_nxpRdLib.sh all ' + python_lib, shell=True)
self.execute(compile, [], 'compiling NxpRdLib')
# Run the rest of the build
build.run(self)
short_description = 'A python extension for interfacing with the NXP PN512 NFC Reader. Targeted specifically for Raspberry Pi and the EXPLORE-NFC module'
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except:
long_description = short_description
setup (name = 'nxppy',
version = '1.4.3',
description = short_description,
long_description = long_description,
author = 'Scott Vitale',
author_email = '[email protected]',
url = 'http://github.com/svvitale/nxppy',
test_suite = 'nose.collector',
setup_requires=['nose>=1.0'],
ext_modules = [nxppy],
cmdclass = {'build': build_nxppy})