2024-09-04 22:19:09 -04:00
|
|
|
This folder contains the necessary files to build the Python bindings for
|
|
|
|
libcpupower (aside from the libcpupower object files).
|
|
|
|
|
|
|
|
|
|
|
|
requirements
|
|
|
|
------------
|
|
|
|
|
2025-04-29 16:47:10 -04:00
|
|
|
* If you are building completely from upstream; please install libcpupower by
|
|
|
|
running `make install-lib` within the cpupower directory. This installs the
|
|
|
|
libcpupower.so file and symlinks needed. Otherwise, please make sure a symlink
|
|
|
|
to libcpupower.so exists in your library path from your distribution's
|
|
|
|
packages.
|
2024-09-04 22:19:09 -04:00
|
|
|
* The SWIG program must be installed.
|
2025-04-29 16:47:10 -04:00
|
|
|
* The Python's development libraries must be installed.
|
2024-09-04 22:19:09 -04:00
|
|
|
|
|
|
|
Please check that your version of SWIG is compatible with the version of Python
|
|
|
|
installed on your machine by checking the SWIG changelog on their website.
|
|
|
|
https://swig.org/
|
|
|
|
|
|
|
|
Note that while SWIG itself is GPL v3+ licensed; the resulting output,
|
2025-04-29 16:47:10 -04:00
|
|
|
the bindings code: is permissively licensed + the license of libcpupower's
|
|
|
|
library files. For these bindings that means GPL v2.
|
2024-09-04 22:19:09 -04:00
|
|
|
|
|
|
|
Please see https://swig.org/legal.html and the discussion [1] for more details.
|
|
|
|
|
|
|
|
[1]
|
|
|
|
https://lore.kernel.org/linux-pm/Zqv9BOjxLAgyNP5B@hatbackup/
|
|
|
|
|
|
|
|
|
|
|
|
build
|
|
|
|
-----
|
|
|
|
|
|
|
|
Install SWIG and the Python development files provided by your distribution.
|
|
|
|
|
|
|
|
Build the object files for libcpupower by running make in the cpupower
|
|
|
|
directory.
|
|
|
|
|
|
|
|
Return to the directory this README is in to run:
|
|
|
|
|
|
|
|
$ make
|
|
|
|
|
|
|
|
|
|
|
|
testing
|
|
|
|
-------
|
|
|
|
|
|
|
|
Please verify the _raw_pylibcpupower.so and raw_pylibcpupower.py files have
|
|
|
|
been created.
|
|
|
|
|
|
|
|
To run the test script:
|
|
|
|
|
|
|
|
$ python test_raw_pylibcpupower.py
|
|
|
|
|
|
|
|
|
2024-12-18 20:26:02 -05:00
|
|
|
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=~/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 import
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2024-09-04 22:19:09 -04:00
|
|
|
credits
|
|
|
|
-------
|
|
|
|
|
|
|
|
Original Bindings Author:
|
|
|
|
John B. Wyatt IV
|
|
|
|
jwyatt@redhat.com
|
|
|
|
sageofredondo@gmail.com
|
|
|
|
|
|
|
|
Copyright (C) 2024 Red Hat
|