Re: python-module: only set do-* targets if MODPY_*DEP is true

2023-01-09 Thread Klemens Nanni
09.01.2023 19:23, Theo Buehler пишет:
> The only port that failed to build with this diff is textproc/catfish.

Great, thanks for testing, tb!

I'll still hold off with any python.port.mk diff until the xonly dust
settles, just to avoid any possible churn or noise for now.

That should also give me enough time to test a slightly tweaked version.



Re: python-module: only set do-* targets if MODPY_*DEP is true

2023-01-09 Thread Theo Buehler
On Wed, Jan 04, 2023 at 09:22:35PM +, Klemens Nanni wrote:
> net/qbittorrent uses python with MODPY_BUILDDEP=No MODPY_TESTDEP=No.
> I've switched it to cmake and the way its Makefile.inc is now means that
> lang/python comes before devel/cmake in MODULES.
> 
> I expected this to work without further tweaks since python is just RDEP
> but turns out the module still sets do-build and do-install, so cmake
> loses unless I manually define it first (and explain with a comment).
> 
> 
> Is there a reason those targets are still defined?
> If not, the following obvious diff makes any MODULES order work, given
> MODPY_*DEP=No.
> 
> Feedback? Objection? OK?

The only port that failed to build with this diff is textproc/catfish.

> 
> Index: python.port.mk
> ===
> RCS file: /cvs/ports/lang/python/python.port.mk,v
> retrieving revision 1.178
> diff -u -p -r1.178 python.port.mk
> --- python.port.mk6 Dec 2022 16:18:16 -   1.178
> +++ python.port.mk4 Jan 2023 21:16:38 -
> @@ -356,13 +356,15 @@ MODPY_TEST_TARGET +=${TEST_TARGET}
>  
>  # dirty way to do it with no modifications in bsd.port.mk
>  .if empty(CONFIGURE_STYLE)
> -.  if !target(do-build)
> +.  if !target(do-build) && \
> +  ${MODPY_BUILDDEP:L} == "yes"
>  do-build:
>   @${MODPY_BUILD_TARGET}
>  .  endif
>  
>  # extra documentation or scripts should be installed via post-install
> -.  if !target(do-install)
> +.  if !target(do-install) && \
> +  ${MODPY_BUILDDEP:L} == "yes"
>  do-install:
>   @${MODPY_INSTALL_TARGET}
>  .  endif
> @@ -372,6 +374,7 @@ do-install:
>  # (possibly with MODPY_PYTEST_ARGS pointed at test dirs/files if the 
> automatic
>  # search picks up files in lib/).
>  .  if !target(do-test) && \
> +  ${MODPY_TESTDEP:L} == "yes" && \
>(${MODPY_SETUPUTILS:L} == "yes" || ${MODPY_PYTEST:L} == "yes")
>  do-test:
>   @${MODPY_TEST_TARGET}
> 



Re: python-module: only set do-* targets if MODPY_*DEP is true

2023-01-06 Thread Klemens Nanni
06.01.2023 09:42, Marc Espie пишет:
> On Wed, Jan 04, 2023 at 09:22:35PM +, Klemens Nanni wrote:
>> net/qbittorrent uses python with MODPY_BUILDDEP=No MODPY_TESTDEP=No.
>> I've switched it to cmake and the way its Makefile.inc is now means that
>> lang/python comes before devel/cmake in MODULES.
>>
>> I expected this to work without further tweaks since python is just RDEP
>> but turns out the module still sets do-build and do-install, so cmake
>> loses unless I manually define it first (and explain with a comment).
>>
>>
>> Is there a reason those targets are still defined?
>> If not, the following obvious diff makes any MODULES order work, given
>> MODPY_*DEP=No.
>>
>> Feedback? Objection? OK?
> 
> This will definitely require a full bulk for testing, considering how many
> ports use python. Just to be on the safe side.

I'll ask around, thanks.

> 
>> Index: python.port.mk
>> ===
>> RCS file: /cvs/ports/lang/python/python.port.mk,v
>> retrieving revision 1.178
>> diff -u -p -r1.178 python.port.mk
>> --- python.port.mk   6 Dec 2022 16:18:16 -   1.178
>> +++ python.port.mk   4 Jan 2023 21:16:38 -
>> @@ -356,13 +356,15 @@ MODPY_TEST_TARGET +=   ${TEST_TARGET}
>>  
>>  # dirty way to do it with no modifications in bsd.port.mk
>>  .if empty(CONFIGURE_STYLE)
>> -.  if !target(do-build)
>> +.  if !target(do-build) && \
>> +  ${MODPY_BUILDDEP:L} == "yes"
> Please don't do this. It fits in a line, use a line

