Skip to contentSkip to conversation

package/python-smmap2: new package

PATCH New aduskett at gmail.com 2 participants 3 messages Nov 29, 2019 – Dec 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python-smmap2: new package

From: Adam Duskett <[email protected]>

Smmap wraps an interface around mmap and tracks the mapped files as well as the amount of clients who use it. If the system runs out of resources, or if a memory limit is reached, it will automatically unload unused maps to allow continued operation.

---
 DEVELOPERS                               |  1 +
 package/Config.in                        |  1 +
 package/python-smmap2/Config.in          | 10 ++++++++++
 package/python-smmap2/python-smmap2.hash |  5 +++++
 package/python-smmap2/python-smmap2.mk   | 14 ++++++++++++++
 5 files changed, 31 insertions(+)
 create mode 100644 package/python-smmap2/Config.in
 create mode 100644 package/python-smmap2/python-smmap2.hash
 create mode 100644 package/python-smmap2/python-smmap2.mk
DEVELOPERS +1 -0
index 16e8510b0a..e422aa2651 100644
@@ -64,6 +64,7 @@ F:	package/python-flask-sqlalchemy/
 F:	package/python-mutagen/
 F:	package/python-pip/
 F:	package/python-psycopg2/
+F:	package/python-smmap2/
 F:	package/python-sqlalchemy/
 F:	package/python-sqlparse/
 F:	package/python-visitor/
package/Config.in +1 -0
index 37861387e8..a5b28de101 100644
@@ -1102,6 +1102,7 @@ menu "External python modules"
 	source "package/python-six/Config.in"
 	source "package/python-slob/Config.in"
 	source "package/python-smbus-cffi/Config.in"
+	source "package/python-smmap2/Config.in"
 	source "package/python-socketio/Config.in"
 	source "package/python-sortedcontainers/Config.in"
 	source "package/python-soupsieve/Config.in"
package/python-smmap2/Config.in new file +10 -0
new file mode 100644
index 0000000000..21a3bdb613
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_PYTHON_SMMAP2
+	bool "python-smmap2"
+	help
+	  Smmap wraps an interface around mmap and tracks the mapped
+	  files as well as the amount of clients who use it. If the
+	  system runs out of resources, or if a memory limit is reached,
+	  it will automatically unload unused maps to allow continued
+	  operation.
+
+	  https://github.com/gitpython-developers/smmap
package/python-smmap2/python-smmap2.hash new file +5 -0
new file mode 100644
index 0000000000..8a7ea42a5d
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/smmap2/json
+md5	1c59a985be5aa645c4c5a4e063a40dd5  smmap2-2.0.5.tar.gz
+sha256	29a9ffa0497e7f2be94ca0ed1ca1aa3cd4cf25a1f6b4f5f87f74b46ed91d609a  smmap2-2.0.5.tar.gz
+# Locally computed sha256 checksums
+sha256	88e9d93f708d110b328a834302dd1d5c6afbda530e7721d15d80b3511d86f235  LICENSE
package/python-smmap2/python-smmap2.mk new file +14 -0
new file mode 100644
index 0000000000..daf379fe1a
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-smmap2
+#
+################################################################################
+
+PYTHON_SMMAP2_VERSION = 2.0.5
+PYTHON_SMMAP2_SOURCE = smmap2-$(PYTHON_SMMAP2_VERSION).tar.gz
+PYTHON_SMMAP2_SITE = https://files.pythonhosted.org/packages/3b/ba/e49102b3e8ffff644edded25394b2d22ebe3e645f3f6a8139129c4842ffe
+PYTHON_SMMAP2_SETUP_TYPE = setuptools
+PYTHON_SMMAP2_LICENSE = BSD-3-Clause
+PYTHON_SMMAP2_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/2 support/testing: add smmap2 test

From: Adam Duskett <[email protected]>

Add a simple test case that imports the module and instantiates a new SlidingWindowMapManager class.

---
 .gitlab-ci.yml                                |  2 ++
 .../tests/package/sample_python_smmap2.py     |  6 ++++++
 .../tests/package/test_python_smmap2.py       | 21 +++++++++++++++++++
 3 files changed, 29 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_smmap2.py
 create mode 100644 support/testing/tests/package/test_python_smmap2.py
.gitlab-ci.yml +2 -0
index 22befa0427..f48e188dd0 100644
@@ -460,6 +460,8 @@ tests.package.test_python_pyyaml.TestPythonPy2Pyyaml: { extends: .runtime_test }
 tests.package.test_python_pyyaml.TestPythonPy3Pyyaml: { extends: .runtime_test }
 tests.package.test_python_service_identity.TestPythonPy2ServiceIdentity: { extends: .runtime_test }
 tests.package.test_python_service_identity.TestPythonPy3ServiceIdentity: { extends: .runtime_test }
+tests.package.test_python_smmap2.TestPythonPy2Smmap2: { extends: .runtime_test }
+tests.package.test_python_smmap2.TestPythonPy3Smmap2: { extends: .runtime_test }
 tests.package.test_python_subprocess32.TestPythonPy2Subprocess32: { extends: .runtime_test }
 tests.package.test_python_treq.TestPythonPy2Treq: { extends: .runtime_test }
 tests.package.test_python_treq.TestPythonPy3Treq: { extends: .runtime_test }
support/testing/tests/package/sample_python_smmap2.py new file +6 -0
new file mode 100644
index 0000000000..494fc26e89
@@ -0,0 +1,6 @@
+# Taken from smmap/test/test_tutorial.py
+
+import smmap
+mman = smmap.SlidingWindowMapManager()
+assert mman.num_file_handles() == 0
+assert mman.mapped_memory_size() == 0
support/testing/tests/package/test_python_smmap2.py new file +21 -0
new file mode 100644
index 0000000000..07c0e6621e
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Smmap2(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON=y
+        BR2_PACKAGE_PYTHON_SMMAP2=y
+        """
+    sample_scripts = ["tests/package/sample_python_smmap2.py"]
+
+
+class TestPythonPy3Smmap2(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_SMMAP2=y
+        """
+    sample_scripts = ["tests/package/sample_python_smmap2.py"]
Signature · 1 line
2.23.0
#2 lore raw

PATCH 1/2 package/python-smmap2: new package

In reply to aduskett at gmail.com
Quoted 8 lines · On Fri, 29 Nov 2019 12:38:40 -0800 aduskett at gmail.com wrote:

From: Adam Duskett <[email protected]>

Smmap wraps an interface around mmap and tracks the mapped files as well as the amount of clients who use it. If the system runs out of resources, or if a memory limit is reached, it will automatically unload unused maps to allow continued operation.

Quoted 10 lines
---
 DEVELOPERS                               |  1 +
 package/Config.in                        |  1 +
 package/python-smmap2/Config.in          | 10 ++++++++++
 package/python-smmap2/python-smmap2.hash |  5 +++++
 package/python-smmap2/python-smmap2.mk   | 14 ++++++++++++++
 5 files changed, 31 insertions(+)
 create mode 100644 package/python-smmap2/Config.in
 create mode 100644 package/python-smmap2/python-smmap2.hash
 create mode 100644 package/python-smmap2/python-smmap2.mk

Both applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com