On Fri, 21 Jan 2022 13:34:19 +1100, Kubilay Kocak <ko...@freebsd.org> wrote:

> On 17/01/2022 2:29 am, loader wrote:
>> On Sat, 15 Jan 2022 01:28:09 +0100, Stefan Esser <s...@freebsd.org> wrote:
>>
>>> Hi Python Maintainers,
>>>
>>> the following packages conflict with each other since they install
>>> files that do not depend on the package:
>>>
>>> py38-scikit-bio
>>> py38-ddtrace
>>>
>>> They contain files like
>>>
>>> lib/python3.8/site-packages/benchmarks/__pycache__/__init__.cpython-38.pyc
>>>
>>> which probably should be excluded from the PLIST.
>>>
>>> Similarily:
>>>
>>> py38-mycli
>>> py38-beziers
>>> py38-grizzled
>>> py38-gtfslib
>>> py38-habanero
>>> py38-molecule
>>> py38-onnx-tf
>>> py38-ont-fast5-api
>>> py38-puppetboard
>>> py38-pysmartdl
>>> py38-pysodium
>>> py38-pyzipper
>>> py38-streamparse
>>>
>>> which all contain:
>>>
>>> lib/python3.8/site-packages/test/__init__.py
>>> lib/python3.8/site-packages/test/conftest.py
>>> lib/python3.8/site-packages/test/__pycache__/__init__.cpython-38.pyc
>>> lib/python3.8/site-packages/test/__pycache__/conftest.cpython-38.pyc
>>>
>>> I have not checked for individual maintainers, but this is IMHO a
>>> framework issue that should have a generic solution ...
>>>
>>> Should I create a PR for this issue?
>>>
>>> Regards, STefan
>>
>> Just a thought, maybe site-packages/test/ could be removed during
>> autoplist, but not sure whether there's a port really needs be to
>> installed into this directory.
>>
>> diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
>> index 6c5d11dc9d08..37aa53759698 100644
>> --- a/Mk/Uses/python.mk
>> +++ b/Mk/Uses/python.mk
>> @@ -616,6 +616,7 @@ _RELLIBDIR=              
>> ${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;}
>>   _USES_stage+=      934:add-plist-pymod
>>   add-plist-pymod:
>>      @${SED} -e 's|^"\(.*\)"$$|\1|' \
>> +            -e '\|^${PYTHON_SITELIBDIR}/test/|d' \
>>              -e 's|^${STAGEDIR}${PREFIX}/||' \
>>              -e 's|^${PREFIX}/||' \
>>              -e 's|^\(man/.*man[0-9]\)/\(.*\.[0-9]\)$$|\1/\2.gz|' \
>>
>> Cheers,
>> loader
>
> Ideally and if possible, these issues should be (1) detected (sanity.mk
> python.mk or similar: fatal error) and (2) reported upstream so that
> they can be resolved permanently.
>
> Happy to discuss any time. #freebsd-python @ Libera Chat IRC

Just some random thoughts:

diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 6c5d11dc9d08..1c179e98e34d 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -502,6 +502,10 @@ PYTHONPREFIX_SITELIBDIR=   
${PYTHON_SITELIBDIR:S;${PYTHONBASE};${PREFIX};}
 # Used for recording the installed files.
 _PYTHONPKGLIST=        ${WRKDIR}/.PLIST.pymodtmp
 
+# Installing Python package files into these directories
+# in ${PYTHON_SITELIBDIR} may conflict with each other.
+_PYTHON_CONFLICT_DIRS= benchmarks test
+
 # Ports bound to a certain python version SHOULD
 # - use the PYTHON_PKGNAMEPREFIX
 # - use directories using the PYTHON_PKGNAMEPREFIX
@@ -643,6 +647,14 @@ add-plist-python:
 .endif # ${PYTHON_REL} >= 30200 && defined(_PYTHON_FEATURE_PY3KPLIST)
 .endif # defined(_PYTHON_FEATURE_AUTOPLIST) && 
defined(_PYTHON_FEATURE_DISTUTILS)
 
+_USES_stage+=  936:check-conflict-directories
+check-conflict-directories:
+       @for _d in ${_PYTHON_CONFLICT_DIRS}; do \
+               if ${GREP} -e "^${PYTHON_SITELIBDIR:S;${PREFIX}/;;}/$${_d}/" 
${TMPPLIST}; then \
+                       ${ECHO_MSG} "===> This port installs a *$${_d}* 
directory into PYTHON_SITELIBDIR which may conflict with the files installed by 
other Python packages, please consider adding it to the find_packages() exclude 
filter in setup.py, for example: packages=find_packages(exclude=('$${_d}',))"; 
exit 1; \
+               fi; \
+       done
+
 # Fix for programs that build python from a GNU auto* environment
 CONFIGURE_ENV+=        PYTHON="${PYTHON_CMD}"
 

and an example to patch setup.py to exclude the test directory:

diff --git a/security/py-pysodium/Makefile b/security/py-pysodium/Makefile
index f7aeeee314ce..38145dd1f254 100644
--- a/security/py-pysodium/Makefile
+++ b/security/py-pysodium/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=      pysodium
 PORTVERSION=   0.7.10
+PORTREVISION=  1
 CATEGORIES=    security python
 MASTER_SITES=  CHEESESHOP
 PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
diff --git a/security/py-pysodium/files/patch-setup.py 
b/security/py-pysodium/files/patch-setup.py
new file mode 100644
index 000000000000..f64c530b0cad
--- /dev/null
+++ b/security/py-pysodium/files/patch-setup.py
@@ -0,0 +1,11 @@
+--- setup.py.orig      2022-01-22 11:58:59 UTC
++++ setup.py
+@@ -18,7 +18,7 @@ setup(
+     license="BSD",
+     keywords="cryptography API NaCl libsodium",
+     url="https://github.com/stef/pysodium";,
+-    packages=find_packages(),
++    packages=find_packages(exclude=('test',)),
+     long_description=read('README.md'),
+     requires=["libsodium"],
+     classifiers=["Development Status :: 4 - Beta",

Cheers,
loader

Attachment: signature.asc
Description: PGP signature

Reply via email to