On Wed, Sep 15, 2010 at 01:17:08AM +0100, Federico G. Schwindt wrote: > On Wed, Sep 15, 2010 at 12:08:56AM +0100, Federico G. Schwindt wrote: > > > > 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 po...@. > > Comments? Suggestions? OKs? > > New version that should work better. I've renamed a few variables > for clarity as well and prefixed the message with 'OpenBSD ports:' > as suggested by st...@.
And hopefully the final version that covers more stuff I found. Sorry for the spam. If there is anything else to fake we can add it in the tree. 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 15 Sep 2010 00:58:04 -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,20 @@ BUILD_DEPENDS+= ${MODPY_SETUPUTILS_DEPEND} # The setuptools uses test target REGRESS_TARGET?= test +_MODPY_USERBASE = +.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_DIR = \ + ${WRKINST}/lib/python${MODPY_VERSION}/site-packages/setuptools +MODPY_FAKE_SETUPTOOLS += \ + ;mkdir -p ${_MODPY_SETUPTOOLS_FAKE_DIR} \ + ;exec >${_MODPY_SETUPTOOLS_FAKE_DIR}/__init__.py \ + ;echo 'def setup(*args, **kwargs):' \ + ;echo ' msg = "OpenBSD ports: MODPY_SETUPTOOLS = Yes is required"' \ + ;echo ' raise Exception(msg)' \ + ;echo 'Extension = Feature = find_packages = setup' +_MODPY_USERBASE = ${WRKINST} .endif .if !defined(NO_SHARED_LIBS) || ${NO_SHARED_LIBS:U} != YES @@ -75,7 +96,7 @@ --root=${DESTDIR} .endif -MAKE_ENV+= CC=${CC} +MAKE_ENV+= CC=${CC} PYTHONUSERBASE=${_MODPY_USERBASE} CONFIGURE_ENV+= PYTHON="${MODPY_BIN}" _MODPY_CMD= @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \ @@ -87,6 +108,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