On Sat, Dec 10, 2011 at 6:49 AM, Remi Pointel <[email protected]> wrote: > Hi, > > I reworked on the diff to update python.port.mk to permit to have both Python > 2.x and 3.x working on OpenBSD. > > How it works: > 1) Python2 port > - all ports existing don't need to change, they still build with Python 2 > > 2) Python2 and Python3 port > - if you know that a port (and its dependencies...) work with Python 3 && > Python 2, you just need to add: > FLAVORS ?= python3 > Be carefull to add ${MODPY_FLAVOR} to your dependencies (see examples at the > end). > Next, to build your port you will need to precise the correct flavor: python3. > > In this case, you must be very carreful with the conflict of the PLIST. If > your port is a library, there is often no problems, but you will have problem > with binaries/doc/examples/wub/... > So you will have to "play" with post-install, in moving files which are > conflicting by suffixing it (see examples at the end). > FYI the port built with python3 will replace the prefix py- by py3-. > > 3) Python3 port > - if you know that a port (and its dependencies) work with Python 3 only, you > just need to add: > MODPY_VERSION = ${MODPY_DEFAULT_VERSION3} and it will automatically build > this port with Python 3. > FYI the port built with python3 follow the same logic that in python2, so if > the port PKGNAME begins with py- it will automatically be replaced by py3-. > > > More details about modifications needed in the ports tree: > - remove the devel/py3-distribute, not used and useless to have py3 in the > dir name (maybe a quirks thing to permit distribute -> py3-distribute? If not > used actually, are modifications in quirks needed?) > - some people don't want to replace py-setuptools by py-distribute, so keep > py-setuptools (Python 2 only). > - add the port devel/py-distribute, only used with Python3 ports > (MODPY_VERSION = ${MODPY_DEFAULT_VERSION3}, will have the py3-distribute > FULLPKGNAME. > - remove the MODPY_DISTRIBUTE, useless. Keep the MODPY_SETUPTOOLS only, > easier to maintain, even if we used distribute or setuptools after, it's not > the problem of the porters. > > > So, if your ports use: > 1) Python 2 only > - nothing to change > > 2) Python 2 and Python 3: > - add FLAVORS ?= python3 > - add to your *_DEPENDS : ${MODPY_FLAVOR}, without comma (example: > BUILD_DEPENDS: devel/py-distribute${MODPY_FLAVOR}). > - make sure your PLIST will not be in conflict by adding special tasks in > post-install. Example: > post-install: > .if defined(MODPY_DOC_PREFIX) > mv ${WRKINST}/${LOCALBASE}/share/doc/py-foo/ > ${WRKINST}/${LOCALBASE}/share/doc/py${MODPY_DOC_PREFIX}-foo/ > .endif > > If you use the default FLAVOR (Python 2), MODPY_BIN_SUFFIX is "", > MODPY_DOC_PREFIX is "" so there is no modification for people who use the > default. > If you use the FLAVOR Python 3, MODPY_BIN_SUFFIX = -3, MODPY_DOC_PREFIX = 3. > Idea is to add a suffix to binary to be easier to find the command with > auto-completion. > Add ${MODPY_BIN_SUFFIX} and ${MODPY_DOC_PREFIX} to your PLIST. > > 3) Python 3: > - add MODPY_VERSION = ${MODPY_DEFAULT_VERSION3}
MODPY_DOC_PREFIX is a poor name as anything outside site-packages (where version is not explicit) should be using this. Also I believe if you change it to use py- or py3- (instead of just "" or 3) you can get this automatically substituted in your PLIST. Finally, can you add a "_" in MODPY_DEFAULT_VERSIONX before 2 and 3? It easy to mix the number otherwise. f.-
