File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
tools/power/cpupower/bindings/python Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; el
11
11
LIB_DIR := ../../lib
12
12
PY_INCLUDE = $(firstword $(shell python-config --includes) )
13
13
OBJECTS_LIB = $(wildcard $(LIB_DIR ) /* .o)
14
+ INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages() [0])")
14
15
15
16
all : _raw_pylibcpupower.so
16
17
@@ -28,6 +29,15 @@ else ifeq ($(HAVE_PYCONFIG),0)
28
29
endif
29
30
swig -python raw_pylibcpupower.swg
30
31
32
+ # Only installs the Python bindings
33
+ install : _raw_pylibcpupower.so
34
+ install -D _raw_pylibcpupower.so $(INSTALL_DIR ) /_raw_pylibcpupower.so
35
+ install -D raw_pylibcpupower.py $(INSTALL_DIR ) /raw_pylibcpupower.py
36
+
37
+ uninstall :
38
+ rm -f $(INSTALL_DIR ) /_raw_pylibcpupower.so
39
+ rm -f $(INSTALL_DIR ) /raw_pylibcpupower.py
40
+
31
41
# Will only clean the bindings folder; will not clean the actual cpupower folder
32
42
clean :
33
43
rm -f raw_pylibcpupower.py raw_pylibcpupower_wrap.c raw_pylibcpupower_wrap.o _raw_pylibcpupower.so
Original file line number Diff line number Diff line change @@ -48,6 +48,31 @@ To run the test script:
48
48
$ python test_raw_pylibcpupower.py
49
49
50
50
51
+ developing/using the bindings directly
52
+ --------------------------------------
53
+
54
+ You need to add the Python bindings directory to your $PYTHONPATH.
55
+
56
+ You would set the path in the Bash terminal or in the Bash profile:
57
+
58
+ PYTHONPATH=~/linux/tools/power/cpupower/bindings/python:$PYTHONPATH
59
+
60
+ This allows you to set a specific repo of the bindings to use.
61
+
62
+
63
+ installing/uninstalling
64
+ -----------------------
65
+
66
+ Python uses a system specific site-packages folder to look up modules to import
67
+ by default. You do not need to install cpupower to use the SWIG bindings.
68
+
69
+ You can install and uninstall the bindings to the site-packages with:
70
+
71
+ sudo make install
72
+
73
+ sudo make uninstall
74
+
75
+
51
76
credits
52
77
-------
53
78
You can’t perform that action at this time.
0 commit comments