I have an error whilst making a port, so I checked the makefile, and found the problematic line.

The issue is that I don't know how to fix it, as I don't know how to change the Python_Rel variable.

Where is this located and how do I change it?


It is defined in an include-file read by the make program, e.g., by this line at the end of the port makefile:

.include <bsd.port.mk>

On my FreeBSD 10 system, the include-files are in /usr/ports/Mk, and grep finds these matches:

$ fgrep -n PYTHON_REL *
bsd.python.mk:70:# PYTHON_REL           - Version number in numerical format, to ease
bsd.python.mk:353:PYTHON_REL=           341
bsd.python.mk:364:PYTHON_REL=           335
bsd.python.mk:375:PYTHON_REL=           325
bsd.python.mk:386:PYTHON_REL=           278
bsd.python.mk:394:PYTHON_REL!=          ${PYTHON_CMD} -c 'import sys; h = "%x" % sys.hexversion; \
bsd.python.mk:505:      defined(PYTHON_REL)
bsd.python.mk:553:.if ${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK)
bsd.python.mk:569:.endif # ${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK)

and bsd.python.mk is included conditionally (grep is your friend):

$ fgrep -n bsd.python.mk *
bsd.port.mk:398:#                                 Implies inclusion of bsd.python.mk. (Also see
bsd.port.mk:1446:.include "${PORTSDIR}/Mk/bsd.python.mk"
bsd.port.mk:1893:.include "${PORTSDIR}/Mk/bsd.python.mk"
bsd.python.mk:4:# $FreeBSD: head/Mk/bsd.python.mk 362364 2014-07-20 19:47:45Z antoine $
bsd.python.mk:9:Python_Pre_Include=             bsd.python.mk
bsd.python.mk:630:Python_Post_Include=                  bsd.python.mk
bsd.wx.mk:11:# variables (e.g. USE_PYTHON) are defined before it (this is a bsd.python.mk

and the comment in that file says

# USE_PYTHON    - If set, this port relies on the Python language. 
#                                 Implies inclusion of bsd.python.mk. (Also see 
#                                 that file for more information on USE_PYTHON_*
#                                 and USE_PYDISTUTILS). 

and it uses the setting like this:

.if defined(USE_PYTHON) || defined(USE_PYTHON_BUILD) || defined(USE_PYTHON_RUN) 
.include "${PORTSDIR}/Mk/bsd.python.mk"

So the short answer is that your port makefile is missing one of the settings needed to include the file which defined PYTHON_REL, e.g.,


There's a nice README file at the top of the ports tree, showing where detailed information can be found.

In working with ports, you might want to keep track of changes made. For instance, bsd.python.mk was updated later, according to the FreeBSD ports-wiki:

Split bsd.python.mk into a USES for consumer ports and an port-tree specific .mk file (20140809: Commit r364450)

and the PYTHON_REL variable appears to have been regarded as obsolete, since it was no longer defined after that commit (see file).

If it's important to your port, you could construct that variable with something like

  • I ran fgrep -n PYTHON_REL * ; in the /usr/ports/Mk/ directory, but it returned nothing. Additionally, an ls of the directory does not reveal any bsd.python.mk – Brandon Bradley Jun 4 '16 at 18:30
  • is that in the makefile? How would I set it to use /usr/local/bin/python 2.7 ? – Brandon Bradley Jun 5 '16 at 0:00
  • There's a PYTHON2_DEFAULT symbol as well. You could investigate how it is set in your copy of the ports, and set PYTHON_REL using that. – Thomas Dickey Jun 5 '16 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.