File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -115,15 +115,28 @@ def maybe_exclude_notebooks():
115115 notebooks = [os .path .join (base , 'source' , nb )
116116 for nb in ['style.ipynb' ]]
117117 contents = {}
118- try :
119- import nbconvert
120- nbconvert .utils .pandoc .get_pandoc_version ()
121- except (ImportError , nbconvert .utils .pandoc .PandocMissing ):
122- print ("Warning: Pandoc is not installed. Skipping Notebooks." )
118+
119+ def _remove_notebooks ():
123120 for nb in notebooks :
124121 with open (nb , 'rt' ) as f :
125122 contents [nb ] = f .read ()
126123 os .remove (nb )
124+
125+ # Skip notebook conversion if
126+ # 1. nbconvert isn't installed, or
127+ # 2. nbconvert is installed, but pandoc isn't
128+ try :
129+ import nbconvert
130+ except ImportError :
131+ print ("Warning: nbconvert not installed. Skipping notebooks." )
132+ _remove_notebooks ()
133+ else :
134+ try :
135+ nbconvert .utils .pandoc .get_pandoc_version ()
136+ except nbconvert .utils .pandoc .PandocMissing :
137+ print ("Warning: Pandoc is not installed. Skipping notebooks." )
138+ _remove_notebooks ()
139+
127140 yield
128141 for nb , content in contents .items ():
129142 with open (nb , 'wt' ) as f :
You can’t perform that action at this time.
0 commit comments