Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
RKrahl committed Dec 12, 2020
2 parents 64e7f53 + d33fd18 commit 3ee4474
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 74 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
install: pip install -r .travis_require
script: make test

Expand Down
224 changes: 158 additions & 66 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,80 +1,172 @@
Changelog
=========


0.5.1 (2020-12-12)
~~~~~~~~~~~~~~~~~~

Bug fixes and minor changes
---------------------------

+ `#46`_, `#47`_: `archive-tool` fails with :exc:`NameError` when
trying to emit a warning.

.. _#46: https://github.com/RKrahl/archive-tools/issues/46
.. _#47: https://github.com/RKrahl/archive-tools/pull/47


0.5 (2020-05-09)
New features
+ #45: The files argument to `archive-tool check` defaults to
the archive's basedir.
~~~~~~~~~~~~~~~~

New features
------------

+ `#45`_: The files argument to `archive-tool check` defaults to the
archive's basedir.

Bug fixes and minor changes
---------------------------

+ Fix: some test data have not been included in the source
distribution.

.. _#45: https://github.com/RKrahl/archive-tools/issues/45

Bug fixes and minor changes
+ Fix: some test data have not been included in the source
distribution.

0.4 (2019-12-26)
New features
+ #15, #43: Add `archive-tool find` subcommand.
+ #38, #39: Add `archive-tool diff` subcommand.
+ #40, #44: Add setting tags in the header of the manifest.
+ #41: Add a :meth:`Archive.extract` method.
+ Add a :meth:`Manifest.sort` method.
~~~~~~~~~~~~~~~~

New features
------------

+ `#15`_, `#43`_: Add `archive-tool find` subcommand.

+ `#38`_, `#39`_: Add `archive-tool diff` subcommand.

+ `#40`_, `#44`_: Add setting tags in the header of the manifest.

+ `#41`_: Add a :meth:`Archive.extract` method.

+ Add a :meth:`Manifest.sort` method.

Internal changes
----------------

+ Reorganization of the `archive-tool` script, move the code into
submodules in the new `archive.cli` package.

.. _#15: https://github.com/RKrahl/archive-tools/issues/15
.. _#38: https://github.com/RKrahl/archive-tools/issues/38
.. _#39: https://github.com/RKrahl/archive-tools/pull/39
.. _#40: https://github.com/RKrahl/archive-tools/issues/40
.. _#41: https://github.com/RKrahl/archive-tools/pull/41
.. _#43: https://github.com/RKrahl/archive-tools/pull/43
.. _#44: https://github.com/RKrahl/archive-tools/pull/44

Internal changes
+ Reorganization of the `archive-tool` script, move the code into
submodules in the new `archive.cli` package.

0.3 (2019-08-06)
New features
+ #33: `archive-tool create` should have an option to exclude files.
+ #35: :class:`FileInfo` calculates checksums lazily.
+ #34: files of unsupported type are ignored when creating an
archive. A warning is emitted instead of raising an error.

Incompatible changes
+ #36: Drop support for strings in the file name arguments
`path`, `paths`, `basedir`, and `workdir` of the methods
:meth:`Archive.create` and :meth:`Archive.open`. These
arguments require :class:`Path` objects now.

Bug fixes and minor changes
+ #37: `archive-tool create` throws an error when trying to
explicitly add a symlink.
~~~~~~~~~~~~~~~~

New features
------------

+ `#33`_: `archive-tool create` should have an option to exclude files.

+ `#35`_: :class:`FileInfo` calculates checksums lazily.

+ `#34`_: files of unsupported type are ignored when creating an
archive. A warning is emitted instead of raising an error.

Incompatible changes
--------------------

+ `#36`_: Drop support for strings in the file name arguments `path`,
`paths`, `basedir`, and `workdir` of the methods
:meth:`Archive.create` and :meth:`Archive.open`. These arguments
require :class:`Path` objects now.

Bug fixes and minor changes
---------------------------

+ `#37`_: `archive-tool create` throws an error when trying to
explicitly add a symlink.

.. _#33: https://github.com/RKrahl/archive-tools/issues/33
.. _#34: https://github.com/RKrahl/archive-tools/issues/34
.. _#35: https://github.com/RKrahl/archive-tools/issues/35
.. _#36: https://github.com/RKrahl/archive-tools/pull/36
.. _#37: https://github.com/RKrahl/archive-tools/issues/37


0.2 (2019-07-14)
New features
+ #28: support deduplication.
+ #26 and #30: add support for custom metadata:
- Add methods :meth:`Archive.add_metadata` and
:meth:`Archive.get_metadata` to add and to retrieve custom
metadata to and from archives.
- Add a list of metadata items in the header of the
manifest.
- Bump manifest version to 1.1.
+ #4, #32: Add :class:`MailArchive` implementing a special
flavour of an :class:`Archive` for storing mails.
+ #27: Add command line flags `--prefix <dir>` and `--stdin` to
`archive-tool check`.

Incompatible changes
+ #23 and #26: review the API of :class:`Archive`:
- Add two methods :meth:`Archive.create` and
:meth:`Archive.open` that create and read archives
respectively.
- The :meth:`Archive.__init__` method does not create or
open archives any longer.
- :meth:`Archive.verify` does not accept the mode argument
any more.
- :class:`Archive` keeps a file object to read the tarfile.
It is opened in :meth:`Archive.open`.
:meth:`Archive.verify` does not reopen the tarfile, but
relies on the internal file object to be left open.
- Add a :meth:`Archive.close` method.
- :class:`Archive` implements the context manager protocol.

