Page MenuHomeFreeBSD

Mk/Uses/python.mk: Add support for optional 'test' argument
ClosedPublic

Authored by brendan_freebsd_bbqsrc.net on Dec 26 2015, 7:59 AM.

Details

Summary

Some ports may wish to use Python for their testing suite but otherwise do not need it at all (ie, not for build or run). This patch adds support for the test argument to be used in the USES clause, such as python:3.2+,test. This enables the relevant Python environment and modifies TEST_DEPENDS as necessary.

Test Plan

For non-Python ports that use Python as their testing suite, add python:VER,test as required to the USES clause and observe output.

An example of this in use (as requested by koobs):

# Created by: Gea-Suan Lin <gslin@gslin.org>
# $FreeBSD: head/sysutils/fusefs-unionfs/Makefile 380917 2015-03-10 14:15:55Z amdmi3 $

PORTNAME=	unionfs
PORTVERSION=	1.0
DISTVERSIONPREFIX=	v
CATEGORIES=	sysutils
PKGNAMEPREFIX=	fusefs-

MAINTAINER=	brendan+freebsd@bbqsrc.net
COMMENT=	FUSE based implementation of the well-known unionfs

LICENSE=	BSD3CLAUSE
LICENSE_FILE=	${WRKSRC}/LICENSE

USE_GITHUB=	yes
GH_ACCOUNT=	rpodgorny
GH_PROJECT=	unionfs-fuse

PLIST_FILES=	bin/unionfs \
		bin/unionfsctl \
		man/man8/unionfs.8.gz

USES=		python:3.2+,test fuse cmake localbase

post-patch:
	@${REINPLACE_CMD} "s,share/man,man,g" ${WRKSRC}/man/CMakeLists.txt

do-test:
	@cd ${WRKSRC} && ${PYTHON_CMD} test.py

post-install:
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/*

.include <bsd.port.mk>

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

brendan_freebsd_bbqsrc.net retitled this revision from to Mk/Uses/python.mk: Add support for optional 'test' argument.
brendan_freebsd_bbqsrc.net updated this object.
brendan_freebsd_bbqsrc.net edited the test plan for this revision. (Show Details)
brendan_freebsd_bbqsrc.net set the repository for this revision to rP FreeBSD ports repository.
brendan_freebsd_bbqsrc.net added a subscriber: Python.
koobs added a subscriber: koobs.

Adding marcus, sofian and antoine as reviewers

koobs requested changes to this revision.Dec 26 2015, 8:05 AM
koobs added a reviewer: koobs.
koobs added inline comments.
Mk/Uses/python.mk
473 ↗(On Diff #11696)

This can go (be removed) in favour of the (test) dependent port adding setuptools to its TEST_DEPENDS manually if it explicitly requires it, or another Python package

This revision now requires changes to proceed.Dec 26 2015, 8:05 AM
koobs accepted this revision.Dec 26 2015, 8:13 AM
koobs edited edge metadata.

I'm +1 on this feature, and I know many software packages use python for running their tests

I don't have the chops to review the change semantically.

brendan_freebsd_bbqsrc.net edited edge metadata.
brendan_freebsd_bbqsrc.net marked an inline comment as done.

Removed unnecessary setuptools dependency for test.

koobs accepted this revision.Dec 26 2015, 8:16 AM
koobs edited edge metadata.
koobs awarded a token.
brendan_freebsd_bbqsrc.net edited the test plan for this revision. (Show Details)Dec 26 2015, 2:05 PM
brendan_freebsd_bbqsrc.net edited edge metadata.
mat accepted this revision.Dec 26 2015, 2:26 PM
mat added a reviewer: mat.
mat added a subscriber: mat.

Macro lgtm:  Macro shipit:

This revision is now accepted and ready to land.Dec 26 2015, 2:26 PM
koobs requested changes to this revision.Dec 26 2015, 2:43 PM
koobs edited edge metadata.
koobs added inline comments.
Mk/Uses/python.mk
29 ↗(On Diff #11697)

Indicates

30 ↗(On Diff #11697)

s/as/to

32 ↗(On Diff #11697)

s/as/to

This revision now requires changes to proceed.Dec 26 2015, 2:43 PM
koobs accepted this revision.Dec 26 2015, 2:53 PM
koobs edited edge metadata.
This revision is now accepted and ready to land.Dec 26 2015, 2:53 PM
koobs added a comment.Jan 2 2016, 8:34 AM

I need this for deskutils/taskwarrior, which depends on any version of Python for its tests

brendan_freebsd_bbqsrc.net edited edge metadata.
brendan_freebsd_bbqsrc.net marked 3 inline comments as done.

Fixed some documentation issues

This revision now requires review to proceed.Jan 2 2016, 10:18 AM
koobs accepted this revision.Jan 2 2016, 2:09 PM
koobs edited edge metadata.

Again, looks good to me (non make syntax/semantics)

This revision is now accepted and ready to land.Jan 2 2016, 2:09 PM
miwi accepted this revision.Jan 2 2016, 2:11 PM
miwi added a reviewer: miwi.
This revision was automatically updated to reflect the committed changes.