aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-01-25 11:51:05 +0100
committerMichał Górny <mgorny@gentoo.org>2022-01-26 09:28:42 +0100
commit3d8f12eae3c3f8996068e05aaa65cb97f0abaeb1 (patch)
treedf58003eeb5509c96bec533198d92e62fe7b29af
parentnewmetadata: Don't add python@ to dev-python/* by default (diff)
downloadgentoo-syntax-3d8f12eae3c3f8996068e05aaa65cb97f0abaeb1.tar.gz
gentoo-syntax-3d8f12eae3c3f8996068e05aaa65cb97f0abaeb1.tar.bz2
gentoo-syntax-3d8f12eae3c3f8996068e05aaa65cb97f0abaeb1.zip
newebuild: Modernize the Python template
Use PEP517 build. It defaults to setuptools but the eclass will detect if this is incorrect. Add a default pypi HOMEPAGE based on the package name. Skip DEPEND. Python packages rarely need this class of dependencies, RDEPEND + BDEPEND are much more common. Add empty "test?" block in BDEPEND, as this is often necessary. If it is not, it is easy to yank it. Add distutils_enable_tests. It defaults to pytest, as the most common variant. It will also trigger explicit failure if the package has no tests. Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--plugin/newebuild.vim23
1 files changed, 19 insertions, 4 deletions
diff --git a/plugin/newebuild.vim b/plugin/newebuild.vim
index 36db2dd..bd80712 100644
--- a/plugin/newebuild.vim
+++ b/plugin/newebuild.vim
@@ -21,6 +21,8 @@ fun! <SID>MakeNewEbuild()
let l:filename = expand("%:p")
let l:category = substitute(l:filename,
\ "^.*/\\([^/]\\+\\)/[^/]\\+/[^/]\\+\\.ebuild", "\\1", "g")
+ let l:package = substitute(l:filename,
+ \ "^.*/\\([^/]\\+\\)/[^/]\\+\\.ebuild", "\\1", "g")
" use empty keywords for live ebuilds
if l:filename =~# "-9999\\+.ebuild\$"
@@ -155,6 +157,7 @@ fun! <SID>MakeNewEbuild()
" {{{ standard default setup
" {{{ extra inherits for some categories
if l:category ==# "dev-python"
+ put ='DISTUTILS_USE_PEP517=setuptools'
put ='PYTHON_COMPAT=( ' . GentooGetPythonTargets() . ' )'
put ='inherit distutils-r1'
put =''
@@ -162,7 +165,9 @@ fun! <SID>MakeNewEbuild()
" }}}
put ='DESCRIPTION=\"\"'
- put ='HOMEPAGE=\"\"'
+ put ='HOMEPAGE=\"'
+ put =' https://pypi.org/project/' . l:package . '/'
+ put ='\"'
put ='SRC_URI=\"\"'
put =''
put ='LICENSE=\"\"'
@@ -171,9 +176,19 @@ fun! <SID>MakeNewEbuild()
put =''
" {{{ extra deps for some categories
- put ='DEPEND=\"\"'
- put ='RDEPEND=\"${DEPEND}\"'
- put ='BDEPEND=\"\"'
+ if l:category ==# "dev-python"
+ put ='RDEPEND=\"\"'
+ put ='BDEPEND=\"'
+ put =' test? ('
+ put =' )'
+ put ='\"'
+ put =''
+ put ='distutils_enable_tests pytest'
+ else
+ put ='DEPEND=\"\"'
+ put ='RDEPEND=\"${DEPEND}\"'
+ put ='BDEPEND=\"\"'
+ endif
" }}}
endif