summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-11-04 17:07:44 +1300
committerAndreas Schneider <asn@cryptomilk.org>2019-11-13 08:42:30 +0000
commit92ce387ed0e02bc3ebc673bcfd7ffbb55c04f57d (patch)
tree8edc43fb24f980b1665556f111ed638bb8bc957c /buildtools
parentdc5788056bcbccdc320aeaad4f35f726632a91a4 (diff)
downloadsamba-92ce387ed0e02bc3ebc673bcfd7ffbb55c04f57d.tar.gz
build: Remove workaround for missing os.path.relpath in Python < 2.6
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba3.py4
-rw-r--r--buildtools/wafsamba/samba_autoproto.py4
-rw-r--r--buildtools/wafsamba/samba_deps.py8
-rw-r--r--buildtools/wafsamba/samba_dist.py4
-rw-r--r--buildtools/wafsamba/samba_headers.py8
-rw-r--r--buildtools/wafsamba/samba_utils.py22
-rw-r--r--buildtools/wafsamba/samba_wildcard.py4
-rw-r--r--buildtools/wafsamba/symbols.py4
-rw-r--r--buildtools/wafsamba/wafsamba.py2
-rw-r--r--buildtools/wafsamba/wscript3
10 files changed, 22 insertions, 41 deletions
diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index 5aab2509b24..818bfc041c5 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
@@ -3,7 +3,7 @@
import os
from waflib import Build
-from samba_utils import os_path_relpath, TO_LIST
+from samba_utils import TO_LIST
from samba_autoconf import library_flags
def SAMBA3_IS_STATIC_MODULE(bld, module):
@@ -31,7 +31,7 @@ def s3_fix_kwargs(bld, kwargs):
'''fix the build arguments for s3 build rules to include the
necessary includes, subdir and cflags options '''
s3dir = os.path.join(bld.env.srcdir, 'source3')
- s3reldir = os_path_relpath(s3dir, bld.path.abspath())
+ s3reldir = os.path.relpath(s3dir, bld.path.abspath())
# the extra_includes list is relative to the source3 directory
extra_includes = [ '.', 'include', 'lib' ]
diff --git a/buildtools/wafsamba/samba_autoproto.py b/buildtools/wafsamba/samba_autoproto.py
index ace434f3c6b..87fb8ef25c5 100644
--- a/buildtools/wafsamba/samba_autoproto.py
+++ b/buildtools/wafsamba/samba_autoproto.py
@@ -2,12 +2,12 @@
import os
from waflib import Build
-from samba_utils import SET_TARGET_TYPE, os_path_relpath
+from samba_utils import SET_TARGET_TYPE
def SAMBA_AUTOPROTO(bld, header, source):
'''rule for samba prototype generation'''
bld.SET_BUILD_GROUP('prototypes')
- relpath = os_path_relpath(bld.path.abspath(), bld.srcnode.abspath())
+ relpath = os.path.relpath(bld.path.abspath(), bld.srcnode.abspath())
name = os.path.join(relpath, header)
SET_TARGET_TYPE(bld, name, 'PROTOTYPE')
t = bld(
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index f400e1833a2..29bebc349c4 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -8,7 +8,7 @@ from waflib.Configure import conf
from waflib import ConfigSet
from samba_bundled import BUILTIN_LIBRARY
-from samba_utils import LOCAL_CACHE, TO_LIST, get_tgt_list, unique_list, os_path_relpath
+from samba_utils import LOCAL_CACHE, TO_LIST, get_tgt_list, unique_list
from samba_autoconf import library_flags
@conf
@@ -172,7 +172,7 @@ def build_includes(self):
mypath = self.path.abspath(bld.env)
for inc in inc_abs:
- relpath = os_path_relpath(inc, mypath)
+ relpath = os.path.relpath(inc, mypath)
includes.append(relpath)
if getattr(self, 'local_include', True) and not getattr(self, 'local_include_first', True):
@@ -188,7 +188,7 @@ def build_includes(self):
includes_top.append(i)
continue
absinc = os.path.join(self.path.abspath(), i)
- relinc = os_path_relpath(absinc, self.bld.srcnode.abspath())
+ relinc = os.path.relpath(absinc, self.bld.srcnode.abspath())
includes_top.append('#' + relinc)
self.includes = unique_list(includes_top)
@@ -267,7 +267,7 @@ def check_duplicate_sources(bld, tgt_list):
for t in tgt_list:
source_list = TO_LIST(getattr(t, 'source', ''))
- tpath = os.path.normpath(os_path_relpath(t.path.abspath(bld.env), t.env.BUILD_DIRECTORY + '/default'))
+ tpath = os.path.normpath(os.path.relpath(t.path.abspath(bld.env), t.env.BUILD_DIRECTORY + '/default'))
obj_sources = set()
for s in source_list:
if not isinstance(s, str):
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index 6af7bb4eaff..c211a94d3db 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -4,7 +4,7 @@
import os, sys, tarfile
from waflib import Utils, Scripting, Logs, Options
from waflib.Configure import conf
-from samba_utils import os_path_relpath, get_string
+from samba_utils import get_string
from waflib import Context
dist_dirs = None
@@ -111,7 +111,7 @@ def vcs_dir_contents(path):
while repo != "/":
if os.path.isdir(os.path.join(repo, ".git")):
ls_files_cmd = [ 'git', 'ls-files', '--full-name',
- os_path_relpath(path, repo) ]
+ os.path.relpath(path, repo) ]
cwd = None
env = dict(os.environ)
env["GIT_DIR"] = os.path.join(repo, ".git")
diff --git a/buildtools/wafsamba/samba_headers.py b/buildtools/wafsamba/samba_headers.py
index a268c011c5d..3313960f5f8 100644
--- a/buildtools/wafsamba/samba_headers.py
+++ b/buildtools/wafsamba/samba_headers.py
@@ -2,7 +2,7 @@
import os, re, sys, fnmatch
from waflib import Build, Logs, Utils, Errors
-from samba_utils import TO_LIST, os_path_relpath
+from samba_utils import TO_LIST
def header_install_path(header, header_path):
@@ -42,7 +42,7 @@ def create_public_header(task):
if os.path.exists(tgt):
os.unlink(tgt)
- relsrc = os_path_relpath(src, task.env.TOPDIR)
+ relsrc = os.path.relpath(src, task.env.TOPDIR)
infile = open(src, mode='r')
outfile = open(tgt, mode='w')
@@ -149,8 +149,8 @@ def PUBLIC_HEADERS(bld, public_headers, header_path=None, public_headers_install
h_name = h
inst_name = os.path.basename(h)
curdir = bld.path.abspath()
- relpath1 = os_path_relpath(bld.srcnode.abspath(), curdir)
- relpath2 = os_path_relpath(curdir, bld.srcnode.abspath())
+ relpath1 = os.path.relpath(bld.srcnode.abspath(), curdir)
+ relpath2 = os.path.relpath(curdir, bld.srcnode.abspath())
targetdir = os.path.normpath(os.path.join(relpath1, bld.env.build_public_headers, inst_path))
if not os.path.exists(os.path.join(curdir, targetdir)):
raise Errors.WafError("missing source directory %s for public header %s" % (targetdir, inst_name))
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index ad97de1859b..4a5a34abae7 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -205,24 +205,6 @@ def process_depends_on(self):
self.includes += " " + y.more_includes
-os_path_relpath = getattr(os.path, 'relpath', None)
-if os_path_relpath is None:
- # Python < 2.6 does not have os.path.relpath, provide a replacement
- # (imported from Python2.6.5~rc2)
- def os_path_relpath(path, start):
- """Return a relative version of a path"""
- start_list = os.path.abspath(start).split("/")
- path_list = os.path.abspath(path).split("/")
-
- # Work out how much of the filepath is shared by start and path.
- i = len(os.path.commonprefix([start_list, path_list]))
-
- rel_list = ['..'] * (len(start_list)-i) + path_list[i:]
- if not rel_list:
- return start
- return os.path.join(*rel_list)
-
-
def unique_list(seq):
'''return a uniquified list in the same order as the existing list'''
seen = {}
@@ -286,7 +268,7 @@ def recursive_dirlist(dir, relbase, pattern=None):
else:
if pattern and not fnmatch.fnmatch(f, pattern):
continue
- ret.append(os_path_relpath(f2, relbase))
+ ret.append(os.path.relpath(f2, relbase))
return ret
@@ -476,7 +458,7 @@ def RECURSE(ctx, directory):
# already done it
return
visited_dirs.add(key)
- relpath = os_path_relpath(abspath, ctx.path.abspath())
+ relpath = os.path.relpath(abspath, ctx.path.abspath())
if ctxclass in ['tmp', 'OptionsContext', 'ConfigurationContext', 'BuildContext']:
return ctx.recurse(relpath)
if 'waflib.extras.compat15' in sys.modules:
diff --git a/buildtools/wafsamba/samba_wildcard.py b/buildtools/wafsamba/samba_wildcard.py
index 6173ce8a9f9..5d85ec0f2ac 100644
--- a/buildtools/wafsamba/samba_wildcard.py
+++ b/buildtools/wafsamba/samba_wildcard.py
@@ -3,7 +3,7 @@
import os, datetime, fnmatch
from waflib import Scripting, Utils, Options, Logs, Errors
from waflib import ConfigSet, Context
-from samba_utils import LOCAL_CACHE, os_path_relpath
+from samba_utils import LOCAL_CACHE
def run_task(t, k):
'''run a single build task'''
@@ -24,7 +24,7 @@ def run_named_build_task(cmd):
# cope with builds of bin/*/*
if os.path.islink(cmd):
- cmd = os_path_relpath(os.readlink(cmd), os.getcwd())
+ cmd = os.path.relpath(os.readlink(cmd), os.getcwd())
if cmd[0:12] == "bin/default/":
cmd = cmd[12:]
diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
index 3eca3d46bd7..d3bf9ac1c6b 100644
--- a/buildtools/wafsamba/symbols.py
+++ b/buildtools/wafsamba/symbols.py
@@ -4,7 +4,7 @@
import os, re, subprocess
from waflib import Utils, Build, Options, Logs, Errors
from waflib.Logs import debug
-from samba_utils import TO_LIST, LOCAL_CACHE, get_tgt_list, os_path_relpath
+from samba_utils import TO_LIST, LOCAL_CACHE, get_tgt_list
# these are the data structures used in symbols.py:
#
@@ -617,7 +617,7 @@ def symbols_dupcheck(task, fail_on_error=False):
build_library_dict(bld, tgt_list)
for t in tgt_list:
if t.samba_type == 'BINARY':
- binname = os_path_relpath(t.link_task.outputs[0].abspath(bld.env), os.getcwd())
+ binname = os.path.relpath(t.link_task.outputs[0].abspath(bld.env), os.getcwd())
symbols_dupcheck_binary(bld, binname, fail_on_error)
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 205d5b4ac32..48e56493489 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -858,7 +858,7 @@ def INSTALL_WILDCARD(bld, destdir, pattern, chmod=MODE_644, flat=False,
if trim_path:
files2 = []
for f in files:
- files2.append(os_path_relpath(f, trim_path))
+ files2.append(os.path.relpath(f, trim_path))
files = files2
if exclude:
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 8d0a89a0ee3..b601dd2596d 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -5,7 +5,6 @@
import os, sys
from waflib import Configure, Logs, Options, Utils, Context, Errors
import wafsamba
-from samba_utils import os_path_relpath
from samba_utils import symlink
from optparse import SUPPRESS_HELP
@@ -612,7 +611,7 @@ def build(bld):
# give a more useful message if the source directory has moved
curdir = bld.path.abspath()
srcdir = bld.srcnode.abspath()
- relpath = os_path_relpath(curdir, srcdir)
+ relpath = os.path.relpath(curdir, srcdir)
if relpath.find('../') != -1:
Logs.error('bld.path %s is not a child of %s' % (curdir, srcdir))
raise Errors.WafError('''The top source directory has moved. Please run distclean and reconfigure''')