Skip to content

Commit e330dcc

Browse files
committed
Do the directory detection AFTER it's been downloaded
1 parent 0e2e665 commit e330dcc

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

setup.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,32 @@
66
import multiprocessing
77
from glob import glob
88

9+
nxppy = Extension('nxppy',
10+
sources = ['Mifare.c', 'nxppy.c'],
11+
extra_compile_args=['-O1'],
12+
extra_link_args=['-lwiringPi']
13+
)
14+
915
class build_nxppy(build):
1016
def run(self):
1117
def compile():
1218
call( './get_nxpRdLib.sh', shell=True )
1319

20+
# Find where neard-explorenfc was extracted
21+
nxprdlib_dir = glob('neard-explorenfc-*/nxprdlib')[0]
22+
23+
# Add relevant include directories
24+
nxppy.include_dirs.append(nxprdlib_dir + '/types')
25+
nxppy.include_dirs.append(nxprdlib_dir + '/intfs')
26+
27+
# Add library reference
28+
nxppy.extra_link_args.append(nxprdlib_dir + '/libnxprdlib.a')
29+
1430
self.execute(compile, [], 'compiling NxpRdLib')
1531

1632
# Run the rest of the build
1733
build.run(self)
1834

19-
nxprdlib_dir = glob('neard-explorenfc-*/nxprdlib')[0]
20-
21-
nxppy = Extension('nxppy',
22-
sources = ['Mifare.c', 'nxppy.c'],
23-
include_dirs = [nxprdlib_dir + '/types',
24-
nxprdlib_dir + '/intfs'],
25-
extra_compile_args=['-O1'],
26-
extra_link_args=[nxprdlib_dir + '/libnxprdlib.a', '-lwiringPi']
27-
)
28-
2935
short_description = 'A python extension for interfacing with the NXP PN512 NFC Reader. Targeted specifically for Raspberry Pi and the EXPLORE-NFC module'
3036

3137
try:

0 commit comments

Comments
 (0)