From patchwork Thu Jul 7 17:42:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Nordahl X-Patchwork-Id: 1653736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=jIS6EkvK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf3ds1YnGz9s09 for ; Fri, 8 Jul 2022 03:42:41 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 00C7F612BA; Thu, 7 Jul 2022 17:42:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 00C7F612BA Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=jIS6EkvK X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OlDsLPaO1NjJ; Thu, 7 Jul 2022 17:42:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id EBC20612A4; Thu, 7 Jul 2022 17:42:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EBC20612A4 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 061E7C007F; Thu, 7 Jul 2022 17:42:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id AA797C007E for ; Thu, 7 Jul 2022 17:42:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8341041B7A for ; Thu, 7 Jul 2022 17:42:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8341041B7A Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=jIS6EkvK X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XEy-jbQqcAPb for ; Thu, 7 Jul 2022 17:42:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 81A3D41B73 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by smtp4.osuosl.org (Postfix) with ESMTPS id 81A3D41B73 for ; Thu, 7 Jul 2022 17:42:29 +0000 (UTC) Received: from frode-threadripper.. (ti0189a330-0179.bb.online.no [88.91.31.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 9E7313F93D; Thu, 7 Jul 2022 17:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1657215747; bh=uMNT/rTzOB0rwFrb40oz/yqRJnYpC4rCQ2k6iJfoH88=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jIS6EkvKEykZxs9T42aO0hQzMmvuJLURLb5gdJRellBF3cU6BoeRCj1aLATGe+9uu PZUZOFIHZoh3iZ2OLhnq/KwuhzkkbUFOFRGFWe/Shks3WaM6eamrPytMlIn0PiZaVF gpOrSQJFdpAbgqeyBC+UBRP1LYG7xoNCVx+KW5SXsbaJ31nRK4KDTi+SDjeBJwkjGs ENbx8o+QNMJRcLpckPEV/AK02BRxCRlO+mOQbwWwzDxTcr7prJsoAsHeEgLFX5la7q 4gOBnIxmDOEebe7isDJIE5yVWife6XDZWMDyPJRDAfgSKOhwiOkb2o47U70K3b1HB6 l/LXGmzQmqi7w== From: Frode Nordahl To: dev@openvswitch.org Date: Thu, 7 Jul 2022 19:42:20 +0200 Message-Id: <20220707174223.923183-5-frode.nordahl@canonical.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707174223.923183-1-frode.nordahl@canonical.com> References: <20220707174223.923183-1-frode.nordahl@canonical.com> MIME-Version: 1.0 Cc: Corey Bryant , Luca Boccassi , Ilya Maximets Subject: [ovs-dev] [PATCH v3 5/8] python: Allow building json C extension with static OVS library. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Allow caller of setup.py to pass in libopenvswitch.a as an object for linking through the use of LDFLAGS environment variable when not building a shared openvswitch library. To accomplish this set the `enable_shared` environment variable to 'no'. Example: LDFLAGS=lib/libopenvswitch.a enable_shared=no setup.py install Signed-off-by: Frode Nordahl --- python/setup.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/setup.py b/python/setup.py index cfe01763f..369110531 100644 --- a/python/setup.py +++ b/python/setup.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import sys from distutils.command.build_ext import build_ext @@ -63,6 +64,15 @@ class try_build_ext(build_ext): raise BuildFailed() +# allow caller of setup.py to pass in libopenvswitch.a as an object for linking +# through the use of LDFLAGS environment variable when not building a shared +# openvswitch library. +if os.environ.get('enable_shared', '') == 'no': + json_libraries = [] +else: + json_libraries = ['openvswitch'] + + setup_args = dict( name='ovs', description='Open vSwitch library', @@ -85,7 +95,7 @@ setup_args = dict( 'Programming Language :: Python :: 3.5', ], ext_modules=[setuptools.Extension("ovs._json", sources=["ovs/_json.c"], - libraries=['openvswitch'])], + libraries=json_libraries)], cmdclass={'build_ext': try_build_ext}, install_requires=['sortedcontainers'], extras_require={':sys_platform == "win32"': ['pywin32 >= 1.0']},