Skip to content

Commit 0193e37

Browse files
committed
fix library path
1 parent f37e0c0 commit 0193e37

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# python-tinycc
22

3-
Module to use the Tiny C Compiler for inline C in Python.
4-
Tested with Ubuntu 14 (x86_64), WinXP (x86) and Raspbian (Raspberry Pi 3, ARMv7).
3+
Module to use the Tiny C Compiler for inlining C Code in Python.
4+
5+
Tested with:
6+
7+
* CPython 2.7.6 and PyPy 2.2.1 Linux (both 64bit on x86_64, Ubuntu 14)
8+
* CPython 2.7.5 Windows (32bit on x86, Windows XP)
9+
* CPython 2.7.8 Windows (32bit on x86_64, Windows 10)
10+
* CPython 2.7.9 and PyPy 4.0.1 Linux (both 32bit on ARMv7 emulated, Raspberry Pi 3, Raspbian Jessie armhf)
11+
* CPython 2.7.3 Linux (32bit ARMv7, Wandboard, Ubuntu 12 armel)
512

613

714
### Get the Tiny C Compiler
@@ -77,6 +84,7 @@ Example with inline code:
7784
See the example files for more usage ideas.
7885

7986
### TODO
87+
* rework error handling
8088
* Testing
8189
* Python 3 support
8290
* PyPI package

tinycc.py

+8-11
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@
7373
ctypes.c_void_p: 'void *'
7474
})
7575

76-
TCCPATH = os.path.abspath('./linux/lib/tcc')
77-
TCCLIB = os.path.abspath('./linux/lib/libtcc.so')
76+
MODULEDIR = os.path.dirname(__file__)
77+
TCCPATH = os.path.join(MODULEDIR, './linux/lib/tcc')
78+
TCCLIB = os.path.join(MODULEDIR, './linux/lib/libtcc.so')
7879
OUTPUT_TYPES = {
7980
'memory': 1,
8081
'exe' : 2,
@@ -84,8 +85,8 @@
8485
WINDOWS = False
8586
if sys.platform == 'win32':
8687
WINDOWS = True
87-
TCCPATH = os.path.abspath('win32')
88-
TCCLIB = os.path.abspath('win32\libtcc.dll')
88+
TCCPATH = os.path.join(MODULEDIR, 'win32')
89+
TCCLIB = os.path.join(MODULEDIR, 'win32\libtcc.dll')
8990

9091

9192
# tcc error function type
@@ -411,6 +412,8 @@ def _set_output(self, output):
411412

412413
def _error(self):
413414
def cb(_, msg):
415+
# TODO: better error msg handling
416+
print 'tcc:', msg
414417
self.error_message = msg
415418
self._error_function = ERROR_FUNC(cb)
416419
return self._error_function
@@ -614,13 +617,7 @@ def run(self, arguments):
614617
argc = len(arguments)
615618
argv = (ctypes.POINTER(ctypes.c_char) * argc)()
616619
argv[:] = [ctypes.create_string_buffer(s) for s in arguments]
617-
result = self.tcc.lib.tcc_run(self.ctx, argc, argv)
618-
if self.error_message:
619-
msg = self.error_message
620-
self.error_message = ''
621-
raise TccException('\nrun error\n' + msg)
622-
self._run = True
623-
return result
620+
return self.tcc.lib.tcc_run(self.ctx, argc, argv)
624621

625622

626623
class TinyCC(object):

0 commit comments

Comments
 (0)