From 2114e808f5ebabca28558b7f902b8352b9b96d27 Mon Sep 17 00:00:00 2001
From: kthoden <kthoden@mpiwg-berlin.mpg.de>
Date: Thu, 9 Apr 2020 10:29:27 +0200
Subject: [PATCH] Copy cover image

---
 src/eoatex2imxml.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/eoatex2imxml.py b/src/eoatex2imxml.py
index afb5ef0..a4da8eb 100755
--- a/src/eoatex2imxml.py
+++ b/src/eoatex2imxml.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8; mode: python -*-
-# Time-stamp: <2020-03-04 12:19:55 (kthoden)>
+# Time-stamp: <2020-04-08 19:03:16 (kthoden)>
 
 """
 Converts Latex files into a customized DocBook XML file.
@@ -203,6 +203,15 @@
 else:
     logging.error(f"Found no publication.cfg in {INPUT_DIR}. Exiting")
     sys.exit( 1 )
+if os.path.exists(INPUT_DIR /  "Cover.jpg"):
+    shutil.copy(INPUT_DIR / "Cover.jpg", OUTPUT_DIR / "Cover.jpg")
+    logging.info("Copied cover imag from input directory.")
+elif os.path.exists(INPUT_DIR /  "images/Cover.jpg"):
+    shutil.copy(INPUT_DIR / "images/Cover.jpg", OUTPUT_DIR / "Cover.jpg")
+    logging.info("Copied cover image from publication directory.")
+else:
+    logging.error("No coverfile found. You can create a temporary one with the mkimage.py script")
+    sys.exit( 1 )
 
 # Copy Support-Files from /Library/MPIWG to current directory
 shutil.copy(SUPPORT_PATH / "classes.dtd", OUTPUT_DIR)