From 5326d326fedbe0bd978aa3ec22e587c88e9a1ab6 Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Sun, 14 Apr 2019 19:55:35 +0100 Subject: [PATCH] scripts/printversion.sh: accept PRISM source directory as argument Rather than overriding the default path to the PRISM source directory by setting the PRISM_SRC_DIR environment variable, do so by supplying an argument to the script. --- prism/Makefile | 2 +- prism/src/scripts/printversion.sh | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/prism/Makefile b/prism/Makefile index 175cae5c..f1877073 100644 --- a/prism/Makefile +++ b/prism/Makefile @@ -550,7 +550,7 @@ clean_doc: # Set up version, in particular for building releases # Unless VERSION has been passed in (as VERSION=xxx), # extract version number from Java code using printversion -VERSION = $(shell PRISM_SRC_DIR=$(PRISM_SRC_DIR) $(PRISM_SRC_DIR)/scripts/printversion.sh 2> /dev/null) +VERSION = $(shell $(PRISM_SRC_DIR)/scripts/printversion.sh $(PRISM_SRC_DIR) 2> /dev/null) # Default branch for building source releases BRANCH = master diff --git a/prism/src/scripts/printversion.sh b/prism/src/scripts/printversion.sh index 10f87f86..986d93fa 100755 --- a/prism/src/scripts/printversion.sh +++ b/prism/src/scripts/printversion.sh @@ -4,13 +4,11 @@ # based on extraction of the info from Java files. # Mirrors what is done (in Java) in prism.getVersion(). -# If given, PRISM_SRC_DIR is assumed to point to the -# "src" directory in a PRISM source distribution. The -# default is just "src". +# If given, the first argument to the script is assumed +# to point to the "src" directory in a PRISM source +# distribution. The default is just "src". -if [ "$PRISM_SRC_DIR" = "" ]; then - PRISM_SRC_DIR=src; -fi +PRISM_SRC_DIR="${1:-src}" if [ -f "$PRISM_SRC_DIR"/prism/Version.java ]; then VERSION_NUM=`grep versionString "$PRISM_SRC_DIR"/prism/Version.java | sed -E 's/[^"]+"([^"]+)"[^"]+/\1/'`