Skip to content

Commit

Permalink
check for ZipInfo .compress_level for py 3.13 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
obfusk committed May 16, 2024
1 parent 11bbbb9 commit 50f6115
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions fix-compresslevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class Error(RuntimeError):
class ReproducibleZipInfo(zipfile.ZipInfo):
"""Reproducible ZipInfo hack."""

if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")
if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
if "compress_level" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")

_compresslevel: int
_override: Dict[str, Any] = {}
Expand Down
5 changes: 3 additions & 2 deletions fix-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ class Error(RuntimeError):
class ReproducibleZipInfo(zipfile.ZipInfo):
"""Reproducible ZipInfo hack."""

if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")
if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
if "compress_level" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")

_compresslevel: int
_override: Dict[str, Any] = {}
Expand Down
5 changes: 3 additions & 2 deletions fix-newlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class Error(RuntimeError):
class ReproducibleZipInfo(zipfile.ZipInfo):
"""Reproducible ZipInfo hack."""

if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")
if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
if "compress_level" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")

_compresslevel: int
_override: Dict[str, Any] = {}
Expand Down
5 changes: 3 additions & 2 deletions fix-pg-map-id.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class Error(RuntimeError):
class ReproducibleZipInfo(zipfile.ZipInfo):
"""Reproducible ZipInfo hack."""

if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")
if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
if "compress_level" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")

_compresslevel: int
_override: Dict[str, Any] = {}
Expand Down
5 changes: 3 additions & 2 deletions rm-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class Error(RuntimeError):
class ReproducibleZipInfo(zipfile.ZipInfo):
"""Reproducible ZipInfo hack."""

if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")
if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
if "compress_level" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")

_compresslevel: int
_override: Dict[str, Any] = {}
Expand Down
5 changes: 3 additions & 2 deletions sort-baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class Error(RuntimeError):
class ReproducibleZipInfo(zipfile.ZipInfo):
"""Reproducible ZipInfo hack."""

if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")
if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
if "compress_level" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined]
raise Error("zipfile.ZipInfo has no ._compresslevel")

_compresslevel: int
_override: Dict[str, Any] = {}
Expand Down

0 comments on commit 50f6115

Please sign in to comment.