From 34acf678d70580dc880451ecbf58c61bec77979f Mon Sep 17 00:00:00 2001 From: znmean Date: Mon, 15 Aug 2016 16:32:56 +0900 Subject: [PATCH 1/3] fixed using IP.prompt_manager which is removed from IPython 5.x class promptManager has removed in IPython 5.x, but this file still using that class, so it makes AttributeError. close #14003 --- doc/source/whatsnew/v0.20.0.txt | 1 + .../ipython_sphinxext/ipython_directive.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/source/whatsnew/v0.20.0.txt b/doc/source/whatsnew/v0.20.0.txt index 695e917c76ba0..225026b6f002d 100644 --- a/doc/source/whatsnew/v0.20.0.txt +++ b/doc/source/whatsnew/v0.20.0.txt @@ -81,3 +81,4 @@ Performance Improvements Bug Fixes ~~~~~~~~~ +Bug when building docs with IPython 5.x (:issue:`14003`) diff --git a/doc/sphinxext/ipython_sphinxext/ipython_directive.py b/doc/sphinxext/ipython_sphinxext/ipython_directive.py index ad7ada8e4eea3..e8a0a473852be 100644 --- a/doc/sphinxext/ipython_sphinxext/ipython_directive.py +++ b/doc/sphinxext/ipython_sphinxext/ipython_directive.py @@ -799,13 +799,19 @@ def setup(self): # Store IPython directive to enable better error messages self.shell.directive = self - # reset the execution count if we haven't processed this doc - #NOTE: this may be borked if there are multiple seen_doc tmp files - #check time stamp? - if not self.state.document.current_source in self.seen_docs: + """ + reset the execution count if we haven't processed this doc + NOTE: this may be borked if there are multiple seen_doc tmp files + check time stamp? + """ + if self.state.document.current_source not in self.seen_docs: self.shell.IP.history_manager.reset() self.shell.IP.execution_count = 1 - self.shell.IP.prompt_manager.width = 0 + try: + self.shell.IP.prompt_manager.width = 0 + except AttributeError: + # GH14003: class promptManager has removed after IPython 5.x + pass self.seen_docs.add(self.state.document.current_source) # and attach to shell so we don't have to pass them around From d4ba6dc5f9751592f9c2b4628976dcc959cb2eb3 Mon Sep 17 00:00:00 2001 From: znmean Date: Tue, 16 Aug 2016 22:03:19 +0900 Subject: [PATCH 2/3] revert to # comment, delete whatsnew notice as it is not a user facing bug fix. closes #14003 --- doc/source/whatsnew/v0.20.0.txt | 1 - doc/sphinxext/ipython_sphinxext/ipython_directive.py | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/source/whatsnew/v0.20.0.txt b/doc/source/whatsnew/v0.20.0.txt index 225026b6f002d..695e917c76ba0 100644 --- a/doc/source/whatsnew/v0.20.0.txt +++ b/doc/source/whatsnew/v0.20.0.txt @@ -81,4 +81,3 @@ Performance Improvements Bug Fixes ~~~~~~~~~ -Bug when building docs with IPython 5.x (:issue:`14003`) diff --git a/doc/sphinxext/ipython_sphinxext/ipython_directive.py b/doc/sphinxext/ipython_sphinxext/ipython_directive.py index e8a0a473852be..878e4d01a5a70 100644 --- a/doc/sphinxext/ipython_sphinxext/ipython_directive.py +++ b/doc/sphinxext/ipython_sphinxext/ipython_directive.py @@ -799,11 +799,10 @@ def setup(self): # Store IPython directive to enable better error messages self.shell.directive = self - """ - reset the execution count if we haven't processed this doc - NOTE: this may be borked if there are multiple seen_doc tmp files - check time stamp? - """ + + # reset the execution count if we haven't processed this doc + #NOTE: this may be borked if there are multiple seen_doc tmp files + #check time stamp? if self.state.document.current_source not in self.seen_docs: self.shell.IP.history_manager.reset() self.shell.IP.execution_count = 1 From cfd94992134852d36877d5dc45f26c3960a838ba Mon Sep 17 00:00:00 2001 From: znmean Date: Tue, 16 Aug 2016 22:12:31 +0900 Subject: [PATCH 3/3] blankline removed --- doc/sphinxext/ipython_sphinxext/ipython_directive.py | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/sphinxext/ipython_sphinxext/ipython_directive.py b/doc/sphinxext/ipython_sphinxext/ipython_directive.py index 878e4d01a5a70..b8b0935cd5b96 100644 --- a/doc/sphinxext/ipython_sphinxext/ipython_directive.py +++ b/doc/sphinxext/ipython_sphinxext/ipython_directive.py @@ -799,7 +799,6 @@ def setup(self): # Store IPython directive to enable better error messages self.shell.directive = self - # reset the execution count if we haven't processed this doc #NOTE: this may be borked if there are multiple seen_doc tmp files #check time stamp?