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):
'''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' ]
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(
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
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):
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)
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):
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
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")
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):
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')
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))
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 = {}
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
# 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:
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'''
# 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:]
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:
#
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)
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:
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
# 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''')
continue
mode = os.lstat(fl).st_mode & MODE_777
if arg['trim_path']:
- fl = samba_utils.os_path_relpath(fl, arg['trim_path'])
+ fl = samba_utils.os.path.relpath(fl, arg['trim_path'])
arg['file_list'].append([fl, mode])
def SUBDIR_MODE(path, trim_path=None):
import optparse
import textwrap
from waflib import Logs, Errors, Options, Build, Context
-from samba_utils import EXPAND_VARIABLES, os_path_relpath
+from samba_utils import EXPAND_VARIABLES
class SambaIndentedHelpFormatter (optparse.IndentedHelpFormatter):
"""Format help with indented section bodies.
bld.SAMBA_SUBSYSTEM('DYNCONFIG',
'dynconfig.c',
deps='replace',
- public_headers=os_path_relpath(os.path.join(Context.launch_dir, version_header), bld.path.abspath()),
+ public_headers=os.path.relpath(os.path.join(Context.launch_dir, version_header), bld.path.abspath()),
header_path='samba',
cflags=cflags)
import os
-from samba_utils import os_path_relpath
def build_test_headers(task):
'''symlink a header in the build tree'''
f.write('#include "%s"\n' % os.path.normpath(h))
f.close()
-relpath1 = os_path_relpath(bld.srcnode.abspath(), bld.path.abspath())
+relpath1 = os.path.relpath(bld.srcnode.abspath(), bld.path.abspath())
public_headers = []
for h in bld.env.public_headers_list:
public_headers.append(os.path.join(relpath1, bld.env.build_public_headers, h))