summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2016-01-07 16:52:47 +0100
committerArmin Rigo <arigo@tunes.org>2016-01-07 16:52:47 +0100
commit25cbb21c410dd172b98438e6219ff54ccbc8cf09 (patch)
treee201193ce823c28f604ea903d33fc32b022b67ec
parente219e611f2a9ff3070de73836f9a56177549a7c0 (diff)
downloadcffi-25cbb21c410dd172b98438e6219ff54ccbc8cf09.tar.gz
tweaks
-rw-r--r--demo/pwuid.py15
-rw-r--r--demo/pwuid_build.py2
2 files changed, 3 insertions, 14 deletions
diff --git a/demo/pwuid.py b/demo/pwuid.py
index 650b9da..dda9299 100644
--- a/demo/pwuid.py
+++ b/demo/pwuid.py
@@ -1,18 +1,7 @@
import sys, os
-# If the build script was run immediately before this script, the cffi module
-# ends up in the current directory. Make sure we can import it.
-sys.path.append('.')
+# run pwuid_build first, then make sure the shared object is on sys.path
+from _pwuid_cffi import ffi, lib
-try:
- from _pwuid import ffi, lib
-except ImportError:
- print 'run pwuid_build first, then make sure the shared object is on sys.path'
- sys.exit(-1)
-
-# ffi "knows" about the declared variables and functions from the
-# cdef parts of the module xclient_build created,
-# lib "knows" how to call the functions from the set_source parts
-# of the module.
print ffi.string(lib.getpwuid(0).pw_name)
diff --git a/demo/pwuid_build.py b/demo/pwuid_build.py
index bfbfa55..7ef0d76 100644
--- a/demo/pwuid_build.py
+++ b/demo/pwuid_build.py
@@ -8,7 +8,7 @@ ffi.cdef(""" // some declarations from the man page
struct passwd *getpwuid(int uid);
""")
-ffi.set_source('_pwuid', """ // passed to the real C compiler
+ffi.set_source('_pwuid_cffi', """ // passed to the real C compiler
#include <sys/types.h>
#include <pwd.h>
""")