OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
New python.port.mk diff

From: Federico G. Schwindt (fgschlodoss.net)
Date: Tue Sep 14 2010 - 18:08:56 CDT


  Widening the audience with updated diff:

  The first bit (posted earlier) is meant to replace ::devel/py-simplejson on
ports that use json (python >= 2.6) and fallback to simplejson otherwise, like
py-zine, py-couchdb and the upcoming py-buildbot update.
  The second bit, as the comment says, try to detect the situation when a
port will build regardless of setuptools but the plist will be different if
setuptools is present as seen in ports.
  Comments? Suggestions? OKs?

  f.-

Index: python.port.mk
===================================================================
RCS file: /cvs/ports/lang/python/python.port.mk,v
retrieving revision 1.36
diff -u -r1.36 python.port.mk
--- python.port.mk 30 Aug 2010 16:35:02 -0000 1.36
+++ python.port.mk 14 Sep 2010 23:01:14 -0000
-17,6 +17,12
 .endif
 MODPYSPEC = python-${MODPY_VSPEC}
 
+.if ${MODPY_VERSION} < 2.6
+MODPY_JSON = ::devel/py-simplejson
+.else
+MODPY_JSON =
+.endif
+
 MODPY_RUN_DEPENDS= :${MODPYSPEC}:lang/python/${MODPY_VERSION}
 MODPY_LIB_DEPENDS= python${MODPY_VERSION}:${MODPYSPEC}:lang/python/${MODPY_VERSION}
 _MODPY_BUILD_DEPENDS= :${MODPYSPEC}:lang/python/${MODPY_VERSION}
-31,6 +37,7
 RUN_DEPENDS+= ${MODPY_RUN_DEPENDS}
 .endif
 
+MODPY_FAKE_SETUPTOOLS = :
 .if defined(MODPY_SETUPTOOLS) && ${MODPY_SETUPTOOLS:U} == YES
 # The setuptools module provides a package locator (site.py) that is
 # required at runtime for the pkg_resources stuff to work
-39,6 +46,17
 BUILD_DEPENDS+= ${MODPY_SETUPUTILS_DEPEND}
 # The setuptools uses test target
 REGRESS_TARGET?= test
+PYTHONUSERBASE =
+.else
+# Try to detect the case where a port will build regardless of setuptools
+# but the final plist will be different if it's present.
+MODPY_SETUPTOOLS_FAKE = \
+ ${WRKINST}/lib/python${MODPY_VERSION}/site-packages/setuptools
+MODPY_FAKE_SETUPTOOLS += \
+ ;mkdir -p ${MODPY_SETUPTOOLS_FAKE} \
+ ;echo "raise Exception('MODPY_SETUPTOOLS = Yes is required')" > \
+ ${MODPY_SETUPTOOLS_FAKE}/__init__.py
+PYTHONUSERBASE = ${WRKINST}
 .endif
 
 .if !defined(NO_SHARED_LIBS) || ${NO_SHARED_LIBS:U} != YES
-75,7 +93,7
                                 --root=${DESTDIR}
 .endif
 
-MAKE_ENV+= CC=${CC}
+MAKE_ENV+= CC=${CC} PYTHONUSERBASE=${PYTHONUSERBASE}
 CONFIGURE_ENV+= PYTHON="${MODPY_BIN}"
 
 _MODPY_CMD= cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
-87,6 +105,7
 .if empty(CONFIGURE_STYLE)
 . if !target(do-build)
 do-build:
+ ${MODPY_FAKE_SETUPTOOLS}
         ${_MODPY_CMD} ${MODPY_DISTUTILS_BUILD} ${MODPY_DISTUTILS_BUILDARGS}
         ${MODPY_POST_BUILD_BAD_EGGS}
 . endif