Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Mar 2002 05:36:16 +0900 (KST)
From:      Hye-Shik Chang <perky@fallin.lv>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/36537: bsd.python.mk: Add USE_PYDISTUTILS shorthand
Message-ID:  <200203302036.g2UKaGdR079168@akaraka.yonsei.ac.kr>

next in thread | raw e-mail | index | archive | help

>Number:         36537
>Category:       ports
>Synopsis:       bsd.python.mk: Add USE_PYDISTUTILS shorthand
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 30 08:50:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Hye-Shik Chang
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Yonsei University
>Environment:
System: FreeBSD akaraka.yonsei.ac.kr 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Thu Mar 28 00:43:31 KST 2002 root@akaraka.yonsei.ac.kr:/usr/src/sys/i386/compile/JOARRA i386

>Description:
Toooo many python-related ports has same codes for distutils.
attached USE_PYDISTUTILS patch (comments are very poor. sorry)

and one additional patch for net/py-snmp just as testing sample.

(NetBSD has this trigger already.)

>How-To-Repeat:
>Fix:

--- bsd.port.mk.orig	Sun Mar 31 05:06:37 2002
+++ bsd.port.mk	Sun Mar 31 05:10:26 2002
@@ -778,7 +778,7 @@
 .include "${PORTSDIR}/Mk/bsd.emacs.mk"
 .endif
 
-.if defined(USE_PYTHON) || defined(PYTHON_VERSION)
+.if defined(USE_PYTHON) || defined(PYTHON_VERSION) || defined(USE_PYDISTUTILS)
 .include "${PORTSDIR}/Mk/bsd.python.mk"
 .endif
 
@@ -1035,6 +1035,10 @@
 .if defined(GNU_CONFIGURE)
 CONFIGURE_ARGS+=--x-libraries=${X11BASE}/lib --x-includes=${X11BASE}/include
 .endif
+.endif
+
+.if defined(USE_PYTHON) || defined(PYTHON_VERSION) || defined(USE_PYDISTUTILS)
+.include "${PORTSDIR}/Mk/bsd.python.mk"
 .endif
 
 .include "${PORTSDIR}/Mk/bsd.gnome.mk"
--- bsd.python.mk.orig	Sun Mar 31 03:34:14 2002
+++ bsd.python.mk	Sun Mar 31 05:18:53 2002
@@ -4,16 +4,16 @@
 # $FreeBSD: ports/Mk/bsd.python.mk,v 1.19 2002/01/22 12:53:27 tg Exp $
 #
 
-.if !defined(Python_Include)
+.if !defined(_POSTMKINCLUDED) && !defined(Python_Pre_Include)
 
-Python_Include=				bsd.python.mk
+Python_Pre_Include=			bsd.python.mk
 Python_Include_MAINTAINER=	tg@FreeBSD.org
 
 # This file contains some variable definitions that are supposed to
 # make your life easier when dealing with ports related to the Python
-# language. It's automatically included when USE_PYTHON or PYTHON_VERSION
-# is defined in the ports' makefile. Define PYTHON_VERSION to override the
-# defaults that USE_PYTHON would give you.
+# language. It's automatically included when USE_PYTHON, PYTHON_VERSION or
+# USE_PYDISTUTILS is defined in the ports' makefile. Define PYTHON_VERSION
+# to override the defaults that USE_PYTHON would give you.
 #
 # The variables:
 #
@@ -71,6 +71,13 @@
 #
 # PYXML:		Dependency line for the XML entension. As of Python-2.0,
 #				this extension is in the base distribution.
+#
+# USE_PYDISTUTILS:	Use distutils as do-build and do-install target.
+#
+# PYDISTUTILS_BUILDARGS:	Arguments to build with distutils.
+#
+# PYDISTUTILS_INSTALLARGS:	Arguments to install with distutils.
+#
 
 # XXX Ugly hack, but running python is the best way to determine the
 # currently installed version. If Python is not installed, a default 
@@ -161,6 +168,7 @@
 PYTHON_PKGNAMEPREFIX=	py${PYTHON_SUFFIX}-
 PYTHON_PLATFORM!=		expr ${OPSYS:L}${OSREL} : '\(.*\)\.'
 PYTHON_SITELIBDIR=		${PYTHON_LIBDIR}/site-packages
+PYDISTUTILS_INSTALLARGS?=	-c -O1 --prefix=${PREFIX}
 
 # dependencies
 PYTHON_NO_DEPENDS?=		NO
@@ -168,7 +176,11 @@
 .if ${PYTHON_NO_DEPENDS} == "NO"
 BUILD_DEPENDS+=	${PYTHON_CMD}:${PYTHON_PORTSDIR}
 RUN_DEPENDS+=	${PYTHON_CMD}:${PYTHON_PORTSDIR}
+
+.if defined(USE_PYDISTUTILS) && ${PYTHON_REL} < 200
+BUILD_DEPENDS+=	${PYDISTUTILS}
 .endif
+.endif		# ${PYTHON_NO_DEPENDS} == "NO"
 
 # pkg/PLIST substrings
 PLIST_SUB+=		PYTHON_VERSION=${PYTHON_VERSION} \
@@ -176,4 +188,24 @@
 
 # XXX Hm, should I export some of the variables above to *_ENV?
 
-.endif		# !defined(Python_Include)
+.endif		# !defined(_POSTMKINCLUDED) && !defined(Python_Pre_Include)
+
+
+.if defined(_POSTMKINCLUDED) && !defined(Python_Post_Include)
+
+Python_Post_Include=			bsd.python.mk
+
+# py-distutils support
+.if defined(USE_PYDISTUTILS)
+.if !target(do-build)
+do-build:
+	@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} setup.py build ${PYDISTUTILS_BUILDARGS})
+.endif
+
+.if !target(do-install)
+do-install:
+	@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} setup.py install ${PYDISTUTILS_INSTALLARGS})
+.endif
+.endif		# defined(USE_PYDISTUTILS)
+
+.endif		# defined(_POSTMKINCLUDED) && !defined(Python_Post_Include)
diff -ruN py-snmp.orig/Makefile py-snmp/Makefile
--- py-snmp.orig/Makefile	Wed Mar 27 03:08:35 2002
+++ py-snmp/Makefile	Sun Mar 31 05:11:20 2002
@@ -15,18 +15,12 @@
 
 MAINTAINER=	perky@fallin.lv
 
-USE_PYTHON=	yes
+USE_PYDISTUTILS=yes
 EXAMPLESDIR=	${PREFIX}/share/examples/py-snmp
 DOCSDIR=	${PREFIX}/share/doc/py-snmp
-SETUP_CMD=	cd ${WRKSRC} && ${PYTHON_CMD} setup.py
-
-do-build:
-	${SETUP_CMD} build
-
-do-install:
-	${SETUP_CMD} install -c -O1 --prefix=${PREFIX}
 
 .if !defined(NOPORTDOCS)
+post-install:
 	${MKDIR} ${EXAMPLESDIR}
 	${INSTALL_SCRIPT} ${WRKSRC}/examples/* ${EXAMPLESDIR}
 	${MKDIR} ${DOCSDIR}
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203302036.g2UKaGdR079168>