Skip to content

Commit

Permalink
Update setuptools and fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberrumor committed Jul 17, 2024
1 parent 4b96133 commit ac66d5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions ammo/fomod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _get_pages(self) -> list[Page]:
install_step_name = f"- {install_step_name}"
for optional_file_groups in step:
for group in optional_file_groups:
if not (group_of_plugins := group.find("plugins")):
if (group_of_plugins := group.find("plugins")) is None:
# This step has no configurable plugins.
# Skip the false positive.
continue
Expand Down Expand Up @@ -200,7 +200,9 @@ def _get_pages(self) -> list[Page]:
) and i == 0

# Interpret on/off or 1/0 as true/false
if conditional_flags := plugin.find("conditionFlags"):
if (
conditional_flags := plugin.find("conditionFlags")
) is not None:
for flag in conditional_flags:
# People use arbitrary flags here.
# Most commonly "On", "1" or "active".
Expand All @@ -216,7 +218,9 @@ def _get_pages(self) -> list[Page]:
# unconditional install.
conditional = False

files = plugin.find("files") or []
files = plugin.find("files")
if files is None:
files = []

page.selections.append(
Selection(
Expand Down Expand Up @@ -324,7 +328,7 @@ def _get_nodes(self) -> list[ElementTree.Element]:
# install steps instead of within them).
patterns = (
self.xml_root_node.find("conditionalFileInstalls").find("patterns")
if self.xml_root_node.find("conditionalFileInstalls")
if self.xml_root_node.find("conditionalFileInstalls") is not None
else []
)
for pattern in patterns:
Expand All @@ -341,7 +345,7 @@ def _get_nodes(self) -> list[ElementTree.Element]:

# xml_files is a list of folders. The folder objects contain the paths.
xml_files = pattern.find("files")
if not xml_files:
if xml_files is None:
# can't find files for this, no point in checking whether to include.
continue

Expand All @@ -351,7 +355,9 @@ def _get_nodes(self) -> list[ElementTree.Element]:
elif self._flags_match(dependency.flags, dependency.operator):
selected_nodes.extend(xml_files)

xml_required_files = self.xml_root_node.find("requiredInstallFiles") or []
xml_required_files = self.xml_root_node.find("requiredInstallFiles")
if xml_required_files is None:
xml_required_files = []
for xml_file in xml_required_files:
if xml_file.tag == "files":
selected_nodes.extend(xml_file)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest==7.3.1
setuptools==67.6.1
setuptools==70.0.0

0 comments on commit ac66d5f

Please sign in to comment.