Bug fixes and minor changes
+ #20: :meth:`Archive.create` takes a working directory as
optional argument.
+ #29: Verfiy fails if archive contains hard links.
+ #25: `archive-tool check` should ignore metadata.
~~~~~~~~~~~~~~~~

New features
------------

+ `#28`_: support deduplication.

+ `#26`_ and `#30`_: add support for custom metadata:

- Add methods :meth:`Archive.add_metadata` and
:meth:`Archive.get_metadata` to add and to retrieve custom
metadata to and from archives.

- Add a list of metadata items in the header of the manifest.

- Bump manifest version to 1.1.

+ `#4`_, `#32`_: Add :class:`MailArchive` implementing a special
flavour of an :class:`Archive` for storing mails.

+ `#27`_: Add command line flags `--prefix <dir>` and `--stdin` to
`archive-tool check`.

Incompatible changes
--------------------

+ `#23`_ and `#26`_: review the API of :class:`Archive`:

- Add two methods :meth:`Archive.create` and :meth:`Archive.open`
that create and read archives respectively.

- The :meth:`Archive.__init__` method does not create or open
archives any longer.

- :meth:`Archive.verify` does not accept the mode argument any more.

- :class:`Archive` keeps a file object to read the tarfile. It is
opened in :meth:`Archive.open`. :meth:`Archive.verify` does not
reopen the tarfile, but relies on the internal file object to be
left open.

- Add a :meth:`Archive.close` method.

- :class:`Archive` implements the context manager protocol.

Bug fixes and minor changes
---------------------------

+ `#20`_: :meth:`Archive.create` takes a working directory as optional
argument.

+ `#29`_: Verify fails if archive contains hard links.

+ `#25`_: `archive-tool check` should ignore metadata.

.. _#4: https://github.com/RKrahl/archive-tools/issues/4
.. _#20: https://github.com/RKrahl/archive-tools/issues/20
.. _#23: https://github.com/RKrahl/archive-tools/issues/23
.. _#25: https://github.com/RKrahl/archive-tools/issues/25
.. _#26: https://github.com/RKrahl/archive-tools/pull/26
.. _#27: https://github.com/RKrahl/archive-tools/issues/27
.. _#28: https://github.com/RKrahl/archive-tools/issues/28
.. _#29: https://github.com/RKrahl/archive-tools/issues/29
.. _#30: https://github.com/RKrahl/archive-tools/pull/30
.. _#32: https://github.com/RKrahl/archive-tools/pull/32


0.1 (2019-04-14)
+ Initial release.
~~~~~~~~~~~~~~~~

+ Initial release.
3 changes: 2 additions & 1 deletion archive/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

subcmds = [ "create", "verify", "ls", "info", "check", "diff", "find", ]

argparser = argparse.ArgumentParser()

def showwarning(message, category, filename, lineno, file=None, line=None):
"""Display ArchiveWarning in a somewhat more user friendly manner.
All other warnings are formatted the standard way.
Expand All @@ -32,7 +34,6 @@ def showwarning(message, category, filename, lineno, file=None, line=None):

def archive_tool():
warnings.showwarning = showwarning
argparser = argparse.ArgumentParser()
subparsers = argparser.add_subparsers(title='subcommands', dest='subcmd')
for sc in subcmds:
m = importlib.import_module('archive.cli.%s' % sc)
Expand Down
4 changes: 3 additions & 1 deletion python-archive-tools.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%bcond_with tests
%bcond_without tests
%global distname archive-tools

Name: python3-%{distname}
Expand All @@ -9,6 +9,7 @@ Summary: $description
License: Apache-2.0
Group: Development/Libraries/Python
Source: %{distname}-%{version}.tar.gz
BuildRequires: fdupes
BuildRequires: python3-base >= 3.4
%if %{with tests}
BuildRequires: python3-PyYAML
Expand Down Expand Up @@ -40,6 +41,7 @@ for f in `ls %{buildroot}%{_bindir}`
do
mv %{buildroot}%{_bindir}/$$f %{buildroot}%{_bindir}/$${f%%.py}
done
%fdupes %{buildroot}


%if %{with tests}
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def run(self):
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: System :: Archiving",
],
cmdclass = {'build_py': build_py, 'sdist': sdist, 'init_py': init_py},
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from pathlib import Path
from random import getrandbits
import shutil
import stat
import subprocess
import sys
import tempfile
Expand Down
1 change: 0 additions & 1 deletion tests/test_02_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from pathlib import Path
import shutil
import subprocess
import tarfile
import pytest
from pytest_dependency import depends
from archive import Archive
Expand Down
1 change: 0 additions & 1 deletion tests/test_03_create_dedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import pytest
from pytest_dependency import depends
from archive.archive import Archive, DedupMode
from archive.manifest import Manifest
from conftest import *


Expand Down
7 changes: 5 additions & 2 deletions tests/test_04_cli_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import os
from pathlib import Path
import re
import stat
import subprocess
import tarfile
from tempfile import TemporaryFile
from archive.manifest import Manifest
Expand Down Expand Up @@ -114,7 +114,10 @@ def test_cli_create_rel_start_basedir(test_dir, testname, monkeypatch):
callscript("archive-tool.py", args, returncode=1, stderr=f)
f.seek(0)
line = f.readline()
assert "'base/msg.txt' does not start with 'base/data'" in line
# The actual error message differs between Python versions, so
# lets just assert that the error is something about
# 'base/msg.txt' and 'base/data'.
assert re.search(r"'base/msg.txt'.*'base/data'", line)

def test_cli_ls_archive_not_found(test_dir, monkeypatch):
monkeypatch.chdir(str(test_dir))
Expand Down
Loading

0 comments on commit 3ee4474

Please sign in to comment.