Sure, will do.



Re: python-module: only set do-* targets if MODPY_*DEP is true

2023-01-06 Thread Klemens Nanni
06.01.2023 11:41, Dima Pasechnik пишет:
> For what's worth, cmake's option to build Python modules, as extensions
> of C/C++ libraries, is getting more and more popular - with "proper"
> Python packaging continuing to be a mess (with deprecated and to be
> dropped in Python 3.12 distutils, badly documented setuptools,
> variety of other options such as meson(-python), python-build, poetry, etc...)

Neither do I follow cmake development, nor do I know enough python
internals, but I can say that e.g. net/libtorrent-rasterbar just works
with cmake while autoconf and/or direct python packaging needs little
help left and right -- see the diff on ports@.



Re: python-module: only set do-* targets if MODPY_*DEP is true

2023-01-06 Thread Dima Pasechnik
On Fri, Jan 06, 2023 at 10:42:11AM +0100, Marc Espie wrote:
> On Wed, Jan 04, 2023 at 09:22:35PM +, Klemens Nanni wrote:
> > net/qbittorrent uses python with MODPY_BUILDDEP=No MODPY_TESTDEP=No.
> > I've switched it to cmake and the way its Makefile.inc is now means that
> > lang/python comes before devel/cmake in MODULES.
> > 
> > I expected this to work without further tweaks since python is just RDEP
> > but turns out the module still sets do-build and do-install, so cmake
> > loses unless I manually define it first (and explain with a comment).

For what's worth, cmake's option to build Python modules, as extensions
of C/C++ libraries, is getting more and more popular - with "proper"
Python packaging continuing to be a mess (with deprecated and to be
dropped in Python 3.12 distutils, badly documented setuptools,
variety of other options such as meson(-python), python-build, poetry, etc...)

Dima



Re: python-module: only set do-* targets if MODPY_*DEP is true

2023-01-06 Thread Marc Espie
On Wed, Jan 04, 2023 at 09:22:35PM +, Klemens Nanni wrote:
> net/qbittorrent uses python with MODPY_BUILDDEP=No MODPY_TESTDEP=No.
> I've switched it to cmake and the way its Makefile.inc is now means that
> lang/python comes before devel/cmake in MODULES.
> 
> I expected this to work without further tweaks since python is just RDEP
> but turns out the module still sets do-build and do-install, so cmake
> loses unless I manually define it first (and explain with a comment).
> 
> 
> Is there a reason those targets are still defined?
> If not, the following obvious diff makes any MODULES order work, given
> MODPY_*DEP=No.
> 
> Feedback? Objection? OK?

This will definitely require a full bulk for testing, considering how many
ports use python. Just to be on the safe side.

> Index: python.port.mk
> ===
> RCS file: /cvs/ports/lang/python/python.port.mk,v
> retrieving revision 1.178
> diff -u -p -r1.178 python.port.mk
> --- python.port.mk6 Dec 2022 16:18:16 -   1.178
> +++ python.port.mk4 Jan 2023 21:16:38 -
> @@ -356,13 +356,15 @@ MODPY_TEST_TARGET +=${TEST_TARGET}
>  
>  # dirty way to do it with no modifications in bsd.port.mk
>  .if empty(CONFIGURE_STYLE)
> -.  if !target(do-build)
> +.  if !target(do-build) && \
> +  ${MODPY_BUILDDEP:L} == "yes"
Please don't do this. It fits in a line, use a line
>  do-build:
>   @${MODPY_BUILD_TARGET}
>  .  endif
>  
>  # extra documentation or scripts should be installed via post-install
> -.  if !target(do-install)
> +.  if !target(do-install) && \
> +  ${MODPY_BUILDDEP:L} == "yes"
>  do-install:
>   @${MODPY_INSTALL_TARGET}
>  .  endif
> @@ -372,6 +374,7 @@ do-install:
>  # (possibly with MODPY_PYTEST_ARGS pointed at test dirs/files if the 
> automatic
>  # search picks up files in lib/).
>  .  if !target(do-test) && \
> +  ${MODPY_TESTDEP:L} == "yes" && \
>(${MODPY_SETUPUTILS:L} == "yes" || ${MODPY_PYTEST:L} == "yes")
>  do-test:
>   @${MODPY_TEST_TARGET}
> 
>