Page MenuHomeFreeBSD

Reuse USE_PYTHON instead of PYTHON_FEATURES
ClosedPublic

Authored by mva on Aug 11 2014, 9:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jun 17, 6:58 AM
Unknown Object (File)
Sun, Jun 15, 2:56 PM
Unknown Object (File)
Sun, Jun 15, 2:24 PM
Unknown Object (File)
Sun, Jun 15, 6:23 AM
Unknown Object (File)
Tue, Jun 10, 9:04 AM
Unknown Object (File)
Wed, Jun 4, 8:35 PM
Unknown Object (File)
May 8 2025, 1:37 PM
Unknown Object (File)
Apr 22 2025, 11:33 PM
Subscribers

Details

Reviewers
danfe
antoine
makc
Group Reviewers
portmgr
Python
Summary

As discussed on the different mailing lists, this is an experimental, untested patch to reuse USE_PYTHON instead of using PYTHON_FEATURES.

Test Plan
  • 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

mva retitled this revision from to Reuse USE_PYTHON instead of PYTHON_FEATURES.
mva updated this object.
mva edited the test plan for this revision. (Show Details)
mva added reviewers: Python, portmgr, danfe, makc.
mva set the repository for this revision to rP FreeBSD ports repository.
  1. 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
  2. Maybe replace ${USE_PYTHON:tW:M*[1-9].[0-9]*} != "" with something more clear, e.g. ${USE_PYTHON:C/[-0-9.+]*//} (untested)?
antoine added inline comments.
Mk/Uses/python.mk
262

I believe old freebsd make doesn't understand :tW

Mk/Uses/python.mk
262

I'll give @danfe's ${USE_PYTHON:C/[-0-9.+]*//} a try later on

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
.endif

Thus, .if ${USES:Mpython} is always valid.

In D581#11, @danfe wrote:

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
.endif

Thus, .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?

mva edited the test plan for this revision. (Show Details)
mva edited edge metadata.
  • 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
mva edited edge metadata.
  • Fix deprecation warnings for already converted ports
  • 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
  • we .undef USE_PYTHON, so make sure that python_ARGS expands USE_PYTHON
antoine added a reviewer: antoine.

No regression in the exp-runs

This revision is now accepted and ready to land.Aug 13 2014, 10:20 AM