As discussed on the different mailing lists, this is an experimental, untested patch to reuse USE_PYTHON instead of using PYTHON_FEATURES.
Details
- Test with USE_PYTHON=yes
- Test with USE_PYTHON=2 and USE_PYTHON=3
- Test with USE_PYTHON_BUILD and USE_PYTHON_RUN
- Test with USE_PYTHON=build and USE_PYTHON=run
- Test with USE_PYTHON= X.Y
- Test with USE_PYTHON= -X.Y
- Test with USE_PYTHON= X.Y+
- Test with USE_PYTHON= X.Y-
- Test with USE_PYTHON= X.Y-Z.A
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
- build or run never were valid values for USE_PYTHON (legacy implementation only cared if it is defined or not); there are two ports remain that incorrectly set it which I intend to fix today
- Maybe replace ${USE_PYTHON:tW:M*[1-9].[0-9]*} != "" with something more clear, e.g. ${USE_PYTHON:C/[-0-9.+]*//} (untested)?
Mk/Uses/python.mk | ||
---|---|---|
262 | I believe old freebsd make doesn't understand :tW |
Mk/Uses/python.mk | ||
---|---|---|
262 | In this case you can also remove checks for numbers 2 and 3 and only check for lettered values (like yes) in the code above. It also makes more sense as now all versions are checked in one place while other imperatives in another. |
Hm.
Isn't there a way to check if we have USES=python to detect the old format instead of values?
Something like:
.if ${USES:Mpython}
_PY_COMPAT_OLD= no
.else
_PY_COMPAT_OLD= yes
.endif
Yes it looks natural, but @mva had explained it earlier:
The problem is a bit more complex. bsd.perl.mk was a fixed include in
bsd.port.mk prior to the conversion, while bsd.python.mk was and is not.
The compat code in bsd.port.mk right now does the following:.if defined(USE_PYTHON) ...
USES+= python
.endifThus, .if ${USES:Mpython} is always valid.
I still don't get it...
.if defined(USE_PYTHON) && ! ${USES:Mpython}
_PY_COMPAT_OLD= yes
USES+= python
.endif
Wouldn't something like that work?
- Use @danfe's approach to check for USE_PYTHON=[version]
- Fix RUN/BUILD indicators for USE_PYTHON_RUN and USE_PYTHON_BUILD
- Preserve the original USE_PYTHON value in bsd.sanity.mk to print a proper warning
Basic functionality verfied with
- devel/py-enum34 USE_PYTHON=2.7-3.3
- devel/py-yaml USE_PYTHON=yes
- devel/py-RPyC USE_PYTHON=-3.3
- devel/py-asyncio USE_PYTHON=3.3+
- devel/cut USE_PYTHON_RUN
- devel/zziplib USE_PYTHON_BUILD
- Fix the BUILD/RUN_DEPENDS behaviour, if USE_PYTHON_BUILD and USE_PYTHON_RUN are defined (yes, there are a few...)
- Convert PYTHON_FEATURES of already migrated ports to USE_PYTHON