1This folder contains the necessary files to build the Python bindings for 2libcpupower (aside from the libcpupower object files). 3 4 5requirements 6------------ 7 8* If you are building completely from upstream; please install libcpupower by 9running `make install-lib` within the cpupower directory. This installs the 10libcpupower.so file and symlinks needed. Otherwise, please make sure a symlink 11to libcpupower.so exists in your library path from your distribution's 12packages. 13* The SWIG program must be installed. 14* The Python's development libraries must be installed. 15 16Please check that your version of SWIG is compatible with the version of Python 17installed on your machine by checking the SWIG changelog on their website. 18https://swig.org/ 19 20Note that while SWIG itself is GPL v3+ licensed; the resulting output, 21the bindings code: is permissively licensed + the license of libcpupower's 22library files. For these bindings that means GPL v2. 23 24Please see https://swig.org/legal.html and the discussion [1] for more details. 25 26[1] 27https://lore.kernel.org/linux-pm/Zqv9BOjxLAgyNP5B@hatbackup/ 28 29 30build 31----- 32 33Install SWIG and the Python development files provided by your distribution. 34 35Build the object files for libcpupower by running make in the cpupower 36directory. 37 38Return to the directory this README is in to run: 39 40$ make 41 42 43testing 44------- 45 46Please verify the _raw_pylibcpupower.so and raw_pylibcpupower.py files have 47been created. 48 49To run the test script: 50 51$ python test_raw_pylibcpupower.py 52 53 54developing/using the bindings directly 55-------------------------------------- 56 57You need to add the Python bindings directory to your $PYTHONPATH. 58 59You would set the path in the Bash terminal or in the Bash profile: 60 61PYTHONPATH=~/linux/tools/power/cpupower/bindings/python:$PYTHONPATH 62 63This allows you to set a specific repo of the bindings to use. 64 65 66installing/uninstalling 67----------------------- 68 69Python uses a system specific site-packages folder to look up modules to import 70by default. You do not need to install cpupower to use the SWIG bindings. 71 72You can install and uninstall the bindings to the site-packages with: 73 74sudo make install 75 76sudo make uninstall 77 78 79credits 80------- 81 82Original Bindings Author: 83John B. Wyatt IV 84jwyatt@redhat.com 85sageofredondo@gmail.com 86 87Copyright (C) 2024 Red Hat 88