File tree 1 file changed +18
-5
lines changed
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():
115
115
notebooks = [os .path .join (base , 'source' , nb )
116
116
for nb in ['style.ipynb' ]]
117
117
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 ():
123
120
for nb in notebooks :
124
121
with open (nb , 'rt' ) as f :
125
122
contents [nb ] = f .read ()
126
123
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
+
127
140
yield
128
141
for nb , content in contents .items ():
129
142
with open (nb , 'wt' ) as f :
You can’t perform that action at this time.
0 commit comments