From patchwork Tue Feb 6 13:25:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 869766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="n2dJtd83"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zbQFG57Wyz9sBW for ; Wed, 7 Feb 2018 00:25:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2B840878DB; Tue, 6 Feb 2018 13:25:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XfIdqjb0nbGI; Tue, 6 Feb 2018 13:25:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 2D6D087369; Tue, 6 Feb 2018 13:25:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id D512B1CEF75 for ; Tue, 6 Feb 2018 13:25:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D192087369 for ; Tue, 6 Feb 2018 13:25:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dbj84NXIOvxj for ; Tue, 6 Feb 2018 13:25:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) by whitealder.osuosl.org (Postfix) with ESMTPS id CD72B87233 for ; Tue, 6 Feb 2018 13:25:30 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id n206so2422307itg.1 for ; Tue, 06 Feb 2018 05:25:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=aPpYxD0S85p6x2fSLwYdBxrNmG6A+rsbW+HlwLz7uTQ=; b=n2dJtd83daOOI91Obg4of8OMMEOhAt+Mh11p1CgLv9mOqkgBgPcX7kNsxIGEdGStL2 I/sKG6R+SXcX7GMSavvhi8vFkXgC1CKWjGEUQd8QxdpsgIsW3UVyLE0DBKNYMqXIhQd0 TW+cPpeyCdJSYctRR2ANGMsdpuUcusVMSpltWqV5HqpzvBS/oLNUHxBhHilVJNYxqgkZ JFvzjd9ePepCaItD/fSYpOUPsvW0IRkYQNNiIoIhNUoPti2u1Sht3l609xFPYyoyH0pC OE9AFcp6Ce4xGNoQ+Q3LjMIguqH5SSBVd/pILEWlvQhUnj6G4jE+No9JOpftQlgH2Ls7 iPtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aPpYxD0S85p6x2fSLwYdBxrNmG6A+rsbW+HlwLz7uTQ=; b=uO8+j768fWOCT8xbRV9rAEU3xSbvoSJyu2ieW14NV1j8LYcKGXMM5nqRCVJqeAKisg PQPrDjHNCmYaI/lAnwM+cuDiOl2B+qy+JUhy9bOoemHVJBsQfUyGfSo48Bu9UKN14yIR bg/n5wQOv5WsAIRDHCWdfDx+EQO+1M2kpSf6cSSAjms/7wZqmfQv32Qe1/FXHgK+EcBS sp+LAA5PAIQtJ/exNGrWfhNuR9U+hDzzd/3kmBuAEDKbwVSX6CJqQ9sKWLT1UkX/0GTi bElBRHxSSsp+q0ibXLVh42EIpOwYX7jFADnmI4ryfw2OA6dq3w54PZ7iqc0pF/RiINGC WL7w== X-Gm-Message-State: APf1xPAMm59DA7HUx9li40VKhHFOelS2VlPxp7JomnFs8/o/NIU9oFlA Odoll06A5CUk8TwGaxFXsyAHSle5 X-Google-Smtp-Source: AH8x225m1D1mvQpA+GwlMAlFLeSTkEVJwRWWzdw7YaKiwvSnIAE7RVOVZuEXs4Xm7ND5q6GZz4Dkqw== X-Received: by 10.36.204.139 with SMTP id x133mr3113625itf.75.1517923529793; Tue, 06 Feb 2018 05:25:29 -0800 (PST) Received: from localhost.localdomain (mail.codeblue.com. [65.183.183.198]) by smtp.gmail.com with ESMTPSA id m14sm6201325iti.3.2018.02.06.05.25.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 05:25:28 -0800 (PST) From: Adam Duskett To: buildroot@buildroot.org Date: Tue, 6 Feb 2018 08:25:02 -0500 Message-Id: <20180206132506.30389-1-aduskett@gmail.com> X-Mailer: git-send-email 2.14.3 Subject: [Buildroot] [PATCH v2 1/5] python-psycopg2: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Adam Duskett MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 Reviewed-by: Yegor Yefremov --- 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 +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 +Signed-off-by: Huang Qiyu +[aduskett@gmail.com: Update for psycopg2 2.7.3.2] +Signed-off-by: Adam Duskett +--- + 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))