Skip to content

Commit

Permalink
Fixes for Py3.8 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Nov 16, 2023
1 parent ee2e2c3 commit 8816ee0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
11 changes: 7 additions & 4 deletions docs/reference/commands/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ Override the value of an app's configuration in ``pyproject.toml`` with the prov
value.

The value passed to the setting should be valid TOML. If the value being overridden is a
string, this includes quoting the value. This may require the use of escape sequences at
the command line. For example, to override the template used by the create command, you
can use ``-C template=...``, but the value must be quoted::
string, this means you must quote the value. This may require the use of escape
sequences at the command line to ensure the value provided to Briefcase by the shell
includes the quotes.

briefcase create -C template=\'https://example.com/template\'
For example, to override the template used by the create command, you can use ``-C
template=...``, but the value must be quoted::

briefcase create -C template=\"https://example.com/template\"

``-h`` / ``--help``
-------------------
Expand Down
15 changes: 8 additions & 7 deletions src/briefcase/commands/dev.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import os
import subprocess
import sys
from pathlib import Path
from typing import List, Optional

from briefcase.commands.run import RunAppMixin
from briefcase.config import AppConfig
Expand Down Expand Up @@ -112,7 +113,7 @@ def run_dev_app(
app: AppConfig,
env: dict,
test_mode: bool,
passthrough: List[str],
passthrough: list[str],
**options,
):
"""Run the app in the dev environment.
Expand Down Expand Up @@ -174,11 +175,11 @@ def get_environment(self, app, test_mode: bool):

def __call__(
self,
appname: Optional[str] = None,
update_requirements: Optional[bool] = False,
run_app: Optional[bool] = True,
test_mode: Optional[bool] = False,
passthrough: Optional[List[str]] = None,
appname: str | None = None,
update_requirements: bool | None = False,
run_app: bool | None = True,
test_mode: bool | None = False,
passthrough: list[str] | None = None,
config_overrides: list[str] | None = None,
**options,
):
Expand Down
11 changes: 6 additions & 5 deletions src/briefcase/commands/new.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import re
import unicodedata
from email.utils import parseaddr
from typing import Optional
from urllib.parse import urlparse

from packaging.version import Version
Expand Down Expand Up @@ -432,8 +433,8 @@ def build_app_context(self):

def new_app(
self,
template: Optional[str] = None,
template_branch: Optional[str] = None,
template: str | None = None,
template_branch: str | None = None,
**options,
):
"""Ask questions to generate a new application, and generate a stub project from
Expand Down Expand Up @@ -520,8 +521,8 @@ def verify_tools(self):

def __call__(
self,
template: Optional[str] = None,
template_branch: Optional[str] = None,
template: str | None = None,
template_branch: str | None = None,
**options,
):
# Confirm host compatibility, and that all required tools are available.
Expand Down
9 changes: 5 additions & 4 deletions src/briefcase/commands/upgrade.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import sys
from operator import attrgetter
from typing import List, Set, Type

from briefcase.exceptions import (
BriefcaseCommandError,
Expand Down Expand Up @@ -50,12 +51,12 @@ def add_options(self, parser):
help="The Briefcase-managed tool to upgrade. If no tool is named, all tools will be upgraded.",
)

def get_tools_to_upgrade(self, tool_list: Set[str]) -> List[ManagedTool]:
def get_tools_to_upgrade(self, tool_list: set[str]) -> list[ManagedTool]:
"""Returns set of managed Tools that can be upgraded.
Raises ``BriefcaseCommandError`` if user list contains any invalid tool names.
"""
upgrade_list: set[Type[Tool]]
upgrade_list: set[type[Tool]]
tools_to_upgrade: set[ManagedTool] = set()

# Validate user tool list against tool registry
Expand Down Expand Up @@ -94,7 +95,7 @@ def get_tools_to_upgrade(self, tool_list: Set[str]) -> List[ManagedTool]:

return sorted(list(tools_to_upgrade), key=attrgetter("name"))

def __call__(self, tool_list: List[str], list_tools: bool = False, **options):
def __call__(self, tool_list: list[str], list_tools: bool = False, **options):
"""Perform tool upgrades or list tools qualifying for upgrade.
:param tool_list: List of tool names from user to upgrade.
Expand Down

0 comments on commit 8816ee0

Please sign in to comment.