Skip to contentSkip to conversation

python3-wpa-supplicant: fix a problem with importing the cli submodule

PATCH New Bartosz Golaszewski 1 participant 5 messages Mar 20, 2021

lore
Share & tools
lore
#0 lore raw

cover python3-wpa-supplicant: fix a problem with importing the cli submodule

From: Bartosz Golaszewski <[email protected]>

It's currently impossible to import the cli submodule from wpa-supplicant. This series addresses the issue by:
- adding a recipe for a missing dependency
- adding runtime dependencies to the recipe
- fixing a problem with an outdated API used in the module

The last patch is just cosmetic.

Bartosz Golaszewski (4):
python3-txdbus: new package
python3-wpa-supplicant: add runtime dependencies
python3-wpa-supplicant: fix importing the cli submodule
python3-wpa-supplicant: replace DESCRIPTION with SUMMARY

 .../packagegroups/packagegroup-meta-python.bb |   1 +
 .../python/python3-txdbus_1.1.2.bb            |  11 ++
 ...ond-argument-from-click.argument-dec.patch | 127 ++++++++++++++++++
 .../python/python3-wpa-supplicant_0.2.bb      |   6 +-
 4 files changed, 144 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-txdbus_1.1.2.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-wpa-supplicant/0001-cli-drop-the-second-argument-from-click.argument-dec.patch
Signature · 1 line
2.30.1
#1 lore raw

PATCH 1/4 python3-txdbus: new package

Add a recipe for python3-txdbus: a native Python implementation of the DBus protocol for Twisted applications.

---
 .../packagegroups/packagegroup-meta-python.bb         |  1 +
 .../recipes-devtools/python/python3-txdbus_1.1.2.bb   | 11 +++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-txdbus_1.1.2.bb
meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb +1 -0
index 45d370c77..c5ebb661c 100644
@@ -411,6 +411,7 @@ RDEPENDS_packagegroup-meta-python3 = "\
     python3-twitter \
     python3-twofish \
     python3-txaio \
+    python3-txdbus \
     python3-txws \
     python3-typed-ast \
     python3-typeguard \
meta-python/recipes-devtools/python/python3-txdbus_1.1.2.bb new file +11 -0
new file mode 100644
index 000000000..f521a9a68
@@ -0,0 +1,11 @@
+SUMMARY = "A native Python implementation of the DBus protocol for Twisted applications."
+AUTHOR = "Tom Cocagne"
+HOMEPAGE = "https://pypi.org/project/txdbus/"
+SECTION = "devel/python"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://README.rst;beginline=32;endline=32;md5=2141358b0bce85fc45216ba91735ad50"
+
+SRC_URI[md5sum] = "d397357dee78750385f92ca9c6c1f063"
+SRC_URI[sha256sum] = "8375a5fb68a12054f0def91af800c821fb2232949337756ed975f88d8ea2bc97"
+
+inherit pypi setuptools3
Signature · 1 line
2.30.1
#2 lore raw

PATCH 2/4 python3-wpa-supplicant: add runtime dependencies

In reply to Bartosz Golaszewski

This adds missing runtime dependencies for python3-wpa-supplicant.

---
 .../recipes-devtools/python/python3-wpa-supplicant_0.2.bb       | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-wpa-supplicant_0.2.bb +2 -0
index a62ccb72f..9a2e3f3bc 100644
@@ -10,3 +10,5 @@ SRC_URI[sha256sum] = "3ad0f40a696763bb0f4d4dec5b51f6b53ccfeb7c16ebb5897349303045
 PYPI_PACKAGE = "wpa_supplicant"
 
 inherit pypi setuptools3
+
+RDEPENDS_${PN} += "python3-twisted python3-click python3-txdbus"
Signature · 1 line
2.30.1
#3 lore raw

PATCH 3/4 python3-wpa-supplicant: fix importing the cli submodule

In reply to Bartosz Golaszewski

The @click.argument decorator in the version of click provided by meta-python no longer takes more than one positional argument. Add a local patch for python3-wpa-supplicant that fixes the parsing error when
running: 'from wpa_supplicant import cli'.

---
 ...ond-argument-from-click.argument-dec.patch | 127 ++++++++++++++++++
 .../python/python3-wpa-supplicant_0.2.bb      |   2 +
 2 files changed, 129 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-wpa-supplicant/0001-cli-drop-the-second-argument-from-click.argument-dec.patch
