pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

cropsr: add shell scripts to run executables and a test



Module Name:	pkgsrc-wip
Committed By:	Brook Milligan <brook%nmsu.edu@localhost>
Pushed By:	brook
Date:		Mon Jul 3 17:04:54 2023 -0600
Changeset:	237594f73bea534facf1786436c373f28b7e3aa3

Modified Files:
	cropsr/Makefile
	cropsr/PLIST
Added Files:
	cropsr/files/cropsr
	cropsr/files/prmrdsgn2

Log Message:
cropsr: add shell scripts to run executables and a test

The cropsr executables require a library of functions, which likely
should not be installed in ${PREFIX}/bin.  Instead, move the
executables and functions to ${PREFIX}/libexec/cropsr and install
user-facing wrappers to execute them.

Add a test case as well to verify that the executables work.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=237594f73bea534facf1786436c373f28b7e3aa3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 cropsr/Makefile        | 28 ++++++++++++++++++++++++----
 cropsr/PLIST           |  8 +++++---
 cropsr/files/cropsr    |  7 +++++++
 cropsr/files/prmrdsgn2 |  7 +++++++
 4 files changed, 43 insertions(+), 7 deletions(-)

diffs:
diff --git a/cropsr/Makefile b/cropsr/Makefile
index 314ba6bfa8..558368d111 100644
--- a/cropsr/Makefile
+++ b/cropsr/Makefile
@@ -13,6 +13,7 @@ COMMENT=	Complex genome-wide CRISPR gRNA design and validation
 LICENSE=	apache-2.0
 
 WRKSRC=		${WRKDIR}/${DISTNAME}-${GITHUB_TAG}
+USE_TOOLS+=	cut diff
 USE_LANGUAGES=	# none
 NO_BUILD=	yes
 
@@ -25,16 +26,35 @@ REPLACE_PYTHON+=	CROPSR.py
 REPLACE_PYTHON+=	cropsr_functions.py
 REPLACE_PYTHON+=	prmrdsgn2.py
 
-INSTALLATION_DIRS+=	bin share/doc/cropsr share/examples/cropsr
+SUBST_CLASSES+=		prefix
+SUBST_STAGE.prefix=	pre-configure
+SUBST_FILES.prefix=	cropsr prmrdsgn2
+SUBST_VARS.prefix=	PREFIX
+
+INSTALLATION_DIRS+=	bin libexec/cropsr share/doc/cropsr share/examples/cropsr
+
+post-extract:
+	${CP} ${FILESDIR}/cropsr ${WRKSRC}
+	${CP} ${FILESDIR}/prmrdsgn2 ${WRKSRC}
 
 do-install:
-	${INSTALL_SCRIPT} ${WRKSRC}/CROPSR.py ${DESTDIR}${PREFIX}/bin
-	${INSTALL_SCRIPT} ${WRKSRC}/cropsr_functions.py ${DESTDIR}${PREFIX}/bin
-	${INSTALL_SCRIPT} ${WRKSRC}/prmrdsgn2.py ${DESTDIR}${PREFIX}/bin
+	${INSTALL_SCRIPT} ${WRKSRC}/cropsr ${DESTDIR}${PREFIX}/bin
+	${INSTALL_SCRIPT} ${WRKSRC}/prmrdsgn2 ${DESTDIR}${PREFIX}/bin
+	${INSTALL_SCRIPT} ${WRKSRC}/CROPSR.py ${DESTDIR}${PREFIX}/libexec/cropsr
+	${INSTALL_SCRIPT} ${WRKSRC}/cropsr_functions.py ${DESTDIR}${PREFIX}/libexec/cropsr
+	${INSTALL_SCRIPT} ${WRKSRC}/prmrdsgn2.py ${DESTDIR}${PREFIX}/libexec/cropsr
 	${INSTALL_DATA} ${WRKSRC}/README.md ${DESTDIR}${PREFIX}/share/doc/cropsr
 	${INSTALL_DATA} ${WRKSRC}/sample_data/output.csv ${DESTDIR}${PREFIX}/share/examples/cropsr
 	${INSTALL_DATA} ${WRKSRC}/sample_data/sample_genome.fa ${DESTDIR}${PREFIX}/share/examples/cropsr
 	${INSTALL_DATA} ${WRKSRC}/sample_data/sample_genome.gff ${DESTDIR}${PREFIX}/share/examples/cropsr
 
+do-test:
+	${DESTDIR}${PREFIX}/libexec/cropsr/CROPSR.py -h
+	${DESTDIR}${PREFIX}/libexec/cropsr/CROPSR.py --cas9 --fasta ${WRKSRC}/sample_data/sample_genome.fa --gff ${WRKSRC}/sample_data/sample_genome.gff --output /tmp/output.csv
+	${CUT} -f 2- -d ',' < ${WRKSRC}/sample_data/output.csv > /tmp/output1.csv
+	${CUT} -f 2- -d ',' < /tmp/output.csv > /tmp/output2.csv
+	@${ECHO} "NOTE: there should be at most a few rounding differences to the scores"
+	${DIFF} -u /tmp/output1.csv /tmp/output2.csv
+
 .include "../../lang/python/application.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/cropsr/PLIST b/cropsr/PLIST
index 4ba1a07aeb..42e2897921 100644
--- a/cropsr/PLIST
+++ b/cropsr/PLIST
@@ -1,7 +1,9 @@
 @comment $NetBSD$
-bin/CROPSR.py
-bin/cropsr_functions.py
-bin/prmrdsgn2.py
+bin/cropsr
+bin/prmrdsgn2
+libexec/cropsr/CROPSR.py
+libexec/cropsr/cropsr_functions.py
+libexec/cropsr/prmrdsgn2.py
 share/doc/cropsr/README.md
 share/examples/cropsr/output.csv
 share/examples/cropsr/sample_genome.fa
diff --git a/cropsr/files/cropsr b/cropsr/files/cropsr
new file mode 100755
index 0000000000..01da20ec47
--- /dev/null
+++ b/cropsr/files/cropsr
@@ -0,0 +1,7 @@
+#!/bin/sh
+# $NetBSD$
+
+LIBEXEC=@PREFIX@/libexec
+CROPSR=${LIBEXEC}/cropsr/CROPSR.py
+
+exec ${CROPSR} ${*}
diff --git a/cropsr/files/prmrdsgn2 b/cropsr/files/prmrdsgn2
new file mode 100755
index 0000000000..0220082ff4
--- /dev/null
+++ b/cropsr/files/prmrdsgn2
@@ -0,0 +1,7 @@
+#!/bin/sh
+# $NetBSD$
+
+LIBEXEC=@PREFIX@/libexec
+PRMRDSGN2=${LIBEXEC}/cropsr/prmrdsgn2.py
+
+exec ${PRMRDSGN2} ${*}


Home | Main Index | Thread Index | Old Index