@@ -413,8 +413,8 @@ def generate_dir_rst(
413
413
if not os .path .exists (target_dir ):
414
414
os .makedirs (target_dir )
415
415
# get filenames
416
- listdir = [fname for fname in os .listdir (src_dir ) if
417
- fname .endswith ('.py' )]
416
+ listdir = [fname for fname in os .listdir (src_dir )
417
+ if fname .endswith ('.py' )]
418
418
# limit which to look at based on regex (similar to filename_pattern)
419
419
listdir = [fname for fname in listdir
420
420
if re .search (gallery_conf ['ignore_pattern' ],
@@ -432,26 +432,24 @@ def generate_dir_rst(
432
432
costs = []
433
433
subsection_toctree_filenames = []
434
434
build_target_dir = os .path .relpath (target_dir , gallery_conf ['src_dir' ])
435
-
436
435
iterator = sphinx .util .status_iterator (
437
436
sorted_listdir ,
438
437
'generating gallery for %s... ' % build_target_dir ,
439
438
length = len (sorted_listdir ))
440
439
for fname in iterator :
441
- src_file = os .path .normpath (os .path .join (src_dir , fname ))
442
- # make the rst for the python file:
443
440
intro , title , cost = generate_file_rst (
444
441
fname , target_dir , src_dir , gallery_conf , seen_backrefs )
442
+ src_file = os .path .normpath (os .path .join (src_dir , fname ))
445
443
costs .append ((cost , src_file ))
444
+ gallery_item_filename = os .path .join (
445
+ build_target_dir ,
446
+ fname [:- 3 ]
447
+ ).replace (os .sep , '/' )
446
448
this_entry = _thumbnail_div (
447
449
target_dir , gallery_conf ['src_dir' ], fname , intro , title
448
450
)
449
451
entries_text .append (this_entry )
450
452
451
- gallery_item_filename = os .path .join (
452
- build_target_dir ,
453
- fname [:- 3 ]
454
- ).replace (os .sep , '/' )
455
453
subsection_toctree_filenames .append ("/" + gallery_item_filename )
456
454
457
455
for entry_text in entries_text :
@@ -497,7 +495,7 @@ def generate_dir_rst(
497
495
copyregex = gallery_conf .get ('copyfile_regex' )
498
496
if copyregex :
499
497
listdir = [fname for fname in os .listdir (src_dir ) if
500
- re .match (copyregex , fname )]
498
+ re .match (copyregex , fname )]
501
499
readme = _get_readme (src_dir , gallery_conf , raise_error = False )
502
500
# don't copy over the readme
503
501
if readme :
0 commit comments