mirror of https://gitlab.com/ita1024/waf.git
Enable relative paths to be processed in the --top and --out options
This commit is contained in:
parent
731dfba711
commit
78403e3fbc
|
@ -208,17 +208,17 @@ class ConfigurationContext(Context.Context):
|
|||
"""
|
||||
if not env.PREFIX:
|
||||
if Options.options.prefix or Utils.is_win32:
|
||||
env.PREFIX = os.path.abspath(os.path.expanduser(Options.options.prefix))
|
||||
env.PREFIX = Utils.sane_path(Options.options.prefix)
|
||||
else:
|
||||
env.PREFIX = ''
|
||||
if not env.BINDIR:
|
||||
if Options.options.bindir:
|
||||
env.BINDIR = os.path.abspath(os.path.expanduser(Options.options.bindir))
|
||||
env.BINDIR = Utils.sane_path(Options.options.bindir)
|
||||
else:
|
||||
env.BINDIR = Utils.subst_vars('${PREFIX}/bin', env)
|
||||
if not env.LIBDIR:
|
||||
if Options.options.libdir:
|
||||
env.LIBDIR = os.path.abspath(os.path.expanduser(Options.options.libdir))
|
||||
env.LIBDIR = Utils.sane_path(Options.options.libdir)
|
||||
else:
|
||||
env.LIBDIR = Utils.subst_vars('${PREFIX}/lib%s' % Utils.lib64(), env)
|
||||
|
||||
|
@ -529,7 +529,6 @@ def find_binary(self, filenames, exts, paths):
|
|||
return x
|
||||
return None
|
||||
|
||||
|
||||
@conf
|
||||
def run_build(self, *k, **kw):
|
||||
"""
|
||||
|
|
|
@ -256,7 +256,7 @@ class OptionsContext(Context.Context):
|
|||
commands.append(arg)
|
||||
|
||||
if options.destdir:
|
||||
options.destdir = os.path.abspath(os.path.expanduser(options.destdir))
|
||||
options.destdir = Utils.sane_path(options.destdir)
|
||||
|
||||
if options.verbose >= 1:
|
||||
self.load('errcheck')
|
||||
|
|
|
@ -46,6 +46,7 @@ def waf_entry_point(current_directory, version, wafdir):
|
|||
# perhaps extract 'wscript' as a constant
|
||||
if os.path.basename(potential_wscript) == 'wscript' and os.path.isfile(potential_wscript):
|
||||
# need to explicitly normalize the path, as it may contain extra '/.'
|
||||
# TODO abspath?
|
||||
current_directory = os.path.normpath(os.path.dirname(potential_wscript))
|
||||
sys.argv.pop(1)
|
||||
|
||||
|
@ -62,11 +63,14 @@ def waf_entry_point(current_directory, version, wafdir):
|
|||
break
|
||||
|
||||
# if --top is provided assume the build started in the top directory
|
||||
for x in sys.argv:
|
||||
for i, x in enumerate(sys.argv):
|
||||
# WARNING: this modifies sys.argv
|
||||
if x.startswith('--top='):
|
||||
Context.run_dir = Context.top_dir = x[6:]
|
||||
Context.run_dir = Context.top_dir = Utils.sane_path(x[6:])
|
||||
sys.argv[i] = '--top=' + Context.run_dir
|
||||
if x.startswith('--out='):
|
||||
Context.out_dir = x[6:]
|
||||
Context.out_dir = Utils.sane_path(x[6:])
|
||||
sys.argv[i] = '--out=' + Context.out_dir
|
||||
|
||||
# try to find a lock file (if the project was configured)
|
||||
# at the same time, store the first wscript file seen
|
||||
|
|
|
@ -753,3 +753,7 @@ def lib64():
|
|||
return '64'
|
||||
return ''
|
||||
|
||||
def sane_path(p):
|
||||
# private function for the time being!
|
||||
return os.path.abspath(os.path.expanduser(p))
|
||||
|
||||
|
|
Loading…
Reference in New Issue