Skip to content

Commit 79b8ef1

Browse files
authored
Merge pull request #142 from openzim/lz721
Use libzim 7.2.2
2 parents 6fa808b + 8ce84b5 commit 79b8ef1

File tree

8 files changed

+65
-24
lines changed

8 files changed

+65
-24
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- v*
77

88
env:
9-
LIBZIM_VERSION: 7.1.0
9+
LIBZIM_VERSION: 7.2.2
1010
LIBZIM_INCLUDE_PATH: include/zim
1111
TWINE_USERNAME: __token__
1212
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
@@ -100,7 +100,7 @@ jobs:
100100
101101
- name: Build cython and sdist
102102
run: |
103-
pip install --upgrade "cython>=0.29.26,<3.0" setuptools pip wheel
103+
pip install --upgrade "cython>=0.29.28,<3.0" setuptools pip wheel
104104
python3 setup.py build_ext --rpath $RPATH
105105
if [[ "${{ matrix.python-version }}" == "3.6" ]]
106106
then

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: test
22
on: [push]
33

44
env:
5-
LIBZIM_VERSION: 7.1.0
5+
LIBZIM_VERSION: 7.2.2
66
LIBZIM_INCLUDE_PATH: include/zim
77
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
88
PROFILE: 1
@@ -56,7 +56,7 @@ jobs:
5656
run: |
5757
echo LIBZIM_EXT=so >> $GITHUB_ENV
5858
echo LIBZIM_RELEASE=libzim_linux-x86_64-$LIBZIM_VERSION >> $GITHUB_ENV
59-
echo LIBZIM_LIBRARY_PATH=lib/x86_64-linux-gnu/libzim.so.7.1.0 >> $GITHUB_ENV
59+
echo LIBZIM_LIBRARY_PATH=lib/x86_64-linux-gnu/libzim.so.7.2.2 >> $GITHUB_ENV
6060
6161
- name: Cache libzim dylib & headers
6262
uses: actions/cache@master
@@ -91,7 +91,7 @@ jobs:
9191
9292
- name: Build cython, sdist, and bdist_wheel
9393
run: |
94-
pip install --upgrade pip install "cython>=0.29.26,<3.0" setuptools pip wheel
94+
pip install --upgrade pip install "cython>=0.29.28,<3.0" setuptools pip wheel
9595
python3 setup.py build_ext --inplace
9696
python3 setup.py sdist bdist_wheel
9797

CHANGELOG.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
1-
## 1.1.0
1+
# Changelog
22

