diff options
author | Tobias C. Berner <tcberner@FreeBSD.org> | 2023-07-22 06:16:46 +0000 |
---|---|---|
committer | Tobias C. Berner <tcberner@FreeBSD.org> | 2023-07-22 07:46:38 +0000 |
commit | 7bb64b89d0e5ec8d77b28f8341269ffbad279ebf (patch) | |
tree | 91b64beb7ba38225bbc39c2734cbe4868c74be86 | |
parent | 173ac9651cc9ef0ab952b29e4cffa56d28e8770b (diff) |
framework: add Mk/Uses/pycryptography
With the added new DEFAULT_VERSION "PYCRYPTOGRAHY_DEFAULT=rust|legacy"
it is important to transparently depend on the right one.
This is the job of this new uses.
So instead of manually adding dependency lines like
RUN_DEPENDS=${PYTHON_PKGNAMEPREFIX}cryptography>0:security/py-cryptography@${PY_FLAVOR}
this should now be
USES=pycryptography:run
Supported arguments: <none>,build,run,test
If no argument is given, it defaults to 'build,run'.
A future commit will update to security/py-cryptography will introduce a
rust dependency.
PR: 254853
-rw-r--r-- | CHANGES | 20 | ||||
-rw-r--r-- | Mk/Uses/pycryptography.mk | 46 |
2 files changed, 66 insertions, 0 deletions
@@ -10,6 +10,26 @@ in the release notes and/or placed into UPDATING. All ports committers are allowed to commit to this file. +20230722: +AUTHOR: tcberner@FreeBSD.org + + A new uses 'pycryptography' has been added to transparently depend on the + proper variant of 'rust' or 'legacy' depending on the default version set + by the user. + + Supported arguments: <none>,build,run + Passing no arguments (<none>) is equivalent to passing both build and run. + + Usage: + USES=pycryptography:build + -> adds a BUILD_DEPENDS only + USES=pycryptography:run + -> adds a RUN_DEPENDS only + USES=pycryptography:test + -> adds a TEST_DEPENDS only + USES=pycryptography:build,run or USES=pycryptography + -> adds a BUILD_ and RUN_DEPENDS + 20230712: AUTHOR: zirias@FreeBSD.org diff --git a/Mk/Uses/pycryptography.mk b/Mk/Uses/pycryptography.mk new file mode 100644 index 000000000000..78576746e414 --- /dev/null +++ b/Mk/Uses/pycryptography.mk @@ -0,0 +1,46 @@ +# Handle dependency on security/py-cryptogrpaphy[-legacy] +# +# Feature: pycrptography +# Usage: USES=pycryptography +# Valid ARGS: <none>, build, run +# <none>: default same as build,run +# build: add BUILD_DEPENDS +# run: add RUN_DEPENDS +# test: add TEST_DEPENDS +# +# MAINTAINER: portmgr@FreeBSD.org +# + +.if ! defined(_INCLUDE_USES_PYCRYPTOGRAPHY_MK) +_INCLUDE_USES_PYCRYPTOGRAPHY_MK= YES + +# valid arguments: +_PYCRYPTOGRAPHY_MK_VALID_MODES= build run test + +# Suffixes +_PYCRYPTOGRAPHY_MK_SUFFIX_rust= # +_PYCRYPTOGRAPHY_MK_SUFFIX_legacy= -legacy + +# Dependency +_PYCRYPTOGRAPHY_MK_SUFFIX= ${_PYCRYPTOGRAPHY_MK_SUFFIX_${PYCRYPTOGRAPHY_DEFAULT}} +_PYCRYPTOGRAPHY_MK_PKG= ${PYTHON_PKGNAMEPREFIX}cryptography${_PYCRYPTOGRAPHY_MK_SUFFIX} +_PYCRYPTOGRAPHY_MK_PORT= security/py-cryptography${_PYCRYPTOGRAPHY_MK_SUFFIX} +_PYCRYPTOGRAPHY_MK_DEPENDENCY= ${_PYCRYPTOGRAPHY_MK_PKG}>0:${_PYCRYPTOGRAPHY_MK_PORT}@${PY_FLAVOR} + +# === parse version arguments === +_PYGRYPTOGRAPHY_MK_MODES= # empty +. for _mode in ${_PYCRYPTOGRAPHY_MK_VALID_MODES} +. if ${pycryptography_ARGS:M${_mode}} +_PYCRYPTOGRAPHY_MK_MODES+= ${_mode} +. endif +. endfor +. if empty(_PYGRYPTOGRAPHY_MK_MODES) +_PYCRYPTOGRAPHY_MK_MODES= build run +. endif + +# == add actual dependencies === +. for _mode in ${_PYCRYPTOGRAPHY_MK_MODES} +${_mode:tu}_DEPENDS+= ${_PYCRYPTOGRAPHY_MK_DEPENDENCY} +. endfor + +.endif |