meta-python/recipes-devtools/python/python3-wpa-supplicant/0001-cli-drop-the-second-argument-from-click.argument-dec.patch new file +127 -0
new file mode 100644
index 000000000..59aaa7ed8
@@ -0,0 +1,127 @@
+From 49b133d84e7a1471bf51d8d005b1ba8b78c37724 Mon Sep 17 00:00:00 2001
+From: Bartosz Golaszewski <[email protected]>
+Date: Sat, 20 Mar 2021 20:59:54 +0100
+Subject: [PATCH] cli: drop the second argument from @click.argument()
+ decorator
+
[email protected] no longer takes two positional arguments.
+
+Signed-off-by: Bartosz Golaszewski <[email protected]>
+---
+Upstream-Status: Pending
+
+ wpa_supplicant/cli.py | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/wpa_supplicant/cli.py b/wpa_supplicant/cli.py
+index bad5b5b..1fb322d 100644
+--- a/wpa_supplicant/cli.py
++++ b/wpa_supplicant/cli.py
+@@ -81,7 +81,7 @@ def root(ctx, debug):
+ 
+ 
+ @root.group()
[email protected]('ifname', 'e.g. wlan0')
[email protected]('ifname')
+ @click.pass_context
+ def interface(ctx, ifname):
+     """Access fi.w1.wpa_supplicant1.Interface object"""
+@@ -101,7 +101,7 @@ def interface_p2p_device():
+ 
+ 
+ @root.group()
[email protected]('ifname', 'e.g. wlan0')
[email protected]('ifname')
+ @click.option('--ssid', default=None, help='Look at scan results for BSS examples')
+ @click.option('--bssid', default=None, help='Look at scan results for BSS examples')
+ @click.pass_context
+@@ -149,7 +149,7 @@ def persistent_group():
+ # fi.w1.wpa_supplicant1 API
+ #
+ @root.command()
[email protected]('ifname', 'e.g. wlan0')
[email protected]('ifname')
+ @click.option('--bridge_if_name', default=None, help='Bridge to control, e.g., br0')
+ @click.option('--driver', default=None, help='e.g. nl80211')
+ @click.option('--config_file', default=None, help='Config file path')
+@@ -161,7 +161,7 @@ def create_interface(ifname, bridge_if_name, driver, config_file):
+ 
+ 
+ @root.command()
[email protected]('ifname', 'e.g. wlan0')
[email protected]('ifname')
+ def remove_interface(ifname):
+     """Method: Deregisters a wireless interface from wpa_supplicant"""
+     with supplicant() as supp:
+@@ -170,7 +170,7 @@ def remove_interface(ifname):
+ 
+ 
+ @root.command()
[email protected]('ifname', 'e.g. wlan0')
[email protected]('ifname')
+ def get_interface(ifname):
+     """Method: Returns a D-Bus path to an object related to an interface which wpa_supplicant already controls"""
+     with supplicant() as supp:
+@@ -178,7 +178,7 @@ def get_interface(ifname):
+ 
+ 
+ @root.command(name='get')
[email protected]('name', 'Name of property (case sensitive)')
[email protected]('name')
+ def root_get(name):
+     """Method: Get Property (case sensitive)"""
+     with supplicant() as supp:
+@@ -186,8 +186,8 @@ def root_get(name):
+ 
+ 
+ @root.command(name='set')
[email protected]('name', 'Name of property (case sensitive)')
[email protected]('value', 'Value to be set')
[email protected]('name')
[email protected]('value')
+ def root_set(name, value):
+     """Method: Set Property (case sensitive)"""
+     with supplicant() as supp:
+@@ -217,7 +217,7 @@ def disconnect(ctx):
+ 
+ 
+ @interface.command(name='get')
[email protected]('name', 'Name of property (case sensitive)')
[email protected]('name')
+ @click.pass_context
+ def interface_get(ctx, name):
+     """Method: Get Property (case sensitive)"""
+@@ -227,8 +227,8 @@ def interface_get(ctx, name):
+ 
+ 
+ @interface.command(name='set')
[email protected]('name', 'Name of property (case sensitive)')
[email protected]('value', 'Value to be set')
[email protected]('name')
[email protected]('value')
+ @click.pass_context
+ def interface_set(ctx, name, value):
+     """Method: Set Property (case sensitive)"""
+@@ -241,7 +241,7 @@ def interface_set(ctx, name, value):
+ # fi.w1.wpa_supplicant1.BSS API
+ #
+ @bss.command(name='get')
[email protected]('name', 'Name of property (case sensitive)')
[email protected]('name')
+ @click.pass_context
+ def bss_get(ctx, name):
+     """Method: Get Property (case sensitive)"""
+@@ -261,8 +261,8 @@ def bss_get(ctx, name):
+ 
+ 
+ @bss.command(name='set')
[email protected]('name', 'Name of property (case sensitive)')
[email protected]('value', 'Value to be set')
[email protected]('name')
[email protected]('value')
+ @click.pass_context
+ def bss_set(ctx, name, value):
+     """Method: Set Property (case sensitive)"""
+-- 
+2.25.1
+
meta-python/recipes-devtools/python/python3-wpa-supplicant_0.2.bb +2 -0
index 9a2e3f3bc..55e508805 100644
@@ -7,6 +7,8 @@ LIC_FILES_CHKSUM = "file://README.md;beginline=171;endline=199;md5=462586bcbebd1
 SRC_URI[md5sum] = "c21c7841f5e03ff709a0564b2e094010"
 SRC_URI[sha256sum] = "3ad0f40a696763bb0f4d4dec5b51f6b53ccfeb7c16ebb5897349303045f94776"
 
+SRC_URI += "file://0001-cli-drop-the-second-argument-from-click.argument-dec.patch"
+
 PYPI_PACKAGE = "wpa_supplicant"
 
 inherit pypi setuptools3
Signature · 1 line
2.30.1
#4 lore raw

PATCH 4/4 python3-wpa-supplicant: replace DESCRIPTION with SUMMARY

In reply to Bartosz Golaszewski

SUMMARY seems to be the preferred variable for short info on a project supported by the recipe. Replace DESCRIPTION with SUMMARY for python wpa-supplicant module.

---
 .../recipes-devtools/python/python3-wpa-supplicant_0.2.bb       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-python/recipes-devtools/python/python3-wpa-supplicant_0.2.bb +1 -1
index 55e508805..2309bec5e 100644
@@ -1,4 +1,4 @@
-DESCRIPTION = "Python interface to the wpa_supplicant D-Bus interface"
+SUMMARY = "Python interface to the wpa_supplicant D-Bus interface"
 HOMEPAGE = "https://pypi.org/project/wpa_supplicant/"
 SECTION = "devel/python"
 LICENSE = "MPL-2.0"
Signature · 1 line
2.30.1