summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2011-10-05 19:19:37 -0400
committerGravatar Jon Bernard <jbernard@tuxion.com> 2011-10-05 19:19:37 -0400
commit392ae7974f7aed0c8ff6510d187caaa41b11d2ff (patch)
tree8efa370cd55884e6bee8b9b1c2902959e021cb25
parentcd0d973446dbb5409323d077371a6ebc98836f80 (diff)
parentbf73e1f7d50506ff6ac58e5f70e1ac9f0412e1d3 (diff)
downloaddotfiles-cba5695e99f6955efeede54b0c512ce9e1e8197b.tar.gz
dotfiles-cba5695e99f6955efeede54b0c512ce9e1e8197b.tar.bz2
dotfiles-cba5695e99f6955efeede54b0c512ce9e1e8197b.zip
Merge branch 'release/0.4.2'v0.4.2
-rw-r--r--AUTHORS.rst12
-rw-r--r--HISTORY.rst7
-rw-r--r--MANIFEST.in2
-rw-r--r--README.rst6
-rw-r--r--dotfiles/core.py4
-rwxr-xr-xsetup.py3
-rwxr-xr-xtest_dotfiles.py39
7 files changed, 65 insertions, 8 deletions
diff --git a/AUTHORS.rst b/AUTHORS.rst
new file mode 100644
index 0000000..4bdcc0b
--- /dev/null
+++ b/AUTHORS.rst
@@ -0,0 +1,12 @@
+Dotfiles is written and maintained by Jon Bernard and various contributors:
+
+Development Lead
+````````````````
+
+- Jon Bernard <jbernard@tuxion.com>
+
+
+Patches and Suggestions
+```````````````````````
+
+- Anaƫl Beutot
diff --git a/HISTORY.rst b/HISTORY.rst
new file mode 100644
index 0000000..64c4346
--- /dev/null
+++ b/HISTORY.rst
@@ -0,0 +1,7 @@
+History
+-------
+
+0.4.2
++++++
+
+* Fix bug when syncing an unmanaged directory symlink
diff --git a/MANIFEST.in b/MANIFEST.in
index 0c73842..ec3e59e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1 @@
-include README.rst LICENSE
+include HISTORY.rst README.rst LICENSE AUTHORS.rst
diff --git a/README.rst b/README.rst
index 5e959fd..d717ff9 100644
--- a/README.rst
+++ b/README.rst
@@ -151,7 +151,9 @@ GPL License. ::
Contribute
----------
-If you'd like to contribute, simply fork `the repository`_, commit your changes
-and send a pull request.
+If you'd like to contribute, simply fork `the repository`_, commit your
+changes to the **develop** branch (or branch off of it), and send a pull
+request. Make sure you add yourself to AUTHORS_.
.. _`the repository`: https://github.com/jbernard/dotfiles
+.. _AUTHORS: https://github.com/jbernard/dotfiles/blob/master/AUTHORS
diff --git a/dotfiles/core.py b/dotfiles/core.py
index e99811b..f3241c9 100644
--- a/dotfiles/core.py
+++ b/dotfiles/core.py
@@ -11,7 +11,7 @@ import os
import shutil
-__version__ = '0.4.1'
+__version__ = '0.4.2'
__author__ = "Jon Bernard"
__license__ = "GPL"
@@ -38,7 +38,7 @@ class Dotfile(object):
if not force:
print "Skipping \"%s\", use --force to override" % self.basename
return
- if os.path.isdir(self.name):
+ if os.path.isdir(self.name) and not os.path.islink(self.name):
shutil.rmtree(self.name)
else:
os.remove(self.name)
diff --git a/setup.py b/setup.py
index df99c5a..e11410b 100755
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,8 @@ if sys.argv[-1] == "test":
setup(name='dotfiles',
version=__version__,
description='Easily manage your dotfiles',
- long_description=open('README.rst').read(),
+ long_description=open('README.rst').read() + '\n\n' +
+ open('HISTORY.rst').read(),
author='Jon Bernard',
author_email='jbernard@tuxion.com',
url='https://github.com/jbernard/dotfiles',
diff --git a/test_dotfiles.py b/test_dotfiles.py
index 360d7db..bb54578 100755
--- a/test_dotfiles.py
+++ b/test_dotfiles.py
@@ -21,7 +21,7 @@ class DotfilesTestCase(unittest.TestCase):
self.home = tempfile.mkdtemp()
- # create a repository for the tests to use
+ # Create a repository for the tests to use.
self.repo = os.path.join(self.home, 'Dotfiles')
os.mkdir(self.repo)
@@ -62,7 +62,7 @@ class DotfilesTestCase(unittest.TestCase):
dotfiles.sync()
- # make sure sync() did the right thing
+ # Make sure sync() did the right thing.
self.assertEqual(
os.path.realpath(os.path.join(self.home, '.bashrc')),
os.path.join(self.repo, 'bashrc'))
@@ -76,6 +76,41 @@ class DotfilesTestCase(unittest.TestCase):
os.path.realpath(os.path.join(self.home, '.bashrc')),
os.path.join(target, 'bashrc'))
+ def test_sync_unmanaged_directory_symlink(self):
+ """Test a forced sync on a directory symlink.
+
+ A bug was reported where a user wanted to replace a dotfile repository
+ with an other one. They had a .vim directory in their home directory
+ which was obviously also a symbolic link. This caused:
+
+ OSError: Cannot call rmtree on a symbolic link
+ """
+
+ # Create a dotfile symlink to some directory
+ os.mkdir(os.path.join(self.home, 'vim'))
+ os.symlink(os.path.join(self.home, 'vim'),
+ os.path.join(self.home, '.vim'))
+
+ # Create a vim directory in the repository. This will cause the above
+ # symlink to be overwritten on sync.
+ os.mkdir(os.path.join(self.repo, 'vim'))
+
+ # Make sure the symlink points to the correct location.
+ self.assertEqual(
+ os.path.realpath(os.path.join(self.home, '.vim')),
+ os.path.join(self.home, 'vim'))
+
+ dotfiles = core.Dotfiles(
+ home=self.home, repo=self.repo, prefix='',
+ ignore=[], externals={})
+
+ dotfiles.sync(force=True)
+
+ # The symlink should now point to the directory in the repository.
+ self.assertEqual(
+ os.path.realpath(os.path.join(self.home, '.vim')),
+ os.path.join(self.repo, 'vim'))
+
def suite():
suite = unittest.TestLoader().loadTestsFromTestCase(DotfilesTestCase)