Commit 106c5265 authored by Alan's avatar Alan
Browse files

ASP: replace assert by raising an exception

assert is only evaluated if __debug__ is True and should not be used to check
for conditions.

Will-fix: #15838
parent 49739777
...@@ -20,7 +20,7 @@ from tailslib.persistence import ( # NOQA: E402 ...@@ -20,7 +20,7 @@ from tailslib.persistence import ( # NOQA: E402
is_tails_media_writable, is_tails_media_writable,
launch_persistence_setup) launch_persistence_setup)
from tailslib.additionalsoftware.config import ( # NOQA: E402 from tailslib.additionalsoftware import ( # NOQA: E402
get_additional_packages, get_additional_packages,
get_packages_list_path, get_packages_list_path,
filter_package_details) filter_package_details)
......
...@@ -15,7 +15,8 @@ import apt.cache ...@@ -15,7 +15,8 @@ import apt.cache
from tailslib import LIVE_USERNAME from tailslib import LIVE_USERNAME
from tailslib.additionalsoftware.config import ( from tailslib.additionalsoftware import (
ASPDataError,
add_additional_packages, add_additional_packages,
filter_package_details, filter_package_details,
get_additional_packages, get_additional_packages,
...@@ -415,7 +416,8 @@ def apt_hook_pre(): ...@@ -415,7 +416,8 @@ def apt_hook_pre():
removed_packages = [] removed_packages = []
line = sys.stdin.readline() line = sys.stdin.readline()
assert line.startswith("VERSION 3") if not line.startswith("VERSION 3"):
raise ASPDataError("APT data is not version 3")
line = sys.stdin.readline() line = sys.stdin.readline()
# Ignore configuration space, which ends with an empty line # Ignore configuration space, which ends with an empty line
while line != "\n": while line != "\n":
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import sys import sys
from tailslib.additionalsoftware.config import ( from tailslib.additionalsoftware import (
remove_additional_packages, remove_additional_packages,
get_additional_packages) get_additional_packages)
......
pythonlib @ 63bf95c0
Subproject commit 7b72784ac48dfb2b444d2f4331bf672446c8b906 Subproject commit 63bf95c0b9a0376340d7690e2b681dad81dc8889
...@@ -165,7 +165,7 @@ When *Add To Persistent Storage* is clicked, ...@@ -165,7 +165,7 @@ When *Add To Persistent Storage* is clicked,
`AdditionalSoftware` preset. The new additional packages are then added `AdditionalSoftware` preset. The new additional packages are then added
atomically to the `live-additional-software.conf` configuration file atomically to the `live-additional-software.conf` configuration file
(this logic is handled by (this logic is handled by
<https://git-tails.immerda.ch/pythonlib/plain/tailslib/additionalsoftware/config.py>) <https://git-tails.immerda.ch/pythonlib/plain/tailslib/additionalsoftware.py>)
#### Without persistent storage #### Without persistent storage
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment