From 60dbadd41f33f3e3474926f1c53258f9e9612f3d Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Thu, 19 Oct 2017 18:34:48 +0200 Subject: DOC: fix fake import for API docs Switching to out-of-line ABI mode (#102) broke this. --- doc/conf.py | 4 ++-- doc/fake__sounddevice.py | 35 +++++++++++++++++++++++++++++++++++ doc/fake_cffi.py | 35 ----------------------------------- 3 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 doc/fake__sounddevice.py delete mode 100644 doc/fake_cffi.py (limited to 'doc') diff --git a/doc/conf.py b/doc/conf.py index 8474a95..8c2d75e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -23,8 +23,8 @@ sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath('.')) # Fake import to avoid actually loading CFFI and the PortAudio library -import fake_cffi -sys.modules['cffi'] = sys.modules['fake_cffi'] +import fake__sounddevice +sys.modules['_sounddevice'] = sys.modules['fake__sounddevice'] # -- General configuration ------------------------------------------------ diff --git a/doc/fake__sounddevice.py b/doc/fake__sounddevice.py new file mode 100644 index 0000000..d72f15f --- /dev/null +++ b/doc/fake__sounddevice.py @@ -0,0 +1,35 @@ +"""Mock module for Sphinx autodoc.""" + + +class ffi(object): + + NULL = NotImplemented + I_AM_FAKE = True # This is used for the documentation of "default" + + def dlopen(self, _): + return FakeLibrary() + + +ffi = ffi() + + +class FakeLibrary(object): + + # from portaudio.h: + + paFloat32 = paInt32 = paInt24 = paInt16 = paInt8 = paUInt8 = NotImplemented + paFramesPerBufferUnspecified = 0 + + def Pa_Initialize(self): + return 0 + + def Pa_Terminate(self): + return 0 + + # from stdio.h: + + def fopen(*args, **kwargs): + return NotImplemented + + def fclose(*args): + pass diff --git a/doc/fake_cffi.py b/doc/fake_cffi.py deleted file mode 100644 index 24b1916..0000000 --- a/doc/fake_cffi.py +++ /dev/null @@ -1,35 +0,0 @@ -"""Mock module for Sphinx autodoc.""" - - -class FFI(object): - - NULL = NotImplemented - I_AM_FAKE = True # This is used for the documentation of "default" - - def cdef(self, _): - pass - - def dlopen(self, _): - return FakeLibrary() - - -class FakeLibrary(object): - - # from portaudio.h: - - paFloat32 = paInt32 = paInt24 = paInt16 = paInt8 = paUInt8 = NotImplemented - paFramesPerBufferUnspecified = 0 - - def Pa_Initialize(self): - return 0 - - def Pa_Terminate(self): - return 0 - - # from stdio.h: - - def fopen(*args, **kwargs): - return NotImplemented - - def fclose(*args): - pass -- cgit v1.2.3