Skip to content

Commit d0b2cbd

Browse files
committed
Merge branch 'dev' into main
2 parents 4aedc1a + 0e6dd7b commit d0b2cbd

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

batch_process.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def remove_redundant_stuff(main_directory: str) -> None:
7171
f"{main_directory}/output/paper_original",
7272
]
7373
for folder in redundant_folders:
74-
shutil.rmtree(folder)
74+
if os.path.exists(folder):
75+
shutil.rmtree(folder)
7576

7677

7778
def process_one_file(file_name) -> None:
@@ -145,7 +146,6 @@ def filter_tex_files(tex_files: List[str], main_path: str = None) -> List[str]:
145146
result = []
146147
for tex_file in tex_files:
147148
if main_path and os.path.dirname(os.path.dirname(tex_file)) != main_path:
148-
log.info(f"not the valid tex file: {tex_file}")
149149
continue
150150
# prevent processing previous generated files
151151
try:

vrdu/preprocess.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,19 @@ def replace_pdf_figures_with_png(original_tex: str) -> None:
135135

136136
# Replace PDF paths with PNG paths
137137
for match in matches:
138-
pdf_image_name = match[1]
139-
pdf_image = os.path.join(
140-
main_directory, os.path.join(graphic_path, pdf_image_name)
138+
image_name = match[1]
139+
image_file = os.path.join(
140+
main_directory, os.path.join(graphic_path, image_name)
141141
)
142-
if not os.path.exists(pdf_image):
143-
raise FileNotFoundError(f"File not found: {pdf_image}")
142+
if not os.path.exists(image_file):
143+
raise FileNotFoundError(f"File not found: {image_file}")
144144

145-
png_image_name = os.path.splitext(pdf_image_name)[0] + ".png"
145+
png_image_name = os.path.splitext(image_name)[0] + ".png"
146146
png_image = os.path.join(
147147
main_directory, os.path.join(graphic_path, png_image_name)
148148
)
149149

150-
utils.convert_pdf_figure_to_png_image(pdf_image, png_image)
150+
utils.convert_pdf_figure_to_png_image(image_file, png_image)
151151

152152
# replace the reference in tex file
153153
content = content.replace(match[1], png_image_name)

0 commit comments

Comments
 (0)