3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
* `Archive.get_metadata_item()` (#127)
13+
* Python 3.10 Support
14+
15+
### Changed
16+
17+
* using libzim 7.2.2
18+
* RuntimeError exception is now raises on invalid/duplicate entries
319
* Allow setting mimetype for metadata
4-
* added getMetadataItem support (#127)
20+
* Updated Cython to 0.29.28
21+
* Fixed `Archive.filesize` (#137)
22+
23+
### Removed
24+
525
* skip cython on setup.py clean (#131)
626
* OFFLINE environ skips network-using tests (#132)
7-
* Added Python3.10 Support
8-
* Updated Cython to 0.29.26
9-
* Fixed `Archive.filesize` (#137)
1027

11-
## 1.0.0
28+
## [1.0.0] - 2021-10-09
1229

13-
* using libzim 7.x
30+
* using libzim 7.0.0
1431
* Python 3.9 support
1532
* [breaking] Using new libzim 7-based API for both reader and writer
1633
* No more namespaces
@@ -21,7 +38,7 @@
2138
* macOS releases are signed and notarized
2239
* Early-failure on invalid destination ZIM path
2340

24-
## 0.0.4
41+
## [0.0.4]
2542

2643
* added compression argument to Creator to set compression algorithm (libzim.writer.Compression)
2744
* Creator positional arguments order changed: min_chunk_size moved after compression
@@ -31,11 +48,11 @@
3148
* Fixed using `get_filename()` (#71)
3249
* using libzim 6.1.8
3350

34-
## 0.0.3.post0
51+
## [0.0.3.post0]
3552

3653
* fixed access to bundled libzim on macOS (missing rpath)
3754

38-
## 0.0.3
55+
## [0.0.3]
3956

4057
* [reader] fixed `main_page` retrieval
4158
* [reader] provide access to redirect target via `get_redirect_article()` (#51)
@@ -64,7 +81,7 @@
6481
* building with Cython 0.29.20+
6582
* using libzim 6.1.7
6683

67-
## 0.0.2
84+
## [0.0.2]
6885

6986
* initial release
7087
* using libzim 6.1.6

libzim/libzim.pyx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ cdef class _Creator:
303303
The item to add to the file
304304
Raises
305305
------
306+
RuntimeError
307+
If an Item exists with the same path
306308
RuntimeError
307309
If the ZimCreator was already finalized"""
308310
if not self._started:
@@ -317,7 +319,12 @@ cdef class _Creator:
317319
def add_metadata(self, str name: str, bytes content: bytes, str mimetype: str):
318320
"""Add metadata entry to Archive
319321
320-
https://wiki.openzim.org/wiki/Metadata"""
322+
https://wiki.openzim.org/wiki/Metadata
323+
324+
Raises
325+
------
326+
RuntimeError
327+
If a Metadata exists with the same name"""
321328
if not self._started:
322329
raise RuntimeError("Creator not started")
323330

@@ -331,6 +338,11 @@ cdef class _Creator:
331338
"""Add redirection entry to Archive
332339
333340
https://wiki.openzim.org/wiki/ZIM_file_format#Redirect_Entry
341+
342+
Raises
343+
------
344+
RuntimeError
345+
If a Rediction exists with the same path
334346
"""
335347
if not self._started:
336348
raise RuntimeError("Creator not started")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = [ "setuptools >= 35.0.2", "wheel >= 0.29.0", "twine", "cython >= 0.29.26,<3.0" ]
2+
requires = [ "setuptools >= 35.0.2", "wheel >= 0.29.0", "twine", "cython >= 0.29.28,<3.0" ]
33
build-backend = "setuptools.build_meta"
44

55
[tool.black]

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ invoke>=1.5,<2.0
55
coverage>=5.0,<7.0
66
pytest>=6.2,<7.0
77
pytest-cov>=2.10,<4.0
8-
Cython>=0.29.26
8+
Cython>=0.29.28

tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
@task
17-
def download_libzim(c, version="7.1.0"):
17+
def download_libzim(c, version="7.2.2"):
1818
"""download C++ libzim binary"""
1919

2020
if platform.machine() != "x86_64" or platform.system() not in ("Linux", "Darwin"):

tests/test_libzim_creator.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ def test_creator_metadata(fpath, lipsum_item):
391391
"_videos:no;_details:yes;_ftindex:yes",
392392
"Flavour": "nopic",
393393
"Source": "https://en.wikipedia.org/",
394-
"Counter": "image/jpeg=5;image/gif=3;image/png=2",
395394
"Scraper": "sotoki 1.2.3",
396395
}
397396

@@ -417,12 +416,25 @@ def test_creator_metadata(fpath, lipsum_item):
417416
assert zim.get_metadata(name).decode("UTF-8") == value
418417

419418

420-
def test_creator_metadata_nooverwrite(fpath, lipsum_item):
419+
def test_creator_metadata_overwrite(fpath, lipsum_item, favicon_data):
420+
"""re-adding an Entry (even Metadata) now raises an exception (libzim 7.2+)"""
421421
with Creator(fpath) as c:
422422
c.add_item(lipsum_item)
423+
with pytest.raises(RuntimeError, match="Impossible to add"):
424+
c.add_item(lipsum_item)
425+
423426
c.add_metadata("Key", "first")
424-
# re-setting a value prints a warning and ignore it
425-
c.add_metadata("Key", "second")
427+
with pytest.raises(RuntimeError, match="Impossible to add"):
428+
c.add_metadata("Key", "second")
429+
430+
c.add_redirection("home", lipsum_item.get_path(), "Home", {})
431+
with pytest.raises(RuntimeError, match="Impossible to add"):
432+
c.add_redirection("home", lipsum_item.get_path(), "Home again", {})
433+
434+
c.add_illustration(48, favicon_data)
435+
# this currently segfaults but it should not
436+
# with pytest.raises(RuntimeError, match="Impossible to add"):
437+
# c.add_illustration(48, favicon_data)
426438
zim = Archive(fpath)
427439
assert zim.get_metadata("Key").decode("UTF-8") == "first"
428440

0 commit comments

Comments
 (0)