diff mbox series

swupdateclient: replace setup.py by pyproject.toml

Message ID 20240419095345.672-1-sam.van.den.berge@gmail.com
State New
Headers show
Series swupdateclient: replace setup.py by pyproject.toml | expand

Commit Message

Sam Van Den Berge April 19, 2024, 9:53 a.m. UTC
From: Sam Van Den Berge <sam.van.den.berge@gmail.com>

Signed-off-by: Sam Van Den Berge <sam.van.den.berge@gmail.com>
---
 tools/python/swupdateclient/pyproject.toml | 24 ++++++++++++++++++++++
 tools/python/swupdateclient/setup.py       | 21 -------------------
 2 files changed, 24 insertions(+), 21 deletions(-)
 create mode 100644 tools/python/swupdateclient/pyproject.toml
 delete mode 100644 tools/python/swupdateclient/setup.py

Comments

James Hilliard April 19, 2024, 6:18 p.m. UTC | #1
On Fri, Apr 19, 2024 at 3:53 AM <sam.van.den.berge@gmail.com> wrote:
>
> From: Sam Van Den Berge <sam.van.den.berge@gmail.com>
>
> Signed-off-by: Sam Van Den Berge <sam.van.den.berge@gmail.com>
> ---
>  tools/python/swupdateclient/pyproject.toml | 24 ++++++++++++++++++++++
>  tools/python/swupdateclient/setup.py       | 21 -------------------
>  2 files changed, 24 insertions(+), 21 deletions(-)
>  create mode 100644 tools/python/swupdateclient/pyproject.toml
>  delete mode 100644 tools/python/swupdateclient/setup.py
>
> diff --git a/tools/python/swupdateclient/pyproject.toml b/tools/python/swupdateclient/pyproject.toml
> new file mode 100644
> index 0000000..dc34b8c
> --- /dev/null
> +++ b/tools/python/swupdateclient/pyproject.toml
> @@ -0,0 +1,24 @@
> +[build-system]
> +requires = ["setuptools"]
> +build-backend = "setuptools.build_meta"
> +
> +[project]
> +name = "swupdateclient"
> +version = "0.1"
> +dependencies = [
> +  'websockets',
> +  'requests',
> +  'termcolor>=2.2.0'
> +]
> +authors = [
> +  {name = "Stefano Babic", email = "stefano.babic@swupdate.org"},
> +]
> +description="Python Client to update SWUpdate based devices"
> +license = {text = "GPL-2.0-only"}
> +requires-python = ">=3.8"
> +
> +[project.urls]
> +Repository = "https://github.com/sbabic/swupdate/tree/master/tools/python/swupdateclient"
> +
> +[project.scripts]
> +swupdateclient="swupdateclient.main:main"
> diff --git a/tools/python/swupdateclient/setup.py b/tools/python/swupdateclient/setup.py
> deleted file mode 100644
> index b7c6075..0000000
> --- a/tools/python/swupdateclient/setup.py


I'm not sure we want to completely remove setup.py support as some
build systems may not yet support pep517 builds(we only recently finished
migrating buildroot's setuptools support to use pep517 actually).

Here's what I would recommend for now, move the configuration to setup.cfg
since that avoids introducing a toml dependency on setuptools when not using
pep517(https://setuptools.pypa.io/en/latest/userguide/declarative_config.html).

Add a simple setup.py shim like this
(https://setuptools.pypa.io/en/latest/userguide/quickstart.html#development-mode):
```
from setuptools import setup

setup()
```

Add a simple pyproject.toml shim like this:
```
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
```

This way you should retain full compatibility with both legacy and
pep517 builds.

>
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -# SPDX-FileCopyrightText: 2023 Stefano Babic <stefano.babic@swupdate.org>
> -#
> -# SPDX-License-Identifier:     GPL-2.0-only
> -from setuptools import setup, find_packages
> -
> -setup(
> -    name="swupdateclient",
> -    version="0.1",
> -    packages=find_packages(),
> -    url="https://github.com/sbabic/swupdate/tree/master/tools/python/swupdateclient",
> -    license="GPL-2.0-only",
> -    author="Stefano Babic",
> -    author_email="stefano.babic@swupdate.org",
> -    description="Python Client to update SWUpdate based devices",
> -    entry_points={
> -        "console_scripts": [
> -            "swupdateclient=swupdateclient.main:main",
> -        ],
> -    },
> -    python_requires=">=3.8",
> -)
> --
> 2.34.1
>
> --
> You received this message because you are subscribed to the Google Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to swupdate+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/swupdate/20240419095345.672-1-sam.van.den.berge%40gmail.com.
diff mbox series

Patch

diff --git a/tools/python/swupdateclient/pyproject.toml b/tools/python/swupdateclient/pyproject.toml
new file mode 100644
index 0000000..dc34b8c
--- /dev/null
+++ b/tools/python/swupdateclient/pyproject.toml
@@ -0,0 +1,24 @@ 
+[build-system]
+requires = ["setuptools"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "swupdateclient"
+version = "0.1"
+dependencies = [
+  'websockets',
+  'requests',
+  'termcolor>=2.2.0'
+]
+authors = [
+  {name = "Stefano Babic", email = "stefano.babic@swupdate.org"},
+]
+description="Python Client to update SWUpdate based devices"
+license = {text = "GPL-2.0-only"}
+requires-python = ">=3.8"
+
+[project.urls]
+Repository = "https://github.com/sbabic/swupdate/tree/master/tools/python/swupdateclient"
+
+[project.scripts]
+swupdateclient="swupdateclient.main:main"
diff --git a/tools/python/swupdateclient/setup.py b/tools/python/swupdateclient/setup.py
deleted file mode 100644
index b7c6075..0000000
--- a/tools/python/swupdateclient/setup.py
+++ /dev/null
@@ -1,21 +0,0 @@ 
-# SPDX-FileCopyrightText: 2023 Stefano Babic <stefano.babic@swupdate.org>
-#
-# SPDX-License-Identifier:     GPL-2.0-only
-from setuptools import setup, find_packages
-
-setup(
-    name="swupdateclient",
-    version="0.1",
-    packages=find_packages(),
-    url="https://github.com/sbabic/swupdate/tree/master/tools/python/swupdateclient",
-    license="GPL-2.0-only",
-    author="Stefano Babic",
-    author_email="stefano.babic@swupdate.org",
-    description="Python Client to update SWUpdate based devices",
-    entry_points={
-        "console_scripts": [
-            "swupdateclient=swupdateclient.main:main",
-        ],
-    },
-    python_requires=">=3.8",
-)