aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2014-08-22 20:11:14 +0200
committerLaurent Bachelier <laurent@bachelier.name>2014-08-22 20:11:14 +0200
commit399ebabce847f393422fc194552e91936f220214 (patch)
tree106e1d28ea0f94b3c62fd4593003af902004ce96
parentSupport overwriting file target when symlink has same contents (diff)
downloadconfman-399ebabce847f393422fc194552e91936f220214.tar.xz
Remove Python 2.5 support
Even if the goal is to support hostile environments, it's becoming hard to find systems still having it.
-rw-r--r--confman.py25
-rwxr-xr-xsetup.py3
2 files changed, 4 insertions, 24 deletions
diff --git a/confman.py b/confman.py
index 8eebdd4..bb4c34e 100644
--- a/confman.py
+++ b/confman.py
@@ -5,27 +5,6 @@ import os.path as osp
import re
from string import Template
-# Python <2.6 compatibility
-try:
- from os.path import relpath as osp_relpath
-except ImportError:
- def osp_relpath(path, start=osp.curdir): # NOQA
- """Return a relative version of a path"""
-
- if not path:
- raise ValueError("no path specified")
-
- start_list = osp.abspath(start).split(osp.sep)
- path_list = osp.abspath(path).split(osp.sep)
-
- # Work out how much of the filepath is shared by start and path.
- i = len(osp.commonprefix([start_list, path_list]))
-
- rel_list = [osp.pardir] * (len(start_list) - i) + path_list[i:]
- if not rel_list:
- return osp.curdir
- return osp.join(*rel_list)
-
class ConfmanException(Exception):
pass
@@ -132,7 +111,7 @@ class SymlinkAction(Action):
else:
self._makedirs()
- relsource = osp.normpath(osp_relpath(source,
+ relsource = osp.normpath(osp.relpath(source,
osp.join(self.config.dest, self.relpath)))
os.symlink(relsource, dest)
print "Created new link: %s => %s" % (dest, source)
@@ -375,7 +354,7 @@ class ConfigSource(object):
"""
self.tree = {}
for path, dirs, files in os.walk(self.source, topdown=True):
- relpath = osp_relpath(path, self.source)
+ relpath = osp.relpath(path, self.source)
to_remove = []
for filename in dirs:
diff --git a/setup.py b/setup.py
index 309e7d2..65f2d57 100755
--- a/setup.py
+++ b/setup.py
@@ -14,6 +14,7 @@ setup(
py_modules=['confman'],
classifiers=[
'License :: OSI Approved :: MIT License',
- 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
],
)