Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.9 fixups #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Commits on Dec 29, 2022

  1. wxui: support python 3.9

    I get the following exception on start:
    
    $ python3 chirpwx.py
    Traceback (most recent call last):
    File "/home/asheplyakov/work/radio/chirp/chirpwx.py", line 8, in
    <module>
        sys.exit(chirpmain())
    File "/home/asheplyakov/work/radio/chirp/chirp/wxui/__init__.py", line
    41, in chirpmain
        from chirp.wxui import main
    File "/home/asheplyakov/work/radio/chirp/chirp/wxui/main.py", line 28,
    in <module>
        import importlib_resources
    ModuleNotFoundError: No module named 'importlib_resources'
    
    $ python3 --version
    Python 3.9.6
    
    However importlib is available in Python 3.9 (as a part of
    the standard library). To avoid the problem this patch removes
    the version check, and checks for
    importlib_resources/importlib.resources modules instead.
    asheplyakov committed Dec 29, 2022
    Configuration menu
    Copy the full SHA
    a4842a3 View commit details
    Browse the repository at this point in the history
  2. Fixed startup error (app icon and stock configs can't be found)

    I get the following error on startup:
    
    $ python3 chirpwx.py
    
    Traceback (most recent call last):
      File "/home/asheplyakov/work/radio/chirp/chirpwx.py", line 8, in <module>
        sys.exit(chirpmain())
      File "/home/asheplyakov/work/radio/chirp/chirp/wxui/__init__.py", line 94, in chirpmain
        mainwindow = main.ChirpMain(None, title='CHIRP')
      File "/home/asheplyakov/work/radio/chirp/chirp/wxui/main.py", line 307, in __init__
        self.set_icon()
      File "/home/asheplyakov/work/radio/chirp/chirp/wxui/main.py", line 342, in set_icon
        importlib_resources.files('chirp.share')
      File "/usr/lib64/python3.9/importlib/resources.py", line 147, in files
        return _common.from_package(_get_package(package))
      File "/usr/lib64/python3.9/importlib/_common.py", line 14, in from_package
        return fallback_resources(package.__spec__)
      File "/usr/lib64/python3.9/importlib/_common.py", line 18, in fallback_resources
        package_directory = pathlib.Path(spec.origin).parent
      File "/usr/lib64/python3.9/pathlib.py", line 1072, in __new__
        self = cls._from_parts(args, init=False)
      File "/usr/lib64/python3.9/pathlib.py", line 697, in _from_parts
        drv, root, parts = self._parse_args(args)
      File "/usr/lib64/python3.9/pathlib.py", line 681, in _parse_args
        a = os.fspath(a)
    TypeError: expected str, bytes or os.PathLike object, not NoneType
    
    The problem is that 'chirp.share' is not a proper python package,
    therefore importlib fails to locate its resources.
    To avoid the problem this patch adds empty __init__.py files to
    chirp/share and chirp/stock_configs directories.
    
    As a side effect setup.py installs (the content of) these directories
    (which makes packagers more happy).
    asheplyakov committed Dec 29, 2022
    Configuration menu
    Copy the full SHA
    21a74cd View commit details
    Browse the repository at this point in the history