mirror of
https://github.com/borgbase/vorta
synced 2024-12-21 23:33:13 +00:00
634f984e78
* Add dependency for pyobjc-CoreWLAN on darwin * Rename existing implementation with Android The current implementation was tested with Android, but does not work with iOS. Move the existing implementation and include android in the name to make room for adding a new iOS metered connection detection strategy. * get_current_wifi works with objc Switch from using command line tools to using the Objective-C Cocoa API to get the Wi-Fi status information. Cocoa has an API to specifically check whether a Wi-Fi connection is using a Personal Hotspot on iOS. I'm using a private method to get the Wi-Fi interface object in Cocoa. The reason for this is that cleaning up mocks on PyObjC/ObjC objects is much harder than mocking out methods on objects in our control. Using test doubles also let's me check for different states the Wi-Fi network could be in. * get_known_wifis works on darwin Use the networksetup command on macOS to get the list of the user's Wi-Fi networks. networksetup -listpreferredwirelessnetworks bsd_device It looks like this command and option has existed on macOS since at least 2013. Also add some type annotations around the PyObjC return values to help the reader know what they're dealing with at each step. * Add test for get_current_wifi when wifi is off The user might have Wi-Fi turned off. Account for that use case. * Add iOS Personal Hotspot support to is_network_metered The DarwinNetworkManager can now determine if the user is connected to a Personal Hotspot Wi-Fi network from iOS. Account for whether the user has Wi-Fi turned on and off. * Refactor to avoid deprecated API in Cocoa According to Apple's developer documentation, creating CWInterface objects directly are discouraged. Instead, they prefer to use CWInterface objects created by CWWiFiClient. This also happens to be more compliant with Apple's application sandbox. Creating CWInterface objects directly accesses raw BSD sockets which is not allowed in the sandbox. More details here: https://developer.apple.com/documentation/corewlan/cwinterface * Add test case for blank Wi-Fi network name I have one of these in my list of networks in Vorta. And this also covers a missing branch in get_known_wifis. * Move private method below public methods This is to provide a little more clarity. Especially since this class is subclassing another one. * Account for when there is no wifi interface When a Mac does not have a Wi-Fi interface, CWWiFiClient.interface() can return None. Update the type annotation to mark it as Optional, and account for the null condition in the other methods. * Fix type annotation error The CI tests failed on python 3.8. I used the wrong type annotation to describe a list of SystemWifiInfo's. The tests now pass for me when I run 'make test-unit' using a python 3.8 interpreter. * Fix linter issue with imports
111 lines
2.7 KiB
INI
111 lines
2.7 KiB
INI
[metadata]
|
|
name = vorta
|
|
author = Manuel Riel and Vorta contributors
|
|
description = A GUI for Borg Backup
|
|
version = attr: vorta._version.__version__
|
|
url = https://github.com/borgbase/vorta
|
|
keywords =
|
|
backup
|
|
borgbackup
|
|
# List of classifiers: https://pypi.org/pypi?%3Aaction=list_classifiers
|
|
classifiers =
|
|
Development Status :: 4 - Beta
|
|
Environment :: MacOS X
|
|
Environment :: X11 Applications :: Qt
|
|
Operating System :: MacOS
|
|
Operating System :: POSIX
|
|
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
Programming Language :: Python :: 3.7
|
|
Programming Language :: Python :: 3.8
|
|
Programming Language :: Python :: 3.9
|
|
Programming Language :: Python :: 3.10
|
|
Topic :: System :: Archiving :: Backup
|
|
Topic :: System :: Systems Administration
|
|
Topic :: Utilities
|
|
long_description = file: README.md
|
|
long_description_content_type = text/markdown
|
|
license_file = LICENSE.txt
|
|
project_urls =
|
|
Bug Tracker = https://github.com/borgbase/vorta/issues
|
|
Documentation = https://docs.borgbase.com
|
|
Source Code = https://github.com/borgbase/vorta
|
|
|
|
[options]
|
|
packages = find:
|
|
package_dir =
|
|
=src
|
|
include_package_data = true
|
|
python_requires = >=3.8
|
|
install_requires =
|
|
platformdirs >=3.0.0, <5.0.0; sys_platform == 'darwin' # for macOS: breaking changes in 3.0.0,
|
|
platformdirs >=2.6.0, <5.0.0; sys_platform != 'darwin' # for others: 2.6+ works consistently.
|
|
pyqt6
|
|
peewee
|
|
psutil
|
|
setuptools
|
|
secretstorage; sys_platform != 'darwin'
|
|
pyobjc-core < 10; sys_platform == 'darwin'
|
|
pyobjc-framework-Cocoa < 10; sys_platform == 'darwin'
|
|
pyobjc-framework-LaunchServices < 10; sys_platform == 'darwin'
|
|
pyobjc-framework-CoreWLAN < 10; sys_platform == 'darwin'
|
|
tests_require =
|
|
pytest
|
|
pytest-qt
|
|
pytest-mock
|
|
|
|
[options.entry_points]
|
|
gui_scripts =
|
|
vorta = vorta.__main__:main
|
|
|
|
[options.packages.find]
|
|
where=src
|
|
|
|
[tool:pytest]
|
|
addopts = -vs
|
|
testpaths = tests
|
|
qt_default_raising = true
|
|
filterwarnings =
|
|
ignore::DeprecationWarning
|
|
|
|
[coverage:run]
|
|
source = vorta
|
|
omit = tests/*
|
|
relative_files = true
|
|
|
|
[flake8]
|
|
ignore =
|
|
max-line-length = 120
|
|
extend-ignore = E203,E121,E123,E126,E226,E24,E704,W503,W504
|
|
exclude =
|
|
build,dist,.git,.idea,.cache,.tox,.eggs,
|
|
./src/vorta/__init__.py,.direnv,env
|
|
|
|
[tox:tox]
|
|
envlist = py36,py37,py38,flake8
|
|
skip_missing_interpreters = true
|
|
|
|
[testenv]
|
|
deps =
|
|
pytest
|
|
pytest-qt
|
|
pytest-mock
|
|
commands=pytest
|
|
passenv = DISPLAY
|
|
|
|
[testenv:flake8]
|
|
deps =
|
|
flake8
|
|
commands=flake8 src tests
|
|
|
|
[pycodestyle]
|
|
max_line_length = 120
|
|
|
|
[pylint.master]
|
|
extension-pkg-whitelist=PyQt6
|
|
load-plugins=
|
|
|
|
[pylint.messages control]
|
|
disable= W0503,W0511,C0301,R0903,R0201,W0212,C0114,C0115,C0116,C0103,E0611,E1120,C0415,R0914,R0912,R0915
|
|
|
|
[pylint.format]
|
|
max-line-length=120
|