From nobody Thu Dec 18 20:37:02 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1E631E4BE for ; Thu, 19 Dec 2024 01:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734571622; cv=none; b=PnCAPZl8hUVIWkCR4JPsardTZZkROYCIfN4qyFhggzfPOFLqBhDeCk5yxMl1MHAkdT3X+Jh8nFppJuiniJAXAOrMWsrg3TJ3WGDmozFUjkIpw1odC/wp0pOLwTHq+2C2RE77YECPBEZcapc9gmDewA8OEKclbYnJ74gC92lAYnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734571622; c=relaxed/simple; bh=99wPxfN53ST3AJXTzazPQKk4Xg2gm6uJg1UvVQ3McAY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pYVvm+pEQwhpIRbO83LF1iq0LLGsA+Lb2CJQhJBZ+iYNx9RmpEZBw/TJ0cXzsiXQEA30SswWNtoO91g7GA4K8hBdUQ6t+uxTU4e3C0Xz9czveL/3+twdsdJEhsI9TtHZlOlbGtvKlTmj9QL1B86bT7nnvcorfoJOw8M8nrjJTbA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QPXg7s8B; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QPXg7s8B" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734571617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=neKHHOrqLKTUJZm/c1ca9O8pPG3z2Q1aYrdHAAhgiWs=; b=QPXg7s8BSC7/VyyDyKkiiYlYLu3nY2E7R8zWIuyCv5Shtu94zPGWhAHilUzh7FXat7YITr 0al46y4ne2yMruWlykwD/VHqYrPdgMOXUD4vQjuShLz9BGoDhz1fBAUbqIS30tgKxCH/Im eywV4klDacO3kZyX+6tDB/hj2vm1xj8= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-493-XHQ2mkigOfKkkcoXGWm75w-1; Wed, 18 Dec 2024 20:26:56 -0500 X-MC-Unique: XHQ2mkigOfKkkcoXGWm75w-1 X-Mimecast-MFC-AGG-ID: XHQ2mkigOfKkkcoXGWm75w Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-468f80bc82fso4327861cf.1 for ; Wed, 18 Dec 2024 17:26:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734571616; x=1735176416; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=neKHHOrqLKTUJZm/c1ca9O8pPG3z2Q1aYrdHAAhgiWs=; b=SJaJTfLnlYKtQBCxMdSnqyhkvn4n/BuMnnO+b7Q8u8eHvWNHrQk/HrGfk4rok6u/kL zE/509Uv6U05QQp5O7kckBltEpz8FVyiNVZaEP+glQCWWb6H5V8v2YcVfcMnxfFQ3x/Q KgfgY+k0ZOgJjVYCsZQ16B/9dHF4240kGCTAgvMRYdEPB9yvkrMnieK0iK04nJroqQ8T qucg/rsxizK+kQgzGVffQpDnSkwaKczJmG92/dhPRB5L7ouostDYzx9PKT7vH98SBbfd tt9xpcBiVH8VgCMBqiSjlV/o0GPdRE+MxI7R66Lq5mhxe6mJPOeI0h2VlN7DTpYoUAo9 Fxlg== X-Forwarded-Encrypted: i=1; AJvYcCWuHA7zdZNgUZAfHuXy8JHcIML27E0+URwnbyeowUlrc+J6lRe1kQRNUmySSDTAKxAQ+diKdSJRj/wUbfg=@vger.kernel.org X-Gm-Message-State: AOJu0YzdjB+IXjgWk3MAsKBjHDtQRLuW+Q+DWw9PhTqzZJukZu3V18F7 ZFfL2fWZNyT5vFglxm48apxdjMUuJBmJc9FLjbUWd6cS0/Llmq6MVAvH4mB6qbZKzjkxzIJWXiW dGnW/HFKIc12V2bj439ZMGI/wBkPi29c2IO1sq5qJ7g9UVNXWIrXt+VB4XCPFtQ== X-Gm-Gg: ASbGnctb0w9jM9ku/HGbjSa4uHnLC28dBlNy4lvYi/jO4YRyqOxVPe5eAC6ZniI+u+O JdLYb16i3sahq4lgppSypEfoaKepHZPYf6ffV7G1B2W2CPCEj1FmMZ6rficj5gWKykWEWKuYgyS Hvx17RAycQY0xFlPSb5zCuV2Jzm/bm1SMgiV5X+/3QGTMjXZ4cGpA9NDEgILnBAtbQVBFa/Ez/w zACmXJ1CCk1BJu+mjZuzEntbAV9tsqmiKH5/WW6f2iO6g3p7dim89NxZsnz+6z2N8cA X-Received: by 2002:a05:6214:e6d:b0:6d8:8a60:ef24 with SMTP id 6a1803df08f44-6dd0918e5b5mr92324186d6.9.1734571615896; Wed, 18 Dec 2024 17:26:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2yDULLdpZOuZJSxavMDC9v15EeM2OTT0Cf1nbCHYB7AD7elp9vtO9jnuLUeqVHgDWiRJ92g== X-Received: by 2002:a05:6214:e6d:b0:6d8:8a60:ef24 with SMTP id 6a1803df08f44-6dd0918e5b5mr92323866d6.9.1734571615559; Wed, 18 Dec 2024 17:26:55 -0800 (PST) Received: from thinkpad2024.redhat.com ([71.217.66.209]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dd181d82fbsm1567176d6.123.2024.12.18.17.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 17:26:55 -0800 (PST) From: "John B. Wyatt IV" To: Shuah Khan , Thomas Renninger Cc: "John B. Wyatt IV" , linux-pm@vger.kernel.org, Shuah Khan , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, John Kacur , "John B. Wyatt IV" Subject: [PATCH] pm: cpupower: Add install and uninstall options to bindings makefile Date: Wed, 18 Dec 2024 20:26:02 -0500 Message-ID: <20241219012606.38963-1-jwyatt@redhat.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Installs the .so and .py files generated by SWIG to system's site packages directory. This allows the Python bindings to be used system wide. This commit also includes documentation on setting up and installing the Python bindings. Signed-off-by: "John B. Wyatt IV" Signed-off-by: "John B. Wyatt IV" --- tools/power/cpupower/bindings/python/Makefile | 10 ++++++++ tools/power/cpupower/bindings/python/README | 25 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/tools/power/cpupower/bindings/python/Makefile b/tools/power/cp= upower/bindings/python/Makefile index e1ebb1d60cd4..741f21477432 100644 --- a/tools/power/cpupower/bindings/python/Makefile +++ b/tools/power/cpupower/bindings/python/Makefile @@ -11,6 +11,7 @@ HAVE_PYCONFIG :=3D $(shell if which python-config >/dev/n= ull 2>&1; then echo 1; el LIB_DIR :=3D ../../lib PY_INCLUDE =3D $(firstword $(shell python-config --includes)) OBJECTS_LIB =3D $(wildcard $(LIB_DIR)/*.o) +INSTALL_DIR =3D $(shell python3 -c "import site; print(site.getsitepackage= s()[0])") =20 all: _raw_pylibcpupower.so =20 @@ -28,6 +29,15 @@ else ifeq ($(HAVE_PYCONFIG),0) endif swig -python raw_pylibcpupower.swg =20 +# Only installs the Python bindings +install: _raw_pylibcpupower.so + install -D _raw_pylibcpupower.so $(INSTALL_DIR)/_raw_pylibcpupower.so + install -D raw_pylibcpupower.py $(INSTALL_DIR)/raw_pylibcpupower.py + +uninstall: + rm -f $(INSTALL_DIR)/_raw_pylibcpupower.so + rm -f $(INSTALL_DIR)/raw_pylibcpupower.py + # Will only clean the bindings folder; will not clean the actual cpupower = folder clean: rm -f raw_pylibcpupower.py raw_pylibcpupower_wrap.c raw_pylibcpupower_wra= p.o _raw_pylibcpupower.so diff --git a/tools/power/cpupower/bindings/python/README b/tools/power/cpup= ower/bindings/python/README index 0a4bb2581e8a..952e2e02fd32 100644 --- a/tools/power/cpupower/bindings/python/README +++ b/tools/power/cpupower/bindings/python/README @@ -48,6 +48,31 @@ To run the test script: $ python test_raw_pylibcpupower.py =20 =20 +developing/using the bindings directly +-------------------------------------- + +You need to add the Python bindings directory to your $PYTHONPATH. + +You would set the path in the Bash terminal or in the Bash profile: + +PYTHONPATH=3D~/linux/tools/power/cpupower/bindings/python:$PYTHONPATH + +This allows you to set a specific repo of the bindings to use. + + +installing/uninstalling +----------------------- + +Python uses a system specific site-packages folder to look up modules to i= mport +by default. You do not need to install cpupower to use the SWIG bindings. + +You can install and uninstall the bindings to the site-packages with: + +sudo make install + +sudo make uninstall + + credits ------- =20 --=20 2.47.1