Bug 240634 - lang/rust: Rust build uses Python 2.7 on system that has Python 3.6 as default Python version
Summary: lang/rust: Rust build uses Python 2.7 on system that has Python 3.6 as defaul...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Rust Team
Depends on:
Reported: 2019-09-17 10:23 UTC by Vincent Bentley
Modified: 2019-09-27 09:40 UTC (History)
3 users (show)

See Also:
tobik: maintainer-feedback+


Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Bentley 2019-09-17 10:23:09 UTC
The maintenance period of Python 2.7 ends on 1 January 2020.

I noticed that building Rust under Poudriere on FreeBSD 12.0p10 uses Python 2.7 even when the build host has been configured to default to Python 3.6 .

Using Python 2.7 does not prevent building Rust successfully in 2019 but it may become an issue in three and a half months time.

Excerpts from Poudriere build log for Rust...

MAKE=gmake PKG_CONFIG=pkgconf PYTHON="/usr/local/bin/python2.7" XDG_DATA_HOME=/wrkdirs/usr/ports/lang/rust/work  XDG_CONFIG_HOME=/wrkdirs/usr/ports/lang/rust/work  HOME=/wrkdirs/usr/ports/lang/rust/work TMPDIR="/tmp" PATH=/wrkdirs/usr/ports/lang/rust/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin SHELL=/bin/sh CONFIG_SHELL=/bin/sh CMAKE_PREFIX_PATH="/usr/local"


RUST_TARGET=x86_64-unknown-freebsd PORTDOCS="" PYTHON_INCLUDEDIR=include/python2.7  PYTHON_LIBDIR=lib/python2.7  PYTHON_PLATFORM=freebsd12  PYTHON_SITELIBDIR=lib/python2.7/site-packages  PYTHON_SUFFIX=27  PYTHON_VER=2.7  PYTHON_VERSION=python2.7 PYTHON2="" PYTHON3="@comment " OSREL=12.0 PREFIX=%D LOCALBASE=/usr/local  RESETPREFIX=/usr/local LIB32DIR=lib DOCSDIR="share/doc/rust"  EXAMPLESDIR="share/examples/rust"  DATADIR="share/rust"  WWWDIR="www/rust"  ETCDIR="etc/rust"


===>   Returning to build of rust-1.37.0
===>   rust-1.37.0 depends on file: /usr/local/bin/python2.7 - not found
===>   Installing existing package /packages/All/python27-2.7.16_1.txz
[s205] Installing python27-2.7.16_1...
[s205] `-- Installing libffi-3.2.1_3...
[s205] `-- Extracting libffi-3.2.1_3: .......... done
[s205] Extracting python27-2.7.16_1: .......... done


=======================<phase: build          >============================
===>  Building for rust-1.37.0
cd /wrkdirs/usr/ports/lang/rust/work/rustc-1.37.0-src &&  /usr/bin/env HOME="/wrkdirs/usr/ports/lang/rust/work"  LIBGIT2_SYS_USE_PKG_CONFIG=1  LIBSSH2_SYS_USE_PKG_CONFIG=1  OPENSSL_DIR="/usr"  /usr/local/bin/python2.7 /wrkdirs/usr/ports/lang/rust/work/rustc-1.37.0-src/x.py build  --verbose  --config ./config.toml  --jobs 4
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-17 10:41:40 UTC
Thank you for the report Vincent

For context DEFAULT_VERSIONS are *just* defaults, there is nothing precluding particular ports from specifying versions of Python that they support, that don't match the defaults.

In rusts case, the port currently specifies "python:2.7", which should either mean "only supports 2.7" or in case a particular version is currently (temporarily) broken, "only use 2.7". In either case at present, its 'correct and intentional behaviour' for the port to use Python 2.7.

If however, rust otherwise supports other Python versions and the port has not correctly or completely declared Python version support (in its USES=python:<version-spec>), or is unnecessarily restricting <version-spec>, that's a bug.
Comment 2 Tobias Kortkamp freebsd_committer 2019-09-27 09:40:49 UTC
Switched to USES=python:build in ports r513013.