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
8338f490eSJohn B. Wyatt IV* You need the object files in the libcpupower directory compiled by
9338f490eSJohn B. Wyatt IVcpupower's makefile.
10338f490eSJohn B. Wyatt IV* The SWIG program must be installed.
11338f490eSJohn B. Wyatt IV* The Python's development libraries installed.
12338f490eSJohn B. Wyatt IV
13338f490eSJohn B. Wyatt IVPlease check that your version of SWIG is compatible with the version of Python
14338f490eSJohn B. Wyatt IVinstalled on your machine by checking the SWIG changelog on their website.
15338f490eSJohn B. Wyatt IVhttps://swig.org/
16338f490eSJohn B. Wyatt IV
17338f490eSJohn B. Wyatt IVNote that while SWIG itself is GPL v3+ licensed; the resulting output,
18338f490eSJohn B. Wyatt IVthe bindings code: is permissively licensed + the license of libcpupower's .o
19338f490eSJohn B. Wyatt IVfiles. For these bindings that means GPL v2.
20338f490eSJohn B. Wyatt IV
21338f490eSJohn B. Wyatt IVPlease see https://swig.org/legal.html and the discussion [1] for more details.
22338f490eSJohn B. Wyatt IV
23338f490eSJohn B. Wyatt IV[1]
24338f490eSJohn B. Wyatt IVhttps://lore.kernel.org/linux-pm/Zqv9BOjxLAgyNP5B@hatbackup/
25338f490eSJohn B. Wyatt IV
26338f490eSJohn B. Wyatt IV
27338f490eSJohn B. Wyatt IVbuild
28338f490eSJohn B. Wyatt IV-----
29338f490eSJohn B. Wyatt IV
30338f490eSJohn B. Wyatt IVInstall SWIG and the Python development files provided by your distribution.
31338f490eSJohn B. Wyatt IV
32338f490eSJohn B. Wyatt IVBuild the object files for libcpupower by running make in the cpupower
33338f490eSJohn B. Wyatt IVdirectory.
34338f490eSJohn B. Wyatt IV
35338f490eSJohn B. Wyatt IVReturn to the directory this README is in to run:
36338f490eSJohn B. Wyatt IV
37338f490eSJohn B. Wyatt IV$ make
38338f490eSJohn B. Wyatt IV
39338f490eSJohn B. Wyatt IV
40338f490eSJohn B. Wyatt IVtesting
41338f490eSJohn B. Wyatt IV-------
42338f490eSJohn B. Wyatt IV
43338f490eSJohn B. Wyatt IVPlease verify the _raw_pylibcpupower.so and raw_pylibcpupower.py files have
44338f490eSJohn B. Wyatt IVbeen created.
45338f490eSJohn B. Wyatt IV
46338f490eSJohn B. Wyatt IVTo run the test script:
47338f490eSJohn B. Wyatt IV
48338f490eSJohn B. Wyatt IV$ python test_raw_pylibcpupower.py
49338f490eSJohn B. Wyatt IV
50338f490eSJohn B. Wyatt IV
51*6de02569SJohn B. Wyatt IVdeveloping/using the bindings directly
52*6de02569SJohn B. Wyatt IV--------------------------------------
53*6de02569SJohn B. Wyatt IV
54*6de02569SJohn B. Wyatt IVYou need to add the Python bindings directory to your $PYTHONPATH.
55*6de02569SJohn B. Wyatt IV
56*6de02569SJohn B. Wyatt IVYou would set the path in the Bash terminal or in the Bash profile:
57*6de02569SJohn B. Wyatt IV
58*6de02569SJohn B. Wyatt IVPYTHONPATH=~/linux/tools/power/cpupower/bindings/python:$PYTHONPATH
59*6de02569SJohn B. Wyatt IV
60*6de02569SJohn B. Wyatt IVThis allows you to set a specific repo of the bindings to use.
61*6de02569SJohn B. Wyatt IV
62*6de02569SJohn B. Wyatt IV
63*6de02569SJohn B. Wyatt IVinstalling/uninstalling
64*6de02569SJohn B. Wyatt IV-----------------------
65*6de02569SJohn B. Wyatt IV
66*6de02569SJohn B. Wyatt IVPython uses a system specific site-packages folder to look up modules to import
67*6de02569SJohn B. Wyatt IVby default. You do not need to install cpupower to use the SWIG bindings.
68*6de02569SJohn B. Wyatt IV
69*6de02569SJohn B. Wyatt IVYou can install and uninstall the bindings to the site-packages with:
70*6de02569SJohn B. Wyatt IV
71*6de02569SJohn B. Wyatt IVsudo make install
72*6de02569SJohn B. Wyatt IV
73*6de02569SJohn B. Wyatt IVsudo make uninstall
74*6de02569SJohn B. Wyatt IV
75*6de02569SJohn B. Wyatt IV
76338f490eSJohn B. Wyatt IVcredits
77338f490eSJohn B. Wyatt IV-------
78338f490eSJohn B. Wyatt IV
79338f490eSJohn B. Wyatt IVOriginal Bindings Author:
80338f490eSJohn B. Wyatt IVJohn B. Wyatt IV
81338f490eSJohn B. Wyatt IV[email protected]
82338f490eSJohn B. Wyatt IV[email protected]
83338f490eSJohn B. Wyatt IV
84338f490eSJohn B. Wyatt IVCopyright (C) 2024 Red Hat
85