diff mbox series

[v5,2/2] package/python-pgcopy: new package

Message ID 20241030145910.2523465-2-fancp2007@gmail.com
State New
Headers show
Series [v5,1/2] package/python-psycopg2: add config dependencies from postgresql | expand

Commit Message

Scott Fan Oct. 30, 2024, 2:59 p.m. UTC
Signed-off-by: Scott Fan <fancp2007@gmail.com>

---
Changes v1 -> v2:
  - add missing config menu entry in Config.in

Changes v2 -> v3:
  - fix help text indent in Config.in

Changes v3 -> v4:
  - add missing dependencies in the Config.in file
  - add a comment for the hook PYTHON_PGCOPY_CLEAN_PY2_SCRIPT
  - remove the pre configure hook PYTHON_PGCOPY_CREATE_SETUP_CFG

Changes v4 -> v5:
  - remove the postgresql dependency, python-psycopg2 has select it
---
 DEVELOPERS                               |  3 +++
 package/Config.in                        |  1 +
 package/python-pgcopy/Config.in          | 20 ++++++++++++++++++++
 package/python-pgcopy/python-pgcopy.hash |  5 +++++
 package/python-pgcopy/python-pgcopy.mk   | 21 +++++++++++++++++++++
 5 files changed, 50 insertions(+)
 create mode 100644 package/python-pgcopy/Config.in
 create mode 100644 package/python-pgcopy/python-pgcopy.hash
 create mode 100644 package/python-pgcopy/python-pgcopy.mk
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 76f15f708a..f7cfbf3ad5 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2923,6 +2923,9 @@  F:	package/lrzip/
 N:	Sam Voss <sam.voss@gmail.com>
 F:	package/ripgrep/
 
+N:	Scott Fan <fancp2007@gmail.com>
+F:	package/python-pgcopy/
+
 N:	Sébastien Szymanski <sebastien.szymanski@armadeus.com>
 F:	board/armadeus/
 F:	configs/armadeus*
diff --git a/package/Config.in b/package/Config.in
index b1e999a63b..eda877bce3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1259,6 +1259,7 @@  menu "External python modules"
 	source "package/python-pathvalidate/Config.in"
 	source "package/python-periphery/Config.in"
 	source "package/python-pexpect/Config.in"
+	source "package/python-pgcopy/Config.in"
 	source "package/python-pickleshare/Config.in"
 	source "package/python-piexif/Config.in"
 	source "package/python-pigpio/Config.in"
diff --git a/package/python-pgcopy/Config.in b/package/python-pgcopy/Config.in
new file mode 100644
index 0000000000..424860899e
--- /dev/null
+++ b/package/python-pgcopy/Config.in
@@ -0,0 +1,20 @@ 
+config BR2_PACKAGE_PYTHON_PGCOPY
+	bool "python-pgcopy"
+	depends on BR2_USE_MMU # python-psycopg2
+	depends on BR2_USE_WCHAR # python-psycopg2
+	depends on !BR2_STATIC_LIBS # python-psycopg2
+	depends on !BR2_OPTIMIZE_FAST # python-psycopg2
+	select BR2_PACKAGE_PYTHON_PSYCOPG2
+	select BR2_PACKAGE_PYTHON_PYTZ
+	help
+	  Use pgcopy for fast data loading into PostgreSQL with
+	  binary copy.
+
+	  https://github.com/altaurog/pgcopy
+
+comment "python-pgcopy needs a toolchain w/ dynamic library, wchar"
+	depends on BR2_USE_MMU
+	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR
+
+comment "python-pgcopy can't be built with Optimize for fast"
+	depends on BR2_OPTIMIZE_FAST
diff --git a/package/python-pgcopy/python-pgcopy.hash b/package/python-pgcopy/python-pgcopy.hash
new file mode 100644
index 0000000000..9fa7990877
--- /dev/null
+++ b/package/python-pgcopy/python-pgcopy.hash
@@ -0,0 +1,5 @@ 
+# md5, sha256 from https://pypi.org/pypi/pgcopy/json
+md5  bb7940ed821f54f32705c462f7582458  pgcopy-1.6.0.tar.gz
+sha256  0da9235eea4ee9ceb4f52b97523bc89db9a6f8e80f897b49214e814ea13d04b0  pgcopy-1.6.0.tar.gz
+# Locally computed sha256 checksums
+sha256  969191428cb0729e689468bdcd152291a4e168875755c97745cd2df6de5520c1  LICENSE.txt
diff --git a/package/python-pgcopy/python-pgcopy.mk b/package/python-pgcopy/python-pgcopy.mk
new file mode 100644
index 0000000000..376f8649a9
--- /dev/null
+++ b/package/python-pgcopy/python-pgcopy.mk
@@ -0,0 +1,21 @@ 
+################################################################################
+#
+# python-pgcopy
+#
+################################################################################
+
+PYTHON_PGCOPY_VERSION = 1.6.0
+PYTHON_PGCOPY_SOURCE = pgcopy-$(PYTHON_PGCOPY_VERSION).tar.gz
+PYTHON_PGCOPY_SITE = https://files.pythonhosted.org/packages/b0/7d/a5c833f921b20cdb1e8538e72a6065bcc67bbb270fa7a35e98f2d397ce0c
+PYTHON_PGCOPY_SETUP_TYPE = setuptools
+PYTHON_PGCOPY_LICENSE = MIT
+PYTHON_PGCOPY_LICENSE_FILES = LICENSE.txt
+PYTHON_PGCOPY_DEPENDENCIES = python-psycopg2 python-pytz
+
+# Remove the file only for Python 2, it will cause compilation errors
+define PYTHON_PGCOPY_CLEAN_PY2_SCRIPT
+	$(RM) $(@D)/pgcopy/errors/py2.py
+endef
+PYTHON_PGCOPY_POST_EXTRACT_HOOKS += PYTHON_PGCOPY_CLEAN_PY2_SCRIPT
+
+$(eval $(python-package))