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