The Meson Build System
http://mesonbuild.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
461 lines
18 KiB
461 lines
18 KiB
10 years ago
|
# Copyright 2013-2014 The Meson development team
|
||
12 years ago
|
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
|
||
7 years ago
|
import sys, pickle, os, shutil, subprocess, gzip, errno
|
||
7 years ago
|
import shlex
|
||
7 years ago
|
import argparse
|
||
11 years ago
|
from glob import glob
|
||
7 years ago
|
from .scripts import depfixer
|
||
|
from .scripts import destdir_join
|
||
|
from .mesonlib import is_windows, Popen_safe
|
||
|
from .mtest import rebuild_all
|
||
7 years ago
|
from __main__ import __file__ as main_file
|
||
12 years ago
|
|
||
8 years ago
|
install_log_file = None
|
||
7 years ago
|
selinux_updates = []
|
||
8 years ago
|
|
||
7 years ago
|
def buildparser():
|
||
|
parser = argparse.ArgumentParser(prog='meson install')
|
||
|
parser.add_argument('-C', default='.', dest='wd',
|
||
|
help='directory to cd into before running')
|
||
|
parser.add_argument('--no-rebuild', default=False, action='store_true',
|
||
|
help='Do not rebuild before installing.')
|
||
|
return parser
|
||
|
|
||
7 years ago
|
class DirMaker:
|
||
|
def __init__(self):
|
||
|
self.dirs = []
|
||
|
|
||
|
def makedirs(self, path, exist_ok=False):
|
||
|
dirname = os.path.normpath(path)
|
||
|
dirs = []
|
||
|
while dirname != os.path.dirname(dirname):
|
||
|
if not os.path.exists(dirname):
|
||
|
dirs.append(dirname)
|
||
|
dirname = os.path.dirname(dirname)
|
||
|
os.makedirs(path, exist_ok=exist_ok)
|
||
|
|
||
|
# store the directories in creation order, with the parent directory
|
||
|
# before the child directories. Future calls of makedir() will not
|
||
|
# create the parent directories, so the last element in the list is
|
||
|
# the last one to be created. That is the first one to be removed on
|
||
|
# __exit__
|
||
|
dirs.reverse()
|
||
|
self.dirs += dirs
|
||
|
|
||
|
def __enter__(self):
|
||
|
return self
|
||
|
|
||
|
def __exit__(self, type, value, traceback):
|
||
|
self.dirs.reverse()
|
||
|
for d in self.dirs:
|
||
|
append_to_log(d)
|
||
|
|
||
7 years ago
|
def is_executable(path):
|
||
|
'''Checks whether any of the "x" bits are set in the source file mode.'''
|
||
|
return bool(os.stat(path).st_mode & 0o111)
|
||
|
|
||
|
def sanitize_permissions(path, umask):
|
||
|
if umask is None:
|
||
8 years ago
|
return
|
||
7 years ago
|
new_perms = 0o777 if is_executable(path) else 0o666
|
||
|
new_perms &= ~umask
|
||
|
try:
|
||
|
os.chmod(path, new_perms)
|
||
|
except PermissionError as e:
|
||
|
msg = '{!r}: Unable to set permissions {!r}: {}, ignoring...'
|
||
|
print(msg.format(path, new_perms, e.strerror))
|
||
|
|
||
|
def set_mode(path, mode, default_umask):
|
||
|
if mode is None or (mode.perms_s or mode.owner or mode.group) is None:
|
||
|
# Just sanitize permissions with the default umask
|
||
|
sanitize_permissions(path, default_umask)
|
||
8 years ago
|
return
|
||
|
# No chown() on Windows, and must set one of owner/group
|
||
|
if not is_windows() and (mode.owner or mode.group) is not None:
|
||
|
try:
|
||
|
shutil.chown(path, mode.owner, mode.group)
|
||
|
except PermissionError as e:
|
||
|
msg = '{!r}: Unable to set owner {!r} and group {!r}: {}, ignoring...'
|
||
|
print(msg.format(path, mode.owner, mode.group, e.strerror))
|
||
8 years ago
|
except LookupError:
|
||
8 years ago
|
msg = '{!r}: Non-existent owner {!r} or group {!r}: ignoring...'
|
||
|
print(msg.format(path, mode.owner, mode.group))
|
||
|
except OSError as e:
|
||
|
if e.errno == errno.EINVAL:
|
||
|
msg = '{!r}: Non-existent numeric owner {!r} or group {!r}: ignoring...'
|
||
|
print(msg.format(path, mode.owner, mode.group))
|
||
|
else:
|
||
|
raise
|
||
8 years ago
|
# Must set permissions *after* setting owner/group otherwise the
|
||
|
# setuid/setgid bits will get wiped by chmod
|
||
|
# NOTE: On Windows you can set read/write perms; the rest are ignored
|
||
|
if mode.perms_s is not None:
|
||
|
try:
|
||
|
os.chmod(path, mode.perms)
|
||
|
except PermissionError as e:
|
||
|
msg = '{!r}: Unable to set permissions {!r}: {}, ignoring...'
|
||
|
print(msg.format(path, mode.perms_s, e.strerror))
|
||
7 years ago
|
else:
|
||
|
sanitize_permissions(path, default_umask)
|
||
8 years ago
|
|
||
7 years ago
|
def restore_selinux_contexts():
|
||
7 years ago
|
'''
|
||
7 years ago
|
Restores the SELinux context for files in @selinux_updates
|
||
7 years ago
|
|
||
|
If $DESTDIR is set, do not warn if the call fails.
|
||
7 years ago
|
'''
|
||
|
try:
|
||
|
subprocess.check_call(['selinuxenabled'])
|
||
7 years ago
|
except (FileNotFoundError, PermissionError, subprocess.CalledProcessError) as e:
|
||
7 years ago
|
# If we don't have selinux or selinuxenabled returned 1, failure
|
||
|
# is ignored quietly.
|
||
7 years ago
|
return
|
||
|
|
||
7 years ago
|
if not shutil.which('restorecon'):
|
||
|
# If we don't have restorecon, failure is ignored quietly.
|
||
|
return
|
||
|
|
||
7 years ago
|
with subprocess.Popen(['restorecon', '-F', '-f-', '-0'],
|
||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc:
|
||
|
out, err = proc.communicate(input=b'\0'.join(os.fsencode(f) for f in selinux_updates) + b'\0')
|
||
7 years ago
|
if proc.returncode != 0 and not os.environ.get('DESTDIR'):
|
||
7 years ago
|
print('Failed to restore SELinux context of installed files...',
|
||
|
'Standard output:', out.decode(),
|
||
|
'Standard error:', err.decode(), sep='\n')
|
||
7 years ago
|
|
||
8 years ago
|
def append_to_log(line):
|
||
|
install_log_file.write(line)
|
||
|
if not line.endswith('\n'):
|
||
|
install_log_file.write('\n')
|
||
|
install_log_file.flush()
|
||
|
|
||
8 years ago
|
def do_copyfile(from_file, to_file):
|
||
|
if not os.path.isfile(from_file):
|
||
|
raise RuntimeError('Tried to install something that isn\'t a file:'
|
||
|
'{!r}'.format(from_file))
|
||
|
# copyfile fails if the target file already exists, so remove it to
|
||
|
# allow overwriting a previous install. If the target is not a file, we
|
||
|
# want to give a readable error.
|
||
|
if os.path.exists(to_file):
|
||
|
if not os.path.isfile(to_file):
|
||
|
raise RuntimeError('Destination {!r} already exists and is not '
|
||
|
'a file'.format(to_file))
|
||
9 years ago
|
os.unlink(to_file)
|
||
|
shutil.copyfile(from_file, to_file)
|
||
|
shutil.copystat(from_file, to_file)
|
||
7 years ago
|
selinux_updates.append(to_file)
|
||
8 years ago
|
append_to_log(to_file)
|
||
9 years ago
|
|
||
7 years ago
|
def do_copydir(data, src_dir, dst_dir, exclude, install_mode):
|
||
8 years ago
|
'''
|
||
7 years ago
|
Copies the contents of directory @src_dir into @dst_dir.
|
||
8 years ago
|
|
||
7 years ago
|
For directory
|
||
|
/foo/
|
||
|
bar/
|
||
|
excluded
|
||
|
foobar
|
||
|
file
|
||
7 years ago
|
do_copydir(..., '/foo', '/dst/dir', {'bar/excluded'}, None) creates
|
||
7 years ago
|
/dst/
|
||
|
dir/
|
||
|
bar/
|
||
|
foobar
|
||
|
file
|
||
|
|
||
|
Args:
|
||
|
src_dir: str, absolute path to the source directory
|
||
|
dst_dir: str, absolute path to the destination directory
|
||
|
exclude: (set(str), set(str)), tuple of (exclude_files, exclude_dirs),
|
||
|
each element of the set is a path relative to src_dir.
|
||
7 years ago
|
install_mode: FileMode object, or None to use defaults.
|
||
8 years ago
|
'''
|
||
7 years ago
|
if not os.path.isabs(src_dir):
|
||
|
raise ValueError('src_dir must be absolute, got %s' % src_dir)
|
||
|
if not os.path.isabs(dst_dir):
|
||
|
raise ValueError('dst_dir must be absolute, got %s' % dst_dir)
|
||
8 years ago
|
if exclude is not None:
|
||
|
exclude_files, exclude_dirs = exclude
|
||
|
else:
|
||
|
exclude_files = exclude_dirs = set()
|
||
7 years ago
|
for root, dirs, files in os.walk(src_dir):
|
||
|
assert os.path.isabs(root)
|
||
8 years ago
|
for d in dirs[:]:
|
||
7 years ago
|
abs_src = os.path.join(root, d)
|
||
|
filepart = os.path.relpath(abs_src, start=src_dir)
|
||
8 years ago
|
abs_dst = os.path.join(dst_dir, filepart)
|
||
8 years ago
|
# Remove these so they aren't visited by os.walk at all.
|
||
|
if filepart in exclude_dirs:
|
||
|
dirs.remove(d)
|
||
|
continue
|
||
8 years ago
|
if os.path.isdir(abs_dst):
|
||
|
continue
|
||
|
if os.path.exists(abs_dst):
|
||
|
print('Tried to copy directory %s but a file of that name already exists.' % abs_dst)
|
||
|
sys.exit(1)
|
||
7 years ago
|
data.dirmaker.makedirs(abs_dst)
|
||
8 years ago
|
shutil.copystat(abs_src, abs_dst)
|
||
7 years ago
|
sanitize_permissions(abs_dst, data.install_umask)
|
||
8 years ago
|
for f in files:
|
||
7 years ago
|
abs_src = os.path.join(root, f)
|
||
|
filepart = os.path.relpath(abs_src, start=src_dir)
|
||
8 years ago
|
if filepart in exclude_files:
|
||
|
continue
|
||
8 years ago
|
abs_dst = os.path.join(dst_dir, filepart)
|
||
|
if os.path.isdir(abs_dst):
|
||
|
print('Tried to copy file %s but a directory of that name already exists.' % abs_dst)
|
||
|
if os.path.exists(abs_dst):
|
||
|
os.unlink(abs_dst)
|
||
7 years ago
|
parent_dir = os.path.dirname(abs_dst)
|
||
8 years ago
|
if not os.path.isdir(parent_dir):
|
||
|
os.mkdir(parent_dir)
|
||
7 years ago
|
shutil.copystat(os.path.dirname(abs_src), parent_dir)
|
||
8 years ago
|
shutil.copy2(abs_src, abs_dst, follow_symlinks=False)
|
||
7 years ago
|
set_mode(abs_dst, install_mode, data.install_umask)
|
||
8 years ago
|
append_to_log(abs_dst)
|
||
|
|
||
8 years ago
|
def get_destdir_path(d, path):
|
||
|
if os.path.isabs(path):
|
||
|
output = destdir_join(d.destdir, path)
|
||
|
else:
|
||
|
output = os.path.join(d.fullprefix, path)
|
||
|
return output
|
||
|
|
||
7 years ago
|
def do_install(log_dir, datafilename):
|
||
|
global install_log_file
|
||
|
|
||
8 years ago
|
with open(datafilename, 'rb') as ifile:
|
||
|
d = pickle.load(ifile)
|
||
9 years ago
|
d.destdir = os.environ.get('DESTDIR', '')
|
||
9 years ago
|
d.fullprefix = destdir_join(d.destdir, d.prefix)
|
||
10 years ago
|
|
||
7 years ago
|
if d.install_umask is not None:
|
||
|
os.umask(d.install_umask)
|
||
7 years ago
|
|
||
|
with open(os.path.join(log_dir, 'install-log.txt'), 'w') as lf:
|
||
|
install_log_file = lf
|
||
|
append_to_log('# List of files installed by Meson')
|
||
|
append_to_log('# Does not contain files installed by custom scripts.')
|
||
|
|
||
7 years ago
|
try:
|
||
|
d.dirmaker = DirMaker()
|
||
|
with d.dirmaker:
|
||
|
install_subdirs(d) # Must be first, because it needs to delete the old subtree.
|
||
|
install_targets(d)
|
||
|
install_headers(d)
|
||
|
install_man(d)
|
||
|
install_data(d)
|
||
|
restore_selinux_contexts()
|
||
|
run_install_script(d)
|
||
|
except PermissionError:
|
||
|
if shutil.which('pkexec') is not None and 'PKEXEC_UID' not in os.environ:
|
||
7 years ago
|
print('Installation failed due to insufficient permissions.')
|
||
|
print('Attempting to use polkit to gain elevated privileges...')
|
||
7 years ago
|
os.execlp('pkexec', 'pkexec', sys.executable, main_file, *sys.argv[1:],
|
||
|
os.getcwd())
|
||
|
else:
|
||
|
raise
|
||
|
|
||
11 years ago
|
|
||
7 years ago
|
def install_subdirs(d):
|
||
7 years ago
|
for (src_dir, dst_dir, mode, exclude) in d.install_subdirs:
|
||
7 years ago
|
full_dst_dir = get_destdir_path(d, dst_dir)
|
||
|
print('Installing subdir %s to %s' % (src_dir, full_dst_dir))
|
||
|
d.dirmaker.makedirs(full_dst_dir, exist_ok=True)
|
||
7 years ago
|
do_copydir(d, src_dir, full_dst_dir, exclude, mode)
|
||
10 years ago
|
|
||
12 years ago
|
def install_data(d):
|
||
|
for i in d.data:
|
||
|
fullfilename = i[0]
|
||
8 years ago
|
outfilename = get_destdir_path(d, i[1])
|
||
8 years ago
|
mode = i[2]
|
||
7 years ago
|
outdir = os.path.dirname(outfilename)
|
||
7 years ago
|
d.dirmaker.makedirs(outdir, exist_ok=True)
|
||
8 years ago
|
print('Installing %s to %s' % (fullfilename, outdir))
|
||
8 years ago
|
do_copyfile(fullfilename, outfilename)
|
||
7 years ago
|
set_mode(outfilename, mode, d.install_umask)
|
||
12 years ago
|
|
||
|
def install_man(d):
|
||
|
for m in d.man:
|
||
12 years ago
|
full_source_filename = m[0]
|
||
8 years ago
|
outfilename = get_destdir_path(d, m[1])
|
||
7 years ago
|
outdir = os.path.dirname(outfilename)
|
||
7 years ago
|
d.dirmaker.makedirs(outdir, exist_ok=True)
|
||
7 years ago
|
install_mode = m[2]
|
||
8 years ago
|
print('Installing %s to %s' % (full_source_filename, outdir))
|
||
12 years ago
|
if outfilename.endswith('.gz') and not full_source_filename.endswith('.gz'):
|
||
8 years ago
|
with open(outfilename, 'wb') as of:
|
||
|
with open(full_source_filename, 'rb') as sf:
|
||
7 years ago
|
# Set mtime and filename for reproducibility.
|
||
|
with gzip.GzipFile(fileobj=of, mode='wb', filename='', mtime=0) as gz:
|
||
|
gz.write(sf.read())
|
||
9 years ago
|
shutil.copystat(full_source_filename, outfilename)
|
||
8 years ago
|
append_to_log(outfilename)
|
||
12 years ago
|
else:
|
||
8 years ago
|
do_copyfile(full_source_filename, outfilename)
|
||
7 years ago
|
set_mode(outfilename, install_mode, d.install_umask)
|
||
12 years ago
|
|
||
|
def install_headers(d):
|
||
|
for t in d.headers:
|
||
|
fullfilename = t[0]
|
||
7 years ago
|
fname = os.path.basename(fullfilename)
|
||
8 years ago
|
outdir = get_destdir_path(d, t[1])
|
||
12 years ago
|
outfilename = os.path.join(outdir, fname)
|
||
7 years ago
|
install_mode = t[2]
|
||
12 years ago
|
print('Installing %s to %s' % (fname, outdir))
|
||
7 years ago
|
d.dirmaker.makedirs(outdir, exist_ok=True)
|
||
8 years ago
|
do_copyfile(fullfilename, outfilename)
|
||
7 years ago
|
set_mode(outfilename, install_mode, d.install_umask)
|
||
12 years ago
|
|
||
10 years ago
|
def run_install_script(d):
|
||
8 years ago
|
env = {'MESON_SOURCE_ROOT': d.source_dir,
|
||
|
'MESON_BUILD_ROOT': d.build_dir,
|
||
|
'MESON_INSTALL_PREFIX': d.prefix,
|
||
|
'MESON_INSTALL_DESTDIR_PREFIX': d.fullprefix,
|
||
7 years ago
|
'MESONINTROSPECT': ' '.join([shlex.quote(x) for x in d.mesonintrospect]),
|
||
|
}
|
||
7 years ago
|
|
||
10 years ago
|
child_env = os.environ.copy()
|
||
|
child_env.update(env)
|
||
9 years ago
|
|
||
|
for i in d.install_scripts:
|
||
8 years ago
|
script = i['exe']
|
||
|
args = i['args']
|
||
|
name = ' '.join(script + args)
|
||
|
print('Running custom install script {!r}'.format(name))
|
||
9 years ago
|
try:
|
||
8 years ago
|
rc = subprocess.call(script + args, env=child_env)
|
||
9 years ago
|
if rc != 0:
|
||
|
sys.exit(rc)
|
||
7 years ago
|
except OSError:
|
||
8 years ago
|
print('Failed to run install script {!r}'.format(name))
|
||
9 years ago
|
sys.exit(1)
|
||
10 years ago
|
|
||
11 years ago
|
def check_for_stampfile(fname):
|
||
|
'''Some languages e.g. Rust have output files
|
||
|
whose names are not known at configure time.
|
||
|
Check if this is the case and return the real
|
||
|
file instead.'''
|
||
|
if fname.endswith('.so') or fname.endswith('.dll'):
|
||
|
if os.stat(fname).st_size == 0:
|
||
|
(base, suffix) = os.path.splitext(fname)
|
||
|
files = glob(base + '-*' + suffix)
|
||
|
if len(files) > 1:
|
||
11 years ago
|
print("Stale dynamic library files in build dir. Can't install.")
|
||
11 years ago
|
sys.exit(1)
|
||
|
if len(files) == 1:
|
||
|
return files[0]
|
||
11 years ago
|
elif fname.endswith('.a') or fname.endswith('.lib'):
|
||
|
if os.stat(fname).st_size == 0:
|
||
|
(base, suffix) = os.path.splitext(fname)
|
||
|
files = glob(base + '-*' + '.rlib')
|
||
|
if len(files) > 1:
|
||
|
print("Stale static library files in build dir. Can't install.")
|
||
|
sys.exit(1)
|
||
|
if len(files) == 1:
|
||
|
return files[0]
|
||
11 years ago
|
return fname
|
||
|
|
||
12 years ago
|
def install_targets(d):
|
||
12 years ago
|
for t in d.targets:
|
||
7 years ago
|
fname = check_for_stampfile(t.fname)
|
||
|
outdir = get_destdir_path(d, t.outdir)
|
||
7 years ago
|
outname = os.path.join(outdir, os.path.basename(fname))
|
||
7 years ago
|
final_path = os.path.join(d.prefix, t.outdir, os.path.basename(fname))
|
||
7 years ago
|
aliases = t.aliases
|
||
|
should_strip = t.strip
|
||
|
install_name_mappings = t.install_name_mappings
|
||
|
install_rpath = t.install_rpath
|
||
|
install_mode = t.install_mode
|
||
12 years ago
|
print('Installing %s to %s' % (fname, outname))
|
||
7 years ago
|
d.dirmaker.makedirs(outdir, exist_ok=True)
|
||
8 years ago
|
if not os.path.exists(fname):
|
||
|
raise RuntimeError('File {!r} could not be found'.format(fname))
|
||
|
elif os.path.isfile(fname):
|
||
|
do_copyfile(fname, outname)
|
||
7 years ago
|
set_mode(outname, install_mode, d.install_umask)
|
||
8 years ago
|
if should_strip and d.strip_bin is not None:
|
||
8 years ago
|
if fname.endswith('.jar'):
|
||
7 years ago
|
print('Not stripping jar target:', os.path.basename(fname))
|
||
8 years ago
|
continue
|
||
8 years ago
|
print('Stripping target {!r}'.format(fname))
|
||
8 years ago
|
ps, stdo, stde = Popen_safe(d.strip_bin + [outname])
|
||
8 years ago
|
if ps.returncode != 0:
|
||
|
print('Could not strip file.\n')
|
||
|
print('Stdout:\n%s\n' % stdo)
|
||
|
print('Stderr:\n%s\n' % stde)
|
||
|
sys.exit(1)
|
||
8 years ago
|
pdb_filename = os.path.splitext(fname)[0] + '.pdb'
|
||
|
if not should_strip and os.path.exists(pdb_filename):
|
||
|
pdb_outname = os.path.splitext(outname)[0] + '.pdb'
|
||
8 years ago
|
print('Installing pdb file %s to %s' % (pdb_filename, pdb_outname))
|
||
8 years ago
|
do_copyfile(pdb_filename, pdb_outname)
|
||
7 years ago
|
set_mode(pdb_outname, install_mode, d.install_umask)
|
||
8 years ago
|
elif os.path.isdir(fname):
|
||
|
fname = os.path.join(d.build_dir, fname.rstrip('/'))
|
||
7 years ago
|
outname = os.path.join(outdir, os.path.basename(fname))
|
||
7 years ago
|
do_copydir(d, fname, outname, None, install_mode)
|
||
8 years ago
|
else:
|
||
|
raise RuntimeError('Unknown file type for {!r}'.format(fname))
|
||
12 years ago
|
printed_symlink_error = False
|
||
8 years ago
|
for alias, to in aliases.items():
|
||
12 years ago
|
try:
|
||
10 years ago
|
symlinkfilename = os.path.join(outdir, alias)
|
||
|
try:
|
||
|
os.unlink(symlinkfilename)
|
||
|
except FileNotFoundError:
|
||
|
pass
|
||
8 years ago
|
os.symlink(to, symlinkfilename)
|
||
8 years ago
|
append_to_log(symlinkfilename)
|
||
9 years ago
|
except (NotImplementedError, OSError):
|
||
12 years ago
|
if not printed_symlink_error:
|
||
8 years ago
|
print("Symlink creation does not work on this platform. "
|
||
|
"Skipping all symlinking.")
|
||
12 years ago
|
printed_symlink_error = True
|
||
7 years ago
|
if os.path.isfile(outname):
|
||
9 years ago
|
try:
|
||
7 years ago
|
depfixer.fix_rpath(outname, install_rpath, final_path,
|
||
7 years ago
|
install_name_mappings, verbose=False)
|
||
9 years ago
|
except SystemExit as e:
|
||
|
if isinstance(e.code, int) and e.code == 0:
|
||
|
pass
|
||
|
else:
|
||
|
raise
|
||
12 years ago
|
|
||
9 years ago
|
def run(args):
|
||
7 years ago
|
global install_log_file
|
||
|
parser = buildparser()
|
||
|
opts = parser.parse_args(args)
|
||
|
datafilename = 'meson-private/install.dat'
|
||
7 years ago
|
private_dir = os.path.dirname(datafilename)
|
||
8 years ago
|
log_dir = os.path.join(private_dir, '../meson-logs')
|
||
7 years ago
|
if not os.path.exists(os.path.join(opts.wd, datafilename)):
|
||
|
sys.exit('Install data not found. Run this command in build directory root.')
|
||
|
log_dir = os.path.join(private_dir, '../meson-logs')
|
||
|
if not opts.no_rebuild:
|
||
|
if not rebuild_all(opts.wd):
|
||
|
sys.exit(-1)
|
||
|
os.chdir(opts.wd)
|
||
|
with open(os.path.join(log_dir, 'install-log.txt'), 'w') as lf:
|
||
|
install_log_file = lf
|
||
|
append_to_log('# List of files installed by Meson')
|
||
|
append_to_log('# Does not contain files installed by custom scripts.')
|
||
|
do_install(log_dir, datafilename)
|
||
8 years ago
|
install_log_file = None
|
||
9 years ago
|
return 0
|
||
12 years ago
|
|
||
9 years ago
|
if __name__ == '__main__':
|
||
|
sys.exit(run(sys.argv[1:]))
|