From 9929338062ca0bf39e950c01a4605a02fbcbd74e Mon Sep 17 00:00:00 2001
From: Johann Visagie <wjv@FreeBSD.org>
Date: Fri, 12 Apr 2002 09:38:20 +0000
Subject: - Add a PKGREQ script to limit dependency to Python 2.0 and greater.
 - Bump PORTREVISION (again, sorry)

---
 textproc/py-asv/Makefile |  5 ++++-
 textproc/py-asv/pkg-req  | 17 +++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 textproc/py-asv/pkg-req

(limited to 'textproc')

diff --git a/textproc/py-asv/Makefile b/textproc/py-asv/Makefile
index d7da90d8bbb6..0de74db32593 100644
--- a/textproc/py-asv/Makefile
+++ b/textproc/py-asv/Makefile
@@ -7,7 +7,7 @@
 
 PORTNAME=	asv
 PORTVERSION=	0.4
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	textproc python
 MASTER_SITES=	http://tratt.net/laurie/python/asv/releases/
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -22,6 +22,9 @@ do-build:
 	@${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py ${WRKSRC}
 	@${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py ${WRKSRC}
 
+pre-install:
+	@ ${SH} ${PKGREQ} INSTALL
+
 do-install:
 	@printf '#!/bin/sh\n${PYTHON_CMD} ${ASV_BASEDIR}/ASV.py "$$@"\n' \
 		> ${WRKDIR}/asv.sh
diff --git a/textproc/py-asv/pkg-req b/textproc/py-asv/pkg-req
new file mode 100644
index 000000000000..bf09a351750d
--- /dev/null
+++ b/textproc/py-asv/pkg-req
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+PATH=$PATH:/usr/local/bin
+
+if [ "x$1" = "xINSTALL" -o "x$2" = "xINSTALL" ]; then
+  PYTHON_GT=`python -c 'import string, sys; \
+                        print string.split(sys.version)[0] >= "2.0"'`
+  if [ "x${PYTHON_GT}" = "x1" ]; then
+    exit 0
+  else
+    echo "-----------------------------------------------------------"
+    echo "ASV requires Python version 2.0 or greater -"
+    echo "  please update your Python installation before proceeding."
+    echo "-----------------------------------------------------------"
+    exit 1
+  fi
+fi
-- 
cgit v1.2.3