From 1b46b6ed0d0d8cdf8040959d71d67ffc91a8dba8 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 16 Jun 2023 08:23:21 +0200 Subject: [PATCH 1/5] add pkg_resources to prepare #33 --- package.json | 7 ++++++- pkg_resources/__init__.py | 0 pkg_resources/pkg_resources.py | 28 ++++++++++++++++++++++++++++ setup.py | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 pkg_resources/__init__.py create mode 100644 pkg_resources/pkg_resources.py diff --git a/package.json b/package.json index 17f4f7d..7fb83d8 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,10 @@ "utemplate/source.py", "github:brainelectronics/Micropython-ESP-WiFi-Manager/utemplate/source.py" ], + [ + "pkg_resources/pkg_resources.py", + "github:brainelectronics/Micropython-ESP-WiFi-Manager/pkg_resources/pkg_resources.py" + ], [ "static/css/bootstrap.min.css", "github:brainelectronics/Micropython-ESP-WiFi-Manager/static/css/bootstrap.min.css" @@ -82,7 +86,8 @@ ] ], "deps": [ - ["github:brainelectronics/micropython-modules", "develop"] + ["github:brainelectronics/micropython-modules", "develop"], + ["pkg_resources", "0.2.1"] ], "version": "1.11.0" } \ No newline at end of file diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pkg_resources/pkg_resources.py b/pkg_resources/pkg_resources.py new file mode 100644 index 0000000..cd3e0fe --- /dev/null +++ b/pkg_resources/pkg_resources.py @@ -0,0 +1,28 @@ +import uio + +c = {} + + +def resource_stream(package, resource): + if package not in c: + try: + if package: + p = __import__(package + ".R", None, None, True) + else: + p = __import__("R") + c[package] = p.R + except ImportError: + if package: + p = __import__(package) + d = p.__path__ + else: + d = "." + # if d[0] != "/": + # import uos + # d = uos.getcwd() + "/" + d + c[package] = d + "/" + + p = c[package] + if isinstance(p, dict): + return uio.BytesIO(p[resource]) + return open(p + resource, "rb") diff --git a/setup.py b/setup.py index 62859a0..8d6b527 100644 --- a/setup.py +++ b/setup.py @@ -39,6 +39,7 @@ 'wifi_manager', 'microdot', 'utemplate', + 'pkg_resources', ], # Although 'package_data' is the preferred approach, in some case you may # need to place data files outside of your packages. See: From 282aa341dcfec9b83f2c1764c8f8648db424e08a Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 16 Jun 2023 08:23:48 +0200 Subject: [PATCH 2/5] fix usage instructions for main import in README --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 839f2bf..5fb1e49 100644 --- a/README.md +++ b/README.md @@ -111,16 +111,17 @@ upip.install('micropython-esp-wifi-manager') The `boot.py` and `main.py` files of this package are installed into `/lib` of the MicroPython device by `mip`. They are fully functional and without any other dependencies or MicroPython port specific commands. Simply add the -following line to the `boot.py` file of your device. +following line to the `boot.py` file of your device. *The following commands +are not working if this package got installed by `upip`* ```python -from wifi_manager import boot +import wifi_manager.boot ``` And also add this line to your `main.py`, before your application code ```python -from wifi_manager import main +import wifi_manager.main ``` #### Specific version From 32d56b92e058afc1ad57214c6f0e3c84b5fd1887 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 16 Jun 2023 08:40:57 +0200 Subject: [PATCH 3/5] add microdot to simulation requirements --- simulation/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/simulation/requirements.txt b/simulation/requirements.txt index 10ed78d..d9e407e 100644 --- a/simulation/requirements.txt +++ b/simulation/requirements.txt @@ -5,3 +5,4 @@ jinja2>=3.0.2,<4 PyYAML>=5.4.1,<6 netifaces>=0.11.0,<1 pycrypto>=2.6.1,<3 +microdot>=1.2.4,<2 From d9717a90b869683fdbb02854d408a17ca3ce0971 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 16 Jun 2023 08:24:07 +0200 Subject: [PATCH 4/5] update changelog for 1.12.1 --- changelog.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index cb233aa..a0ec374 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,14 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" ## Released +## [1.12.1] - 2023-06-16 +### Added +- `pkg_resources` to `setup.py` and `package.json` as version 0.2.1 to prepare #33 + +### Fixed +- Instructions for using this package `boot.py` and `main.py` files in README +- `microdot` added to the simulation requirements + ## [1.12.0] - 2023-06-12 ### Added - Instructions for using this package `boot.py` and `main.py` files @@ -272,8 +280,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" - `sendfile` function implemented in same way as on Micropythons PicoWeb -[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.12.0...develop +[Unreleased]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/compare/1.12.1...develop +[1.12.1]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.12.1 [1.12.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.12.0 [1.11.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.11.0 [1.10.0]: https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager//tree/1.10.0 From 185310e569e32334822130e3fc74b982de551d8c Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 16 Jun 2023 08:51:58 +0200 Subject: [PATCH 5/5] remove unused init of pkg resources --- pkg_resources/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pkg_resources/__init__.py diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py deleted file mode 100644 index e69de29..0000000