summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilip Pytloun <filip@pytloun.cz>2016-08-22 19:13:27 +0200
committergit-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com>2016-08-27 04:20:03 +0000
commitd3decd189822892ee1741a7b952880378a0082d1 (patch)
tree2400da1f358db88627bdc69fa2a1da21750bf90e
parentc456d5cdcfcda6d1aba6ad7dc082f83604922d37 (diff)
Imported using git-ubuntu import.
Notes
Notes: * New upstream version
-rw-r--r--.travis.yml9
-rw-r--r--CONTRIBUTING.rst11
-rw-r--r--atomicwrites/__init__.py10
-rw-r--r--debian/.git-dpm14
-rw-r--r--debian/changelog6
-rw-r--r--debian/patches/0001-Fix-privacy-breach-by-removing-embedded-image.patch2
-rw-r--r--tests/test_atomicwrites.py22
-rw-r--r--tox.ini16
8 files changed, 63 insertions, 27 deletions
diff --git a/.travis.yml b/.travis.yml
index 2f285ae..e977901 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,6 @@
sudo: false
os: linux
language: python
-env:
- - TOXENV_SUFFIX=test
- - TOXENV_SUFFIX=stylecheck
matrix:
include:
@@ -31,4 +28,8 @@ install:
- pip install tox
script:
- - tox -e $(echo py$TRAVIS_PYTHON_VERSION | tr -d . | sed -e 's/pypypy/pypy/')-$TOXENV_SUFFIX
+ - export TOX_PY="$(echo py$TRAVIS_PYTHON_VERSION | tr -d . | sed -e 's/pypypy/pypy/')"
+ - tox -e $TOX_PY-test
+ - if [ "$TRAVIS_PYTHON_VERSION" = "2.7" ] || [ "$TRAVIS_PYTHON_VERSION" = ".3.5" ]; then
+ tox -e $TOX_PY-stylecheck;
+ fi
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
new file mode 100644
index 0000000..86d3e4a
--- /dev/null
+++ b/CONTRIBUTING.rst
@@ -0,0 +1,11 @@
+Thanks for contributing to python-atomicwrites! This document is a
+work-in-progress. Below are a few notes that are useful for writing patches.
+
+Running the tests
+=================
+
+::
+
+ pip install tox
+ tox -e py-test
+ tox -e py-stylecheck
diff --git a/atomicwrites/__init__.py b/atomicwrites/__init__.py
index 125740f..a182c07 100644
--- a/atomicwrites/__init__.py
+++ b/atomicwrites/__init__.py
@@ -8,7 +8,7 @@ try:
except ImportError:
fcntl = None
-__version__ = '1.1.0'
+__version__ = '1.1.5'
PY2 = sys.version_info[0] == 2
@@ -43,14 +43,14 @@ if sys.platform != 'win32':
def _replace_atomic(src, dst):
os.rename(src, dst)
- _sync_directory(os.path.dirname(dst))
+ _sync_directory(os.path.normpath(os.path.dirname(dst)))
def _move_atomic(src, dst):
os.link(src, dst)
os.unlink(src)
- src_dir = os.path.dirname(src)
- dst_dir = os.path.dirname(dst)
+ src_dir = os.path.normpath(os.path.dirname(src))
+ dst_dir = os.path.normpath(os.path.dirname(dst))
_sync_directory(dst_dir)
if src_dir != dst_dir:
_sync_directory(src_dir)
@@ -161,7 +161,7 @@ class AtomicWriter(object):
def get_fileobject(self, dir=None, **kwargs):
'''Return the temporary file to use.'''
if dir is None:
- dir = os.path.dirname(self._path)
+ dir = os.path.normpath(os.path.dirname(self._path))
return tempfile.NamedTemporaryFile(mode=self._mode, dir=dir,
delete=False, **kwargs)
diff --git a/debian/.git-dpm b/debian/.git-dpm
index 5583c0a..e97f997 100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@ -1,11 +1,11 @@
# see git-dpm(1) from git-dpm package
-933a53b9e7a58a18cbf65f28505f56e951883bcf
-933a53b9e7a58a18cbf65f28505f56e951883bcf
-1aaaf19f6b75d658a88bf03dcb1aba71ea21af79
-1aaaf19f6b75d658a88bf03dcb1aba71ea21af79
-python-atomicwrites_1.1.0.orig.tar.gz
-458a841c0d4abf0b56ce1a9e24c14a175fb7a842
-10715
+9217fbc8a0739edf49c25118c14517f63c2c4e66
+9217fbc8a0739edf49c25118c14517f63c2c4e66
+ecfe7186a2095f3eaed17d028d43c1340e1e823c
+ecfe7186a2095f3eaed17d028d43c1340e1e823c
+python-atomicwrites_1.1.5.orig.tar.gz
+50b9ce2e8fb20aae8bdd5ad2ae17060de6725119
+11050
debianTag="debian/%e%v"
patchedTag="patched/%e%v"
upstreamTag="upstream/%e%u"
diff --git a/debian/changelog b/debian/changelog
index dbb5e29..0882484 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-atomicwrites (1.1.5-1) unstable; urgency=medium
+
+ * New upstream version
+
+ -- Filip Pytloun <filip@pytloun.cz> Mon, 22 Aug 2016 19:13:27 +0200
+
python-atomicwrites (1.1.0-1) unstable; urgency=low
* initial release (Closes: #833845)
diff --git a/debian/patches/0001-Fix-privacy-breach-by-removing-embedded-image.patch b/debian/patches/0001-Fix-privacy-breach-by-removing-embedded-image.patch
index a9c6c8b..b1e1229 100644
--- a/debian/patches/0001-Fix-privacy-breach-by-removing-embedded-image.patch
+++ b/debian/patches/0001-Fix-privacy-breach-by-removing-embedded-image.patch
@@ -1,4 +1,4 @@
-From 933a53b9e7a58a18cbf65f28505f56e951883bcf Mon Sep 17 00:00:00 2001
+From 9217fbc8a0739edf49c25118c14517f63c2c4e66 Mon Sep 17 00:00:00 2001
From: Filip Pytloun <filip@pytloun.cz>
Date: Tue, 9 Aug 2016 13:03:50 +0200
Subject: Fix privacy-breach by removing embedded image
diff --git a/tests/test_atomicwrites.py b/tests/test_atomicwrites.py
index 3fcddd2..9577199 100644
--- a/tests/test_atomicwrites.py
+++ b/tests/test_atomicwrites.py
@@ -1,4 +1,5 @@
import errno
+import os
from atomicwrites import atomic_write
@@ -65,3 +66,24 @@ def test_open_reraise(tmpdir):
f.name = "asdf"
# Now trigger our own exception.
assert False, "Intentional failure for testing purposes"
+
+
+def test_atomic_write_in_pwd(tmpdir):
+ orig_curdir = os.getcwd()
+ try:
+ os.chdir(str(tmpdir))
+ fname = 'ha'
+ for i in range(2):
+ with atomic_write(str(fname), overwrite=True) as f:
+ f.write('hoho')
+
+ with pytest.raises(OSError) as excinfo:
+ with atomic_write(str(fname), overwrite=False) as f:
+ f.write('haha')
+
+ assert excinfo.value.errno == errno.EEXIST
+
+ assert open(fname).read() == 'hoho'
+ assert len(tmpdir.listdir()) == 1
+ finally:
+ os.chdir(orig_curdir)
diff --git a/tox.ini b/tox.ini
index db61843..dfadf03 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,15 +1,11 @@
[tox]
envlist = py{26,27,py,33,34,35}-{test,stylecheck}
-[testenv:test]
+[testenv]
deps =
- pytest
+ test: pytest
+ stylecheck: flake8
+ stylecheck: flake8-import-order
commands =
- py.test []
-
-[testenv:stylecheck]
-deps =
- flake8
- flake8-import-order
-commands =
- flake8 []
+ test: py.test []
+ stylecheck: flake8 []