Commit 87093c1
committed
Make libzim a package.
It is possible to import libzim in python :
```
import libzim
libzim.reader.Archive("foo.zim")
```
Libzim is imported and submodule is created and correctly set.
But it is not possible to directly import `libzim.reader`.
Although the modules are created, the python import mechanism don't
recognize libzim as a package and fail to locate the submodule.
So we have to tweak a bit the system :
- Add a __path__ to libzim to "mark" it as a package.
- Provide our own module loader to not make python trying to load
'libzim.writer` from `___LIBZIM___/writer.py`.
Now it is possible to directly import a submodule :
```
from libzim.reader import Archive
Archive("foo.zim")
```1 parent 0fcc120 commit 87093c1
1 file changed
+31
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
950 | 954 | | |
951 | 955 | | |
952 | 956 | | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
953 | 984 | | |
954 | 985 | | |
0 commit comments