Quote:
Originally Posted by kovidgoyal
Just unzip, replace the file, and re-zip, making sure to disable compression when zipping.
|
Thants for your replay.
I've tried, but might not in the right way, it cannot run the right way like using source code by setting CALIBRE_DEVELOP_FROM.
1. I use WinRAR directly replace the .pyo in the pylib.zip(just drag the .pyo into pylib.zip's "calibre/db/" subdirectory).
Code:
--- the orginal pylib.zip
$ unzip -Z ../pylib.zip | grep backend -B3
?rw------- 2.0 fat 17915 b- stor 16-Sep-30 08:46 calibre/customize/__init__.pyo
-rw---- 2.0 fat 0 b- stor 16-Sep-30 08:46 calibre/db
?rw------- 2.0 fat 9008 b- stor 16-Sep-30 08:46 calibre/db/adding.pyo
?rw------- 2.0 fat 65606 b- stor 16-Sep-30 08:46 calibre/db/backend.pyo
--- pylib.zip after replacing calibre/db/backend.pyo
$ unzip -Z ../pylib-h.zip | grep backend -B3
?rw------- 2.0 fat 17915 b- stor 16-Sep-30 08:46 calibre/customize/__init__.pyo
-rw---- 2.0 fat 0 b- stor 16-Sep-30 08:46 calibre/db
?rw------- 2.0 fat 9008 b- stor 16-Sep-30 08:46 calibre/db/adding.pyo
-rw-a-- 3.1 fat 70781 bx stor 16-Oct-13 23:06 calibre/db/backend.pyo
2. Directory structure problem like
this cause the pylib.zip cannot extract the path, so I
build the directory structure manually before unzip pylib.zip.
This is the detail steps history:
Code:
$ mkdir pylib && cd pylib
$ unzip ../*.zip
$ unzip -l ../*.zip
$ unzip -l ../pylib.zip | grep -E "[0-9]{4}(-[0-9]{2}){2} [0-9]{2}:[0-9]{2}" | sed -e '/\.py/d' -e 's/^[ 0-9:\-]* \(.*\)$/\1/' | xargs mkdir
$ unzip ../pylib.zip
$ cp ../backend.pyo calibre/db/backend.pyo -f
$ zip -r ../pylib-hardlink.zip . -0
$ unzip -Z pylib-hardlink.zip | grep backend -B3
-rw------- 3.0 unx 11359 bx stor 16-Sep-30 08:46 calibre/db/restore.pyo
-rw------- 3.0 unx 15612 bx stor 16-Sep-30 08:46 calibre/db/utils.pyo
-rw------- 3.0 unx 19342 bx stor 16-Sep-30 08:46 calibre/db/view.pyo
-rw------- 3.0 unx 70781 bx stor 16-Oct-13 23:06 calibre/db/backend.pyo