diff options
author | Bob Ippolito <bob@redivi.com> | 2019-12-02 11:13:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-02 11:13:18 -0800 |
commit | 1d7acae7500bcea8c6dc9620c6e8a762c9e5334e (patch) | |
tree | fd57f9eb79662e88057a3bb6e9839e4115171348 | |
parent | 46e2ad7ae823e3b05ddbfb9ac809800fbe26cfa3 (diff) | |
parent | edd28d55fc34666bfcd377e9d93a9f35ee5b428d (diff) | |
download | xattr-1d7acae7500bcea8c6dc9620c6e8a762c9e5334e.tar.gz |
Merge pull request #87 from xattr/iteritems-fix-gh-86
Use items rather than iteritems for xattr.update
-rw-r--r-- | .travis.yml | 8 | ||||
-rw-r--r-- | CHANGES.txt | 5 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | xattr/__init__.py | 6 | ||||
-rw-r--r-- | xattr/tests/test_xattr.py | 10 |
5 files changed, 26 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index 91c2f0c..694268b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,12 @@ cache: - "$HOME/.pyenv" matrix: include: + - name: "Ubuntu: 3.8" + os: linux + python: 3.8 + - name: "Ubuntu: 3.7" + os: linux + python: 3.7 - name: "Ubuntu: 3.6" os: linux python: 3.6 @@ -25,7 +31,7 @@ matrix: - name: "OSX: 3.7" os: osx language: generic - env: PYENV_VERSION=3.7.0 BUILD_SDIST=true + env: PYENV_VERSION=3.7.4 BUILD_SDIST=true osx_image: xcode_9.4 - name: "OSX: 3.6" os: osx diff --git a/CHANGES.txt b/CHANGES.txt index 130ad3c..3a3e6ce 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +Version 0.9.7 released 2019-12-01 + +* Fix xattr().update() in Python 3 + https://github.com/xattr/xattr/pull/87 + Version 0.9.6 released 2018-07-31 * Fix release build by including *.[ch] in Manifest.in @@ -5,7 +5,7 @@ import sys from setuptools import setup -VERSION = '0.9.6' +VERSION = '0.9.7' DESCRIPTION = "Python wrapper for extended filesystem attributes" LONG_DESCRIPTION = """ Extended attributes extend the basic attributes of files and directories diff --git a/xattr/__init__.py b/xattr/__init__.py index 13389bf..50780b4 100644 --- a/xattr/__init__.py +++ b/xattr/__init__.py @@ -7,7 +7,7 @@ The xattr type wraps a path or file descriptor with a dict-like interface that exposes these extended attributes. """ -__version__ = '0.9.6' +__version__ = '0.9.7' from .compat import integer_types from .lib import (XATTR_NOFOLLOW, XATTR_CREATE, XATTR_REPLACE, @@ -137,9 +137,9 @@ class xattr(object): del self[k] def update(self, seq): - if not hasattr(seq, 'iteritems'): + if not hasattr(seq, 'items'): seq = dict(seq) - for k, v in seq.iteritems(): + for k, v in seq.items(): self[k] = v def copy(self): diff --git a/xattr/tests/test_xattr.py b/xattr/tests/test_xattr.py index cb6ebb9..d2e7533 100644 --- a/xattr/tests/test_xattr.py +++ b/xattr/tests/test_xattr.py @@ -28,6 +28,16 @@ class BaseTestXattr(object): else: self._test_attr() + def test_update(self): + x = xattr.xattr(self.tempfile) + attrs = { + 'user.test.key1': b'test_value1', + 'user.test.key2': b'test_value2' + } + x.update(attrs) + for k, v in attrs.items(): + self.assertEqual(x[k], v) + def _test_attr(self): x = xattr.xattr(self.tempfile) |