From 62fe5122a4f82b6a5f65a6a666ce469753fd2553 Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Sun, 8 Jan 2012 17:12:12 -0500 Subject: Update remaining references to 'unmanaged' --- README.rst | 2 +- dotfiles/cli.py | 2 +- dotfiles/core.py | 4 ++-- test_dotfiles.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index e396b75..c496cb7 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ Interface Remove dotfile(s) from the repository. ``-s, --sync`` - Update dotfile symlinks. You can overwrite unmanaged files with ``-f`` or + Update dotfile symlinks. You can overwrite colliding files with ``-f`` or ``--force``. ``-m, --move`` diff --git a/dotfiles/cli.py b/dotfiles/cli.py index 1de9f1c..c14c0e8 100644 --- a/dotfiles/cli.py +++ b/dotfiles/cli.py @@ -59,7 +59,7 @@ def add_global_flags(parser): parser.add_option("-f", "--force", action="store_true", dest="force", default=False, - help="ignore unmanaged dotfiles (use with --sync)") + help="overwrite colliding dotfiles (use with --sync)") parser.add_option("-R", "--repo", type="string", dest="repository", diff --git a/dotfiles/core.py b/dotfiles/core.py index 76a354d..daf06f1 100644 --- a/dotfiles/core.py +++ b/dotfiles/core.py @@ -30,12 +30,12 @@ class Dotfile(object): if not os.path.lexists(self.name): self.status = 'missing' elif os.path.realpath(self.name) != self.target: - self.status = 'unmanaged' + self.status = 'unsynced' def sync(self, force): if self.status == 'missing': os.symlink(self.target, self.name) - elif self.status == 'unmanaged': + elif self.status == 'unsynced': if not force: print "Skipping \"%s\", use --force to override" % self.basename return diff --git a/test_dotfiles.py b/test_dotfiles.py index f9b6b46..8ee3a76 100755 --- a/test_dotfiles.py +++ b/test_dotfiles.py @@ -85,7 +85,7 @@ class DotfilesTestCase(unittest.TestCase): os.path.join(self.homedir, '.bashrc'), os.path.join(target, 'bashrc')) - def test_sync_unmanaged_directory_symlink(self): + def test_force_sync_directory_symlink(self): """Test a forced sync on a directory symlink. A bug was reported where a user wanted to replace a dotfile repository -- cgit v1.2.3 From 58da9a469d4553dad6c617b730d0bdff032e793b Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Sun, 22 Jan 2012 16:30:02 -0500 Subject: Allow ~ in configuration file external targets --- dotfiles/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotfiles/core.py b/dotfiles/core.py index daf06f1..3a6b8f2 100644 --- a/dotfiles/core.py +++ b/dotfiles/core.py @@ -96,7 +96,8 @@ class Dotfiles(object): os.path.join(self.repository, dotfile), self.homedir)) for dotfile in self.externals.keys(): - self.dotfiles.append(Dotfile(dotfile, self.externals[dotfile], + self.dotfiles.append(Dotfile(dotfile, + os.path.expanduser(self.externals[dotfile]), self.homedir)) def _fqpn(self, dotfile): -- cgit v1.2.3 From 3d10f1522f66ec841d770f9126e737b21f9b9973 Mon Sep 17 00:00:00 2001 From: Daniel Harding Date: Thu, 8 Mar 2012 13:10:55 +0000 Subject: Make source compatible with Python 3 Replaced a few Python 2-only idioms with equivalents that work in both Python 2 and Python 3. --- dotfiles/core.py | 18 ++++++++++-------- test_dotfiles.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dotfiles/core.py b/dotfiles/core.py index 3a6b8f2..6615651 100644 --- a/dotfiles/core.py +++ b/dotfiles/core.py @@ -37,7 +37,8 @@ class Dotfile(object): os.symlink(self.target, self.name) elif self.status == 'unsynced': if not force: - print "Skipping \"%s\", use --force to override" % self.basename + print("Skipping \"%s\", use --force to override" + % self.basename) return if os.path.isdir(self.name) and not os.path.islink(self.name): shutil.rmtree(self.name) @@ -47,17 +48,17 @@ class Dotfile(object): def add(self): if self.status == 'missing': - print "Skipping \"%s\", file not found" % self.basename + print("Skipping \"%s\", file not found" % self.basename) return if self.status == '': - print "Skipping \"%s\", already managed" % self.basename + print("Skipping \"%s\", already managed" % self.basename) return shutil.move(self.name, self.target) os.symlink(self.target, self.name) def remove(self): if self.status != '': - print "Skipping \"%s\", file is %s" % (self.basename, self.status) + print("Skipping \"%s\", file is %s" % (self.basename, self.status)) return os.remove(self.name) shutil.move(self.target, self.name) @@ -74,8 +75,9 @@ class Dotfiles(object): def __init__(self, **kwargs): # Map args from kwargs to instance-local variables - map(lambda k, v: (k in self.__attrs__) and setattr(self, k, v), - kwargs.iterkeys(), kwargs.itervalues()) + for k, v in kwargs.items(): + if k in self.__attrs__: + setattr(self, k, v) self._load() @@ -111,7 +113,7 @@ class Dotfiles(object): for dotfile in sorted(self.dotfiles, key=lambda dotfile: dotfile.name): if dotfile.status or verbose: - print dotfile + print(dotfile) def check(self): """List only unsynced and/or missing dotfiles.""" @@ -142,7 +144,7 @@ class Dotfiles(object): if os.path.basename(file).startswith('.'): getattr(Dotfile(file, self._fqpn(file), self.homedir), action)() else: - print "Skipping \"%s\", not a dotfile" % file + print("Skipping \"%s\", not a dotfile" % file) def move(self, target): """Move the repository to another location.""" diff --git a/test_dotfiles.py b/test_dotfiles.py index 8ee3a76..b892003 100755 --- a/test_dotfiles.py +++ b/test_dotfiles.py @@ -12,7 +12,7 @@ from dotfiles import core def touch(fname, times=None): - with file(fname, 'a'): + with open(fname, 'a'): os.utime(fname, times) -- cgit v1.2.3 From 6f4508102dff2db380434d7cf2a00a2cc3141731 Mon Sep 17 00:00:00 2001 From: Daniel Harding Date: Thu, 8 Mar 2012 16:42:58 +0000 Subject: Add specific Python version trove classifiers --- setup.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setup.py b/setup.py index 29763a3..2150fb2 100755 --- a/setup.py +++ b/setup.py @@ -40,6 +40,14 @@ setup(name='dotfiles', 'License :: OSI Approved :: ISC License (ISCL)' 'Natural Language :: English', 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.5', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.0', + 'Programming Language :: Python :: 3.1', + 'Programming Language :: Python :: 3.2', ), scripts=['bin/dotfiles'], ) -- cgit v1.2.3 From 78913b2ce0437a006b4e1567989ee018a636400a Mon Sep 17 00:00:00 2001 From: Daniel Harding Date: Thu, 8 Mar 2012 16:43:55 +0000 Subject: Add Daniel Harding as a contributor --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 2d33bcb..aa0ecaa 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -13,3 +13,4 @@ Patches and Suggestions - Remco Wendt - Sebastian Rahlf - Reinout van Rees +- Daniel Harding -- cgit v1.2.3 From f60c7071feb2daa736dbf0ec6c60d75034f32a41 Mon Sep 17 00:00:00 2001 From: Daniel Harding Date: Thu, 8 Mar 2012 16:44:13 +0000 Subject: Add a .gitignore file Set up to cause git to ignore *.pyc and *.pyo files, as well as the Python 3 __pycache__ directory. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d1a15e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +*.pyo +__pycache__/ -- cgit v1.2.3 From 4c9740b82a06edb56e063c229510a826834f4023 Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Sun, 11 Mar 2012 12:05:09 -0400 Subject: Update history and bump version number --- HISTORY.rst | 8 ++++++++ dotfiles/core.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 78da6ac..cf407a8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,14 @@ History ------- +0.5.3 ++++++ + +* Update remaining references to 'unmanaged' +* Allow ~ in configuration file external targets +* Make source compatible with Python 3 +* Add specific Python version trove classifiers + 0.5.2 +++++ diff --git a/dotfiles/core.py b/dotfiles/core.py index 6615651..26ff48a 100644 --- a/dotfiles/core.py +++ b/dotfiles/core.py @@ -12,7 +12,7 @@ import shutil import fnmatch -__version__ = '0.5.2' +__version__ = '0.5.3' __author__ = 'Jon Bernard' __license__ = 'ISC' -- cgit v1.2.3