1 |
I have a package providing a .py and a .so file. |
2 |
|
3 |
When and how should I install these ? |
4 |
|
5 |
I was thinking of something like this, copying ideas from elsewhere: |
6 |
|
7 |
DEPEND="... python? (dev-lang/python) ..." |
8 |
|
9 |
Should this maybe be sys-devel/spython instead ? Should spython be |
10 |
unmerged if python is merged ? |
11 |
|
12 |
Then, in the install part: |
13 |
|
14 |
src_install() { |
15 |
.. |
16 |
if [ "use python" ] ; then |
17 |
insinto /usr/lib/python2.0 |
18 |
doins snack.py |
19 |
|
20 |
insinto /usr/lib/python2.0/lib-dynload |
21 |
doins _snackmodule.so |
22 |
fi |
23 |
.. |
24 |
} |
25 |
|
26 |
Now I noticed the .py files already in /usr/lib/python2.0/ also have .pyc |
27 |
and .pyo files with the same name, so I guess they are some kind of |
28 |
precompiled files. |
29 |
|
30 |
I found a command like this in some rpm spec file: |
31 |
|
32 |
python -c 'from compileall import *; \ |
33 |
compile_dir("'$RPM_BUILD_ROOT'/usr/lib/python2.0",10,"/usr/lib/python2.0")' |
34 |
|
35 |
I would guess this could create the .pyc and .pyo files. Now I don't know |
36 |
the behaviour of this command, but it would seem like this command would |
37 |
install stuff from $RPM_BUILD_ROOT/usr/lib/python2.0 to /usr/lib/python2.0, |
38 |
so this command might not be directly suitable for my need. And what's the |
39 |
"10" in the parameter list? |
40 |
|
41 |
Also, how about the version number? Should I do |
42 |
|
43 |
pythondir=/usr/lib/python`(python -V 2>&1)|sed 's/[^0-9.]//g'` |
44 |
|
45 |
to get the correct installation location ? |
46 |
|
47 |
- xkr47 |