diff options
-rw-r--r-- | demo/pwuid.py | 15 | ||||
-rw-r--r-- | demo/pwuid_build.py | 2 |
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> """) |