Remove additional Python 3.7-isms (#784).
This commit is contained in:
parent
22101bdd49
commit
f39cea4abf
4 changed files with 10 additions and 21 deletions
|
@ -1,12 +1,8 @@
|
||||||
|
import importlib.metadata
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
try:
|
|
||||||
import importlib_metadata
|
|
||||||
except ModuleNotFoundError: # pragma: nocover
|
|
||||||
import importlib.metadata as importlib_metadata
|
|
||||||
|
|
||||||
import borgmatic.borg.create
|
import borgmatic.borg.create
|
||||||
import borgmatic.borg.state
|
import borgmatic.borg.state
|
||||||
import borgmatic.config.validate
|
import borgmatic.config.validate
|
||||||
|
@ -39,7 +35,7 @@ def create_borgmatic_manifest(config, config_paths, dry_run):
|
||||||
with open(borgmatic_manifest_path, 'w') as config_list_file:
|
with open(borgmatic_manifest_path, 'w') as config_list_file:
|
||||||
json.dump(
|
json.dump(
|
||||||
{
|
{
|
||||||
'borgmatic_version': importlib_metadata.version('borgmatic'),
|
'borgmatic_version': importlib.metadata.version('borgmatic'),
|
||||||
'config_paths': config_paths,
|
'config_paths': config_paths,
|
||||||
},
|
},
|
||||||
config_list_file,
|
config_list_file,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import collections
|
import collections
|
||||||
|
import importlib.metadata
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -9,11 +10,6 @@ from subprocess import CalledProcessError
|
||||||
|
|
||||||
import colorama
|
import colorama
|
||||||
|
|
||||||
try:
|
|
||||||
import importlib_metadata
|
|
||||||
except ModuleNotFoundError: # pragma: nocover
|
|
||||||
import importlib.metadata as importlib_metadata
|
|
||||||
|
|
||||||
import borgmatic.actions.borg
|
import borgmatic.actions.borg
|
||||||
import borgmatic.actions.break_lock
|
import borgmatic.actions.break_lock
|
||||||
import borgmatic.actions.check
|
import borgmatic.actions.check
|
||||||
|
@ -834,7 +830,7 @@ def main(extra_summary_logs=[]): # pragma: no cover
|
||||||
|
|
||||||
global_arguments = arguments['global']
|
global_arguments = arguments['global']
|
||||||
if global_arguments.version:
|
if global_arguments.version:
|
||||||
print(importlib_metadata.version('borgmatic'))
|
print(importlib.metadata.version('borgmatic'))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
if global_arguments.bash_completion:
|
if global_arguments.bash_completion:
|
||||||
print(borgmatic.commands.completion.bash.bash_completion())
|
print(borgmatic.commands.completion.bash.bash_completion())
|
||||||
|
|
|
@ -14,13 +14,12 @@ flake8-use-fstring==1.4
|
||||||
flake8-variables-names==0.0.5
|
flake8-variables-names==0.0.5
|
||||||
flexmock==0.11.3
|
flexmock==0.11.3
|
||||||
idna==3.4
|
idna==3.4
|
||||||
importlib_metadata==6.3.0; python_version < '3.8'
|
|
||||||
isort==5.12.0
|
isort==5.12.0
|
||||||
jsonschema==4.17.3
|
jsonschema==4.17.3
|
||||||
Markdown==3.4.1
|
Markdown==3.4.1
|
||||||
mccabe==0.7.0
|
mccabe==0.7.0
|
||||||
packaging==23.1
|
packaging==23.1
|
||||||
pathspec==0.11.1; python_version >= '3.8'
|
pathspec==0.11.1
|
||||||
pluggy==1.0.0
|
pluggy==1.0.0
|
||||||
py==1.11.0
|
py==1.11.0
|
||||||
pycodestyle==2.10.0
|
pycodestyle==2.10.0
|
||||||
|
@ -28,10 +27,8 @@ pyflakes==3.0.1
|
||||||
pytest==7.3.0
|
pytest==7.3.0
|
||||||
pytest-cov==4.0.0
|
pytest-cov==4.0.0
|
||||||
PyYAML>5.0.0
|
PyYAML>5.0.0
|
||||||
regex; python_version >= '3.8'
|
regex
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
ruamel.yaml>0.15.0
|
ruamel.yaml>0.15.0
|
||||||
toml==0.10.2; python_version >= '3.8'
|
toml==0.10.2
|
||||||
typed-ast; python_version >= '3.8'
|
typed-ast
|
||||||
typing-extensions==4.5.0; python_version < '3.8'
|
|
||||||
zipp==3.15.0; python_version < '3.8'
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ def test_create_borgmatic_manifest_creates_manifest_file():
|
||||||
flexmock(module.os.path).should_receive('exists').and_return(False)
|
flexmock(module.os.path).should_receive('exists').and_return(False)
|
||||||
flexmock(module.os).should_receive('makedirs').and_return(True)
|
flexmock(module.os).should_receive('makedirs').and_return(True)
|
||||||
|
|
||||||
flexmock(module.importlib_metadata).should_receive('version').and_return('1.0.0')
|
flexmock(module.importlib.metadata).should_receive('version').and_return('1.0.0')
|
||||||
flexmock(sys.modules['builtins']).should_receive('open').with_args(
|
flexmock(sys.modules['builtins']).should_receive('open').with_args(
|
||||||
'/home/user/.borgmatic/bootstrap/manifest.json', 'w'
|
'/home/user/.borgmatic/bootstrap/manifest.json', 'w'
|
||||||
).and_return(
|
).and_return(
|
||||||
|
@ -172,7 +172,7 @@ def test_create_borgmatic_manifest_creates_manifest_file_with_custom_borgmatic_s
|
||||||
flexmock(module.os.path).should_receive('exists').and_return(False)
|
flexmock(module.os.path).should_receive('exists').and_return(False)
|
||||||
flexmock(module.os).should_receive('makedirs').and_return(True)
|
flexmock(module.os).should_receive('makedirs').and_return(True)
|
||||||
|
|
||||||
flexmock(module.importlib_metadata).should_receive('version').and_return('1.0.0')
|
flexmock(module.importlib.metadata).should_receive('version').and_return('1.0.0')
|
||||||
flexmock(sys.modules['builtins']).should_receive('open').with_args(
|
flexmock(sys.modules['builtins']).should_receive('open').with_args(
|
||||||
'/borgmatic/bootstrap/manifest.json', 'w'
|
'/borgmatic/bootstrap/manifest.json', 'w'
|
||||||
).and_return(
|
).and_return(
|
||||||
|
|
Loading…
Reference in a new issue