Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 85 lines (72 sloc) 2.08 KB
#!/usr/bin/env python3
from utils.load_config import load_config, exec_command
# imports
import argparse
from pathlib import Path
import glob
import os
import subprocess
import shutil
import logging
BASE_DIR = Path( __file__ ).resolve().parent
SCRIPT_PATH = Path( __file__ )
SCRIPT_NAME = SCRIPT_PATH.stem
DEFAULT_INPUT_DIR = \
Path(os.environ['INPUT_DIR'] if 'INPUT_DIR' in os.environ else './input')
DEFAULT_OUTPUT_DIR = \
Path(os.environ['OUTPUT_DIR'] if 'OUTPUT_DIR' in os.environ else './output')
DEFAULT_DEPENDENCIES_DIR = \
Path(os.environ['DEPENDENCIES_DIR'] if 'DEPENDENCIES_DIR' in os.environ else './dependencies')
def main(
publ_dir
):
exec_command(
f"eoatex2pdf.py \"{publ_dir}\""
)
exec_command(
f"eoatex2imxml.py \"{publ_dir}\""
)
exec_command(
f"imxml2django.py \"{publ_dir}\""
)
exec_command(
f"imxml2epub.py \"{publ_dir}\""
)
if __name__ == "__main__":
#####################
# Parsing arguments #
#####################
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument(
"-c", "--config",
default = BASE_DIR / "config" / "eoaconvert.cfg",
dest="CONFIG_FILE",
help="Name of configuration file",
metavar="CONFIGURATION"
)
parser.add_argument(
"-l", "--log-file",
default = (DEFAULT_OUTPUT_DIR / 'logs' / SCRIPT_NAME).with_suffix(".log"),
help="logfile"
)
parser.add_argument(
"--log-level",
default = "INFO",
help="log level: choose between DEBUG, INFO, WARNING, ERROR, CRITICAL"
)
parser.add_argument(
"PUBLICATION_DIR",
help = "directory containing the publication (including resources like pictures, etc.)",
type = Path,
)
args = parser.parse_args()
CONFIG = load_config(
args.CONFIG_FILE,
args.log_level,
args.log_file,
)
main(
publ_dir = Path( args.PUBLICATION_DIR )
)