diff mbox series

[ovs-dev,3/3] python: Use build to generate PEP517 compatible archives.

Message ID 20230802083058.67766-4-rjarry@redhat.com
State Superseded
Headers show
Series Python ovsdb bindings distribution improvements | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/intel-ovs-compilation success test: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Robin Jarry Aug. 2, 2023, 8:27 a.m. UTC
Quoting Paul Ganssle, setuptools maintainer:
> * The setuptools project has stopped maintaining all direct
>   invocations of setup.py years ago, and distutils is deprecated.
>   There are undoubtedly many ways that your setup.py-based system is
>   broken today, even if it's not failing loudly or obviously.
>
> * Direct invocations of setup.py cannot bootstrap their own
>   dependencies, and so some CLI is necessary for dependency
>   management.
>
> * The setuptools project no longer wants to provide any public CLI,
>   and will be actively removing the existing interface (though the
>   time scale for this is long).
>
> * PEP 517, 518 and other standards-based packaging are the future of
>   the Python ecosystem and a lot of progress has been made on making
>   this upgrade seamless.

As described in the recommendations in the end of the article:
`python3 setup.py sdist` should be replaced by `python3 -m build
--sdist`

Link: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 python/automake.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Mike Pattrick Aug. 4, 2023, 5:33 p.m. UTC | #1
On Wed, Aug 2, 2023 at 4:31 AM Robin Jarry <rjarry@redhat.com> wrote:

> Quoting Paul Ganssle, setuptools maintainer:
> > * The setuptools project has stopped maintaining all direct
> >   invocations of setup.py years ago, and distutils is deprecated.
> >   There are undoubtedly many ways that your setup.py-based system is
> >   broken today, even if it's not failing loudly or obviously.
> >
> > * Direct invocations of setup.py cannot bootstrap their own
> >   dependencies, and so some CLI is necessary for dependency
> >   management.
> >
> > * The setuptools project no longer wants to provide any public CLI,
> >   and will be actively removing the existing interface (though the
> >   time scale for this is long).
> >
> > * PEP 517, 518 and other standards-based packaging are the future of
> >   the Python ecosystem and a lot of progress has been made on making
> >   this upgrade seamless.
>
> As described in the recommendations in the end of the article:
> `python3 setup.py sdist` should be replaced by `python3 -m build
> --sdist`
>
> Link:
> https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary
> Signed-off-by
> <https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summarySigned-off-by>:
> Robin Jarry <rjarry@redhat.com>
>
>
Acked-by: Mike Pattrick <mkp@redhat.com>
Ilya Maximets Aug. 8, 2023, 8:33 p.m. UTC | #2
On 8/2/23 10:27, Robin Jarry wrote:
> Quoting Paul Ganssle, setuptools maintainer:
>> * The setuptools project has stopped maintaining all direct
>>   invocations of setup.py years ago, and distutils is deprecated.
>>   There are undoubtedly many ways that your setup.py-based system is
>>   broken today, even if it's not failing loudly or obviously.
>>
>> * Direct invocations of setup.py cannot bootstrap their own
>>   dependencies, and so some CLI is necessary for dependency
>>   management.
>>
>> * The setuptools project no longer wants to provide any public CLI,
>>   and will be actively removing the existing interface (though the
>>   time scale for this is long).
>>
>> * PEP 517, 518 and other standards-based packaging are the future of
>>   the Python ecosystem and a lot of progress has been made on making
>>   this upgrade seamless.

Nit: quotation style.

> 
> As described in the recommendations in the end of the article:
> `python3 setup.py sdist` should be replaced by `python3 -m build
> --sdist`

It might be better to avoid starting a line with '--'.  It will
likely not be misinterpreted, but just in case.

> 
> Link: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
>  python/automake.mk | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/python/automake.mk b/python/automake.mk
> index 8854e656a5ae..19d9d91119c2 100644
> --- a/python/automake.mk
> +++ b/python/automake.mk
> @@ -101,10 +101,11 @@ ovs-install-data-local:
>  	rm python/ovs/dirs.py.tmp
>  
>  python-sdist: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py
> -	(cd python/ && $(PYTHON3) setup.py sdist)
> +	cd python/ && $(PYTHON3) -m build --sdist
>  
>  pypi-upload: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py
> -	(cd python/ && $(PYTHON3) setup.py sdist && twine upload dist/ovs-$(VERSION).tar.gz)
> +	cd python/ && $(PYTHON3) -m build --sdist && twine upload dist/ovs-$(VERSION).tar.gz
> +

We would not need to change it in two places if pypi-upload had a
dependency on python-sdist. :)

And this way the pypi-upload will not need any other dependencies
as well.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/python/automake.mk b/python/automake.mk
index 8854e656a5ae..19d9d91119c2 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -101,10 +101,11 @@  ovs-install-data-local:
 	rm python/ovs/dirs.py.tmp
 
 python-sdist: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py
-	(cd python/ && $(PYTHON3) setup.py sdist)
+	cd python/ && $(PYTHON3) -m build --sdist
 
 pypi-upload: $(srcdir)/python/ovs/version.py $(ovs_pyfiles) python/ovs/dirs.py
-	(cd python/ && $(PYTHON3) setup.py sdist && twine upload dist/ovs-$(VERSION).tar.gz)
+	cd python/ && $(PYTHON3) -m build --sdist && twine upload dist/ovs-$(VERSION).tar.gz
+
 install-data-local: ovs-install-data-local
 
 UNINSTALL_LOCAL += ovs-uninstall-local