1338f490eSJohn B. Wyatt IVThis folder contains the necessary files to build the Python bindings for 2338f490eSJohn B. Wyatt IVlibcpupower (aside from the libcpupower object files). 3338f490eSJohn B. Wyatt IV 4338f490eSJohn B. Wyatt IV 5338f490eSJohn B. Wyatt IVrequirements 6338f490eSJohn B. Wyatt IV------------ 7338f490eSJohn B. Wyatt IV 8*99d2fce9SJohn B. Wyatt IV* If you are building completely from upstream; please install libcpupower by 9*99d2fce9SJohn B. Wyatt IVrunning `make install-lib` within the cpupower directory. This installs the 10*99d2fce9SJohn B. Wyatt IVlibcpupower.so file and symlinks needed. Otherwise, please make sure a symlink 11*99d2fce9SJohn B. Wyatt IVto libcpupower.so exists in your library path from your distribution's 12*99d2fce9SJohn B. Wyatt IVpackages. 13338f490eSJohn B. Wyatt IV* The SWIG program must be installed. 14*99d2fce9SJohn B. Wyatt IV* The Python's development libraries must be installed. 15338f490eSJohn B. Wyatt IV 16338f490eSJohn B. Wyatt IVPlease check that your version of SWIG is compatible with the version of Python 17338f490eSJohn B. Wyatt IVinstalled on your machine by checking the SWIG changelog on their website. 18338f490eSJohn B. Wyatt IVhttps://swig.org/ 19338f490eSJohn B. Wyatt IV 20338f490eSJohn B. Wyatt IVNote that while SWIG itself is GPL v3+ licensed; the resulting output, 21*99d2fce9SJohn B. Wyatt IVthe bindings code: is permissively licensed + the license of libcpupower's 22*99d2fce9SJohn B. Wyatt IVlibrary files. For these bindings that means GPL v2. 23338f490eSJohn B. Wyatt IV 24338f490eSJohn B. Wyatt IVPlease see https://swig.org/legal.html and the discussion [1] for more details. 25338f490eSJohn B. Wyatt IV 26338f490eSJohn B. Wyatt IV[1] 27338f490eSJohn B. Wyatt IVhttps://lore.kernel.org/linux-pm/Zqv9BOjxLAgyNP5B@hatbackup/ 28338f490eSJohn B. Wyatt IV 29338f490eSJohn B. Wyatt IV 30338f490eSJohn B. Wyatt IVbuild 31338f490eSJohn B. Wyatt IV----- 32338f490eSJohn B. Wyatt IV 33338f490eSJohn B. Wyatt IVInstall SWIG and the Python development files provided by your distribution. 34338f490eSJohn B. Wyatt IV 35338f490eSJohn B. Wyatt IVBuild the object files for libcpupower by running make in the cpupower 36338f490eSJohn B. Wyatt IVdirectory. 37338f490eSJohn B. Wyatt IV 38338f490eSJohn B. Wyatt IVReturn to the directory this README is in to run: 39338f490eSJohn B. Wyatt IV 40338f490eSJohn B. Wyatt IV$ make 41338f490eSJohn B. Wyatt IV 42338f490eSJohn B. Wyatt IV 43338f490eSJohn B. Wyatt IVtesting 44338f490eSJohn B. Wyatt IV------- 45338f490eSJohn B. Wyatt IV 46338f490eSJohn B. Wyatt IVPlease verify the _raw_pylibcpupower.so and raw_pylibcpupower.py files have 47338f490eSJohn B. Wyatt IVbeen created. 48338f490eSJohn B. Wyatt IV 49338f490eSJohn B. Wyatt IVTo run the test script: 50338f490eSJohn B. Wyatt IV 51338f490eSJohn B. Wyatt IV$ python test_raw_pylibcpupower.py 52338f490eSJohn B. Wyatt IV 53338f490eSJohn B. Wyatt IV 546de02569SJohn B. Wyatt IVdeveloping/using the bindings directly 556de02569SJohn B. Wyatt IV-------------------------------------- 566de02569SJohn B. Wyatt IV 576de02569SJohn B. Wyatt IVYou need to add the Python bindings directory to your $PYTHONPATH. 586de02569SJohn B. Wyatt IV 596de02569SJohn B. Wyatt IVYou would set the path in the Bash terminal or in the Bash profile: 606de02569SJohn B. Wyatt IV 616de02569SJohn B. Wyatt IVPYTHONPATH=~/linux/tools/power/cpupower/bindings/python:$PYTHONPATH 626de02569SJohn B. Wyatt IV 636de02569SJohn B. Wyatt IVThis allows you to set a specific repo of the bindings to use. 646de02569SJohn B. Wyatt IV 656de02569SJohn B. Wyatt IV 666de02569SJohn B. Wyatt IVinstalling/uninstalling 676de02569SJohn B. Wyatt IV----------------------- 686de02569SJohn B. Wyatt IV 696de02569SJohn B. Wyatt IVPython uses a system specific site-packages folder to look up modules to import 706de02569SJohn B. Wyatt IVby default. You do not need to install cpupower to use the SWIG bindings. 716de02569SJohn B. Wyatt IV 726de02569SJohn B. Wyatt IVYou can install and uninstall the bindings to the site-packages with: 736de02569SJohn B. Wyatt IV 746de02569SJohn B. Wyatt IVsudo make install 756de02569SJohn B. Wyatt IV 766de02569SJohn B. Wyatt IVsudo make uninstall 776de02569SJohn B. Wyatt IV 786de02569SJohn B. Wyatt IV 79338f490eSJohn B. Wyatt IVcredits 80338f490eSJohn B. Wyatt IV------- 81338f490eSJohn B. Wyatt IV 82338f490eSJohn B. Wyatt IVOriginal Bindings Author: 83338f490eSJohn B. Wyatt IVJohn B. Wyatt IV 84338f490eSJohn B. Wyatt IVjwyatt@redhat.com 85338f490eSJohn B. Wyatt IVsageofredondo@gmail.com 86338f490eSJohn B. Wyatt IV 87338f490eSJohn B. Wyatt IVCopyright (C) 2024 Red Hat 88