forked from svvitale/nxppy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
53 lines (42 loc) · 1.76 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
from setuptools import setup
from distutils.core import Extension
from distutils.command.build import build
import os
from subprocess import call
import multiprocessing
class build_nxppy(build):
def run(self):
startingDir = os.getcwd()
os.chdir( os.path.join('NxpRdLib_PublicRelease', 'build') )
def compile():
call( r"sed -i 's/^blacklist spi-bcm2708/#&/' /etc/modprobe.d/raspi-blacklist.conf", shell=True )
call( 'modprobe spi-bcm2708', shell=True )
call( 'cmake .', shell=True )
call( 'make', shell=True )
self.execute(compile, [], 'compiling NxpRdLib')
os.chdir( startingDir )
# Run the rest of the build
build.run(self)
nxppy = Extension('nxppy',
sources = ['Mifare.c', 'nxppy.c'],
include_dirs = ['NxpRdLib_PublicRelease/types', 'NxpRdLib_PublicRelease/intfs', 'NxpRdLib_PublicRelease/comps/phpalSli15693/src/Sw'],
extra_compile_args=['-O1'],
extra_link_args=['NxpRdLib_PublicRelease/build/libnxprd.a']
)
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.2.1',
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})