Compare commits

...
8 Commits
10 changed files with 29 additions and 20 deletions
+1
View File
@@ -13,5 +13,6 @@ matrix:
- 3.7 - 3.7
- 3.8 - 3.8
PYTHON_VERSION: PYTHON_VERSION:
- 3.5
- 3.6 - 3.6
- 3.7 - 3.7
+4
View File
@@ -1,3 +1,7 @@
1.2.9
* #102: Fix for syntax error that occurred in Python 3.5 and below.
* Make automated tests support running in Python 3.5.
1.2.8 1.2.8
* #73: Enable consistency checks for only certain repositories via "check_repositories" option in * #73: Enable consistency checks for only certain repositories via "check_repositories" option in
borgmatic's consistency configuration. Handy for large repositories that take forever to check. borgmatic's consistency configuration. Handy for large repositories that take forever to check.
-3
View File
@@ -445,9 +445,6 @@ cd borgmatic
tox tox
``` ```
Note that while running borgmatic itself only requires Python 3+, running
borgmatic's tests require Python 3.6+.
If when running tests, you get an error from the If when running tests, you get an error from the
[Black](https://black.readthedocs.io/en/stable/) code formatter about files [Black](https://black.readthedocs.io/en/stable/) code formatter about files
that would be reformatted, you can ask Black to format them for you via the that would be reformatted, you can ask Black to format them for you via the
+1 -1
View File
@@ -189,7 +189,7 @@ def _run_commands_on_repository(
remote_path, remote_path,
retention, retention,
storage, storage,
unexpanded_repository, unexpanded_repository
): # pragma: no cover ): # pragma: no cover
repository = os.path.expanduser(unexpanded_repository) repository = os.path.expanduser(unexpanded_repository)
dry_run_label = ' (dry run; not making any changes)' if args.dry_run else '' dry_run_label = ' (dry run; not making any changes)' if args.dry_run else ''
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env sh
if which black; then
black --skip-string-normalization --line-length 100 --check .
else
echo "Skipping black due to not being installed."
fi
+2 -2
View File
@@ -27,8 +27,8 @@ twine upload -r pypi dist/borgmatic-*.tar.gz
twine upload -r pypi dist/borgmatic-*-py3-none-any.whl twine upload -r pypi dist/borgmatic-*-py3-none-any.whl
# Set release changelogs on projects.evoworx.org and GitHub. # Set release changelogs on projects.evoworx.org and GitHub.
release_changelog=$(sed '/^$/q' NEWS |grep '^\s*\*') release_changelog="$(cat NEWS | sed '/^$/q' | grep -v '^\S')"
escaped_release_changelog=$(echo $release_changelog | sed -z 's/\n/\\n/g') escaped_release_changelog="$(echo "$release_changelog" | sed -z 's/\n/\\n/g' | sed -z 's/\"/\\"/g')"
curl --request POST \ curl --request POST \
"https://projects.torsion.org/api/v1/repos/witten/borgmatic/releases?access_token=$projects_token" \ "https://projects.torsion.org/api/v1/repos/witten/borgmatic/releases?access_token=$projects_token" \
--header "Accept: application/json" \ --header "Accept: application/json" \
+1 -2
View File
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
VERSION = '1.2.8' VERSION = '1.2.9'
setup( setup(
@@ -30,6 +30,5 @@ setup(
}, },
obsoletes=['atticmatic'], obsoletes=['atticmatic'],
install_requires=('pykwalify>=1.6.0,<14.06', 'ruamel.yaml>0.15.0,<0.16.0', 'setuptools'), install_requires=('pykwalify>=1.6.0,<14.06', 'ruamel.yaml>0.15.0,<0.16.0', 'setuptools'),
tests_require=('flexmock', 'pytest'),
include_package_data=True, include_package_data=True,
) )
+1 -1
View File
@@ -1,7 +1,7 @@
appdirs==1.4.3 appdirs==1.4.3
atomicwrites==1.2.1 atomicwrites==1.2.1
attrs==18.2.0 attrs==18.2.0
black==18.9b0 black==18.9b0; python_version >= '3.6'
Click==7.0 Click==7.0
coverage==4.5.1 coverage==4.5.1
docopt==0.6.2 docopt==0.6.2
+10 -10
View File
@@ -11,12 +11,14 @@ def generate_configuration(config_path, repository_path):
Generate borgmatic configuration into a file at the config path, and update the defaults so as Generate borgmatic configuration into a file at the config path, and update the defaults so as
to work for testing (including injecting the given repository path). to work for testing (including injecting the given repository path).
''' '''
subprocess.check_call(f'generate-borgmatic-config --destination {config_path}'.split(' ')) subprocess.check_call(
'generate-borgmatic-config --destination {}'.format(config_path).split(' ')
)
config = ( config = (
open(config_path) open(config_path)
.read() .read()
.replace('user@backupserver:sourcehostname.borg', repository_path) .replace('user@backupserver:sourcehostname.borg', repository_path)
.replace('- /home', f'- {config_path}') .replace('- /home', '- {}'.format(config_path))
.replace('- /etc', '') .replace('- /etc', '')
.replace('- /var/log/syslog*', '') .replace('- /var/log/syslog*', '')
) )
@@ -32,7 +34,7 @@ def test_borgmatic_command():
try: try:
subprocess.check_call( subprocess.check_call(
f'borg init --encryption repokey {repository_path}'.split(' '), 'borg init --encryption repokey {}'.format(repository_path).split(' '),
env={'BORG_PASSPHRASE': '', **os.environ}, env={'BORG_PASSPHRASE': '', **os.environ},
) )
@@ -40,11 +42,10 @@ def test_borgmatic_command():
generate_configuration(config_path, repository_path) generate_configuration(config_path, repository_path)
# Run borgmatic to generate a backup archive, and then list it to make sure it exists. # Run borgmatic to generate a backup archive, and then list it to make sure it exists.
subprocess.check_call(f'borgmatic --config {config_path}'.split(' ')) subprocess.check_call('borgmatic --config {}'.format(config_path).split(' '))
output = subprocess.check_output( output = subprocess.check_output(
f'borgmatic --config {config_path} --list --json'.split(' '), 'borgmatic --config {} --list --json'.format(config_path).split(' ')
encoding=sys.stdout.encoding, ).decode(sys.stdout.encoding)
)
parsed_output = json.loads(output) parsed_output = json.loads(output)
assert len(parsed_output) == 1 assert len(parsed_output) == 1
@@ -52,9 +53,8 @@ def test_borgmatic_command():
# Also exercise the info flag. # Also exercise the info flag.
output = subprocess.check_output( output = subprocess.check_output(
f'borgmatic --config {config_path} --info --json'.split(' '), 'borgmatic --config {} --info --json'.format(config_path).split(' ')
encoding=sys.stdout.encoding, ).decode(sys.stdout.encoding)
)
parsed_output = json.loads(output) parsed_output = json.loads(output)
assert len(parsed_output) == 1 assert len(parsed_output) == 1
+2 -1
View File
@@ -5,10 +5,11 @@ skipsdist = True
[testenv] [testenv]
usedevelop = True usedevelop = True
deps = -rtest_requirements.txt deps = -rtest_requirements.txt
whitelist_externals = sh
commands = commands =
py.test --cov-report term-missing:skip-covered --cov=borgmatic --ignore=tests/end-to-end \ py.test --cov-report term-missing:skip-covered --cov=borgmatic --ignore=tests/end-to-end \
tests [] tests []
black --skip-string-normalization --line-length 100 --check . sh scripts/black
flake8 . flake8 .
[testenv:black] [testenv:black]