@@ -158,9 +158,11 @@ def exfile2rstfile(filename, opts):
158
158
"""
159
159
# doc filename
160
160
dfilename = os .path .basename (filename [:- 3 ]) + '.rst'
161
+ dfilepath = os .path .join (opts .outdir , os .path .basename (dfilename ))
162
+ print ("Creating file %s." % os .path .abspath (dfilepath ))
161
163
162
164
# open dest file
163
- dfile = open (os . path . join ( opts . outdir , os . path . basename ( dfilename )) , 'w' )
165
+ dfile = open (dfilepath , 'w' )
164
166
165
167
# place header
166
168
dfile .write ('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n \n ' )
@@ -196,8 +198,8 @@ def exfile2rstfile(filename, opts):
196
198
197
199
198
200
def main ():
199
- parser = OptionParser ( \
200
- usage = "%prog [options] <filename|directory> [...]" , \
201
+ parser = OptionParser (
202
+ usage = "%prog [options] <filename|directory> [...]" ,
201
203
version = "%prog 0.1" , description = """\
202
204
%prog converts Python scripts into restructered text (ReST) format suitable for
203
205
integration into the Sphinx documentation framework. Its key feature is that it
@@ -217,7 +219,7 @@ the respective indentation is removed in the ReST output.
217
219
218
220
The parser algorithm automatically excludes file headers and starts with the
219
221
first (module-level) docstring instead.
220
- """ ) #'
222
+ """ )
221
223
222
224
# define options
223
225
parser .add_option (
@@ -293,8 +295,7 @@ Name of the project that contains the examples. This name is used in the
293
295
if len (toparse ) != len (toparse_list ):
294
296
print ('Ignoring duplicate parse targets.' )
295
297
296
- if not os .path .exists (opts .outdir ):
297
- os .mkdir (outdir )
298
+ os .makedirs (opts .outdir , exist_ok = True )
298
299
299
300
# finally process all examples
300
301
for t in toparse :
0 commit comments