diff --git a/install.sh b/install.sh index 1336e13..95f4b15 100644 --- a/install.sh +++ b/install.sh @@ -23,6 +23,9 @@ You should have the following applications installed before continuing: * yq (version 4.18 or later) MacOS users, please install greadlink through 'brew install coreutils' + +Options: +--install-pandoc: Required for running the command icav2 projectpipelines create-cwl-from-zip " ICAV2_CLI_PLUGINS_HOME="$HOME/.icav2-cli-plugins" @@ -138,6 +141,24 @@ get_this_path() { echo "${this_dir}" } +################ +# ARGUMENTS +################ +# Get args from command line +install_pandoc="false" +while [ $# -gt 0 ]; do + case "$1" in + --install-pandoc) + install_pandoc="true" + ;; + -h | --help) + print_help + exit 0 + ;; + esac + shift 1 +done + ################ # GET VERSIONS ################ @@ -282,10 +303,16 @@ sed -i "s/__PLUGIN_VERSION__/${PLUGIN_VERSION}/" "${ICAV2_CLI_PLUGINS_HOME}/shel # LINK PANDOC BINARY ###################### # Link pandoc binary from site-packages/pypandoc/files/pandoc to ${ICAV2_CLI_PLUGINS_HOME}/pyenv/bin -( \ - cd "${ICAV2_CLI_PLUGINS_HOME}/pyenv/bin/"; - ln -sf "${SITE_PACKAGES_DIR}/pypandoc/files/pandoc" "${ICAV2_CLI_PLUGINS_HOME}/pyenv/bin/pandoc}" -) +if [[ "${install_pandoc}" == "true" ]]; then + echo_stderr "Installing pandoc requirements" + "${ICAV2_CLI_PLUGINS_HOME}/pyenv/bin/python3" -m pip install --requirement "${ICAV2_CLI_PLUGINS_HOME}/requirements-pandoc.txt" --quiet + if [[ -f "${SITE_PACKAGES_DIR}/pypandoc/files/pandoc" ]]; then + ( \ + cd "${ICAV2_CLI_PLUGINS_HOME}/pyenv/bin/"; + ln -sf "${SITE_PACKAGES_DIR}/pypandoc/files/pandoc" "${ICAV2_CLI_PLUGINS_HOME}/pyenv/bin/pandoc}" + ) + fi +fi ###################### # COPY AUTOCOMPLETIONS diff --git a/src/plugins/requirements-pandoc.txt b/src/plugins/requirements-pandoc.txt new file mode 100644 index 0000000..30d894e --- /dev/null +++ b/src/plugins/requirements-pandoc.txt @@ -0,0 +1,3 @@ +-r requirements.txt +pypandoc==1.10 +pypandoc_binary==1.10 \ No newline at end of file diff --git a/src/plugins/requirements.txt b/src/plugins/requirements.txt index bccd492..2f476a6 100644 --- a/src/plugins/requirements.txt +++ b/src/plugins/requirements.txt @@ -15,8 +15,6 @@ websocket_client==1.4.2 # Manual additions cwltool==3.1.20221201130942 pandoc==2.3 -pypandoc==1.10 -pypandoc_binary==1.10 humanfriendly==10.0 matplotlib==3.7.1 invoke==2.0.0 diff --git a/src/plugins/subcommands/projectpipelines/create_cwl_workflow_from_zip.py b/src/plugins/subcommands/projectpipelines/create_cwl_workflow_from_zip.py index 8deeeb1..1bbc677 100644 --- a/src/plugins/subcommands/projectpipelines/create_cwl_workflow_from_zip.py +++ b/src/plugins/subcommands/projectpipelines/create_cwl_workflow_from_zip.py @@ -132,6 +132,12 @@ def print_to_stdout(self): ) def check_args(self): + # Check pypandoc binary + try: + import pandoc + except ImportError: + logger.error("Could not find pandoc module, please re-run the installation script with --install-pandoc parameter") + raise ImportError # Check zipped workflow path exists self.zipped_workflow_path = Path(self.args.get("")) if not self.zipped_workflow_path.is_file(): diff --git a/src/plugins/utils/gh_helpers.py b/src/plugins/utils/gh_helpers.py index 1f0e46f..bb4421a 100644 --- a/src/plugins/utils/gh_helpers.py +++ b/src/plugins/utils/gh_helpers.py @@ -19,8 +19,6 @@ from utils.logger import get_logger -import pandoc - logger = get_logger()