All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Duskett <aduskett@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/5] python-psycopg2: new package
Date: Tue,  6 Feb 2018 08:25:02 -0500	[thread overview]
Message-ID: <20180206132506.30389-1-aduskett@gmail.com> (raw)

Psycopg is the most popular PostgreSQL database adapter for the Python
programming language. Its main features are the complete implementation of the
Python DB API 2.0 specification and the thread safety (several threads can
share the same connection). It was designed for heavily multi-threaded
applications that create and destroy lots of cursors and make a large number of
concurrent INSERTs or UPDATEs.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
Changes v1 -> v2:
  - None

 DEVELOPERS                                         |  1 +
 package/Config.in                                  |  1 +
 .../python-psycopg2/0001-don-t-use-pg_config.patch | 49 ++++++++++++++++++++++
 package/python-psycopg2/Config.in                  | 23 ++++++++++
 package/python-psycopg2/python-psycopg2.hash       |  4 ++
 package/python-psycopg2/python-psycopg2.mk         | 20 +++++++++
 6 files changed, 98 insertions(+)
 create mode 100644 package/python-psycopg2/0001-don-t-use-pg_config.patch
 create mode 100644 package/python-psycopg2/Config.in
 create mode 100644 package/python-psycopg2/python-psycopg2.hash
 create mode 100644 package/python-psycopg2/python-psycopg2.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index c524cb6ac5..8cf0836a1a 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -52,6 +52,7 @@ F:	package/libsepol/
 F:	package/nginx-naxsi/
 F:	package/policycoreutils/
 F:	package/python-mutagen/
+F:	package/python-psycopg2/
 F:	package/restorecond/
 F:	package/refpolicy/
 F:	package/selinux-python/
diff --git a/package/Config.in b/package/Config.in
index 9cd5d9c087..b039dea58f 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -844,6 +844,7 @@ menu "External python modules"
 	source "package/python-prompt-toolkit/Config.in"
 	source "package/python-protobuf/Config.in"
 	source "package/python-psutil/Config.in"
+	source "package/python-psycopg2/Config.in"
 	source "package/python-ptyprocess/Config.in"
 	source "package/python-pudb/Config.in"
 	source "package/python-pyasn/Config.in"
diff --git a/package/python-psycopg2/0001-don-t-use-pg_config.patch b/package/python-psycopg2/0001-don-t-use-pg_config.patch
new file mode 100644
index 0000000000..e82e61b514
--- /dev/null
+++ b/package/python-psycopg2/0001-don-t-use-pg_config.patch
@@ -0,0 +1,49 @@
+From 92d42775735d1555449b860c214ca7265d7ad75b Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <mark.asselstine@windriver.com>
+Date: Tue, 24 Jan 2017 00:43:35 +0900
+Subject: [PATCH] setup: don't use pg_config
+
+pg_config is used to get library and include directories, and the postgresql
+version. All of which is not available in the cross compiled version.
+
+Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
+Signed-off-by: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
+[aduskett at gmail.com: Update for psycopg2 2.7.3.2]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+---
+ setup.py | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 86f32d2..05b8eeb 100644
+--- a/setup.py
++++ b/setup.py
+@@ -404,16 +404,13 @@ class psycopg_build_ext(build_ext):
+             self.libraries.append("pq")
+
+         try:
+-            self.library_dirs.append(pg_config_helper.query("libdir"))
+-            self.include_dirs.append(pg_config_helper.query("includedir"))
+-            self.include_dirs.append(pg_config_helper.query("includedir-server"))
+             try:
+                 # Here we take a conservative approach: we suppose that
+                 # *at least* PostgreSQL 7.4 is available (this is the only
+                 # 7.x series supported by psycopg 2)
+                 pgversion = pg_config_helper.query("version").split()[1]
+             except:
+-                pgversion = "7.4.0"
++                pgversion = str(os.environ['PSYCOPG2_POSTGRESQL_VERSION'])
+
+             verre = re.compile(
+                 r"(\d+)(?:\.(\d+))?(?:(?:\.(\d+))|(devel|(?:alpha|beta|rc)\d+))?")
+@@ -525,6 +522,7 @@ parser.read('setup.cfg')
+ # Choose a datetime module
+ have_pydatetime = True
+ have_mxdatetime = False
++pg_config="/bin/true"
+ use_pydatetime = int(parser.get('build_ext', 'use_pydatetime'))
+
+ # check for mx package
+--
+2.14.3
+
diff --git a/package/python-psycopg2/Config.in b/package/python-psycopg2/Config.in
new file mode 100644
index 0000000000..c861ac2284
--- /dev/null
+++ b/package/python-psycopg2/Config.in
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_PYTHON_PSYCOPG2
+       bool "python-psycopg2"
+       select BR2_PACKAGE_POSTGRESQL
+       help
+         Psycopg is the most popular PostgreSQL database adapter for
+         the Python programming language. Its main features are the
+         complete implementation of the Python DB API 2.0 specification
+         and the thread safety (several threads can share the same
+         connection). It was designed for heavily multi-threaded
+         applications that create and destroy lots of cursors and make
+         a large number of concurrent INSERTs or UPDATEs.
+
+         Psycopg 2 is mostly implemented in C as a libpq wrapper,
+         resulting in being both efficient and secure. It features
+         client-side and server-side cursors, asynchronous
+         communication and notifications, COPY support. Many Python
+         types are supported out-of-the-box and adapted to matching
+         PostgreSQL data types; adaptation can be extended and
+         customized thanks to a flexible objects adaptation system.
+
+         Psycopg 2 is both Unicode and Python 3 friendly.
+
+         http://initd.org/psycopg/
diff --git a/package/python-psycopg2/python-psycopg2.hash b/package/python-psycopg2/python-psycopg2.hash
new file mode 100644
index 0000000000..a2cbb1f186
--- /dev/null
+++ b/package/python-psycopg2/python-psycopg2.hash
@@ -0,0 +1,4 @@
+# md5 from https://pypi.python.org/pypi/psycopg2/json, sha256 locally computed
+md5    8114e672d5f23fa5329874a4314fbd6f  psycopg2-2.7.3.2.tar.gz
+sha256 5c3213be557d0468f9df8fe2487eaf2990d9799202c5ff5cb8d394d09fad9b2a  psycopg2-2.7.3.2.tar.gz
+sha256 1752db3c786e12b62ca804178dca033adce8bff4c4b3d98d3449d407fe45210d  LICENSE
diff --git a/package/python-psycopg2/python-psycopg2.mk b/package/python-psycopg2/python-psycopg2.mk
new file mode 100644
index 0000000000..2d50624433
--- /dev/null
+++ b/package/python-psycopg2/python-psycopg2.mk
@@ -0,0 +1,20 @@
+################################################################################
+#
+# python-psycopg2
+#
+################################################################################
+
+PYTHON_PSYCOPG2_VERSION = 2.7.3.2
+PYTHON_PSYCOPG2_SOURCE = psycopg2-$(PYTHON_PSYCOPG2_VERSION).tar.gz
+PYTHON_PSYCOPG2_SITE = https://pypi.python.org/packages/dd/47/000b405d73ca22980684fd7bd3318690cc03cfa3b2ae1c5b7fff8050b28a
+PYTHON_PSYCOPG2_SETUP_TYPE = setuptools
+PYTHON_PSYCOPG2_LICENSE = LGPL-3.0+
+PYTHON_PSYCOPG2_LICENSE_FILES = LICENSE
+PYTHON_PSYCOPG2_DEPENDENCIES = postgresql
+
+# Force psycopg2 to use the BuildRoot provided postgresql version instead of
+# The host machines
+PYTHON_PSYCOPG2_ENV += \
+       PSYCOPG2_POSTGRESQL_VERSION=$(POSTGRESQL_VERSION)
+
+$(eval $(python-package))
-- 
2.14.3

             reply	other threads:[~2018-02-06 13:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 13:25 Adam Duskett [this message]
2018-02-06 13:25 ` [Buildroot] [PATCH v2 2/5] python-sqlalchemy: new package Adam Duskett
2018-02-06 13:38   ` Yegor Yefremov
2018-02-10 15:21   ` Thomas Petazzoni
2018-02-06 13:25 ` [Buildroot] [PATCH v2 3/5] python-flask-sqlalchemy: " Adam Duskett
2018-02-06 13:37   ` Yegor Yefremov
2018-02-10 15:28   ` Thomas Petazzoni
2018-02-06 13:25 ` [Buildroot] [PATCH v2 4/5] python-visitor: " Adam Duskett
2018-02-06 13:37   ` Yegor Yefremov
2018-04-27 21:27   ` Thomas Petazzoni
2018-02-06 13:25 ` [Buildroot] [PATCH v2 5/5] python-flask-bootstrap: " Adam Duskett
2018-02-06 13:37   ` Yegor Yefremov
2018-04-27 21:33   ` Thomas Petazzoni
2018-04-28  5:15     ` Yegor Yefremov
2018-04-28 10:17       ` Thomas Petazzoni
2018-05-02  9:37         ` Yegor Yefremov
2018-09-16 20:05   ` Thomas Petazzoni
2018-02-10 15:22 ` [Buildroot] [PATCH v2 1/5] python-psycopg2: " Thomas Petazzoni
2018-02-10 17:40   ` Yegor Yefremov
2018-02-12 12:06     ` Adam Duskett
2018-02-12 13:48       ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180206132506.30389-1-aduskett@gmail.com \
    --to=aduskett@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.