Rename install_subdir() option elide_directory to strip_directory

pull/3010/head
Aleksey Filippov 7 years ago
parent 8ca3cc0c3d
commit 549f9a41e5
  1. 8
      docs/markdown/Reference-manual.md
  2. 4
      docs/markdown/snippets/install_subdir-elide_directory.md
  3. 4
      docs/markdown/snippets/install_subdir-strip_directory.md
  4. 2
      mesonbuild/backend/ninjabackend.py
  5. 18
      mesonbuild/interpreter.py
  6. 6
      test cases/common/66 install subdir/meson.build
  7. 2
      test cases/common/66 install subdir/subdir/meson.build

@ -772,7 +772,7 @@ installed with a `.gz` suffix.
### install_subdir()
``` meson
void install_subdir(subdir_name, install_dir : ..., exclude_files : ..., exclude_directories : ..., elide_directory : ...)
void install_subdir(subdir_name, install_dir : ..., exclude_files : ..., exclude_directories : ..., strip_directory : ...)
```
Installs the entire given subdirectory and its contents from the
@ -786,7 +786,7 @@ The following keyword arguments are supported:
- `exclude_directories`: a list of directory names that should not be installed.
Names are interpreted as paths relative to the `subdir_name` location.
- `install_dir`: the location to place the installed subdirectory.
- `elide_directory`: install directory contents. `elide_directory=false` by default.
- `strip_directory`: install directory contents. `strip_directory=false` by default.
Since 0.45.0
For a given directory `foo`:
@ -796,7 +796,7 @@ foo/
file1
file2
```
`install_subdir('foo', install_dir : 'share', elide_directory : false)` creates
`install_subdir('foo', install_dir : 'share', strip_directory : false)` creates
```
share/
foo/
@ -805,7 +805,7 @@ share/
file2
```
`install_subdir('foo', install_dir : 'share', elide_directory : true)` creates
`install_subdir('foo', install_dir : 'share', strip_directory : true)` creates
```
share/
bar/

@ -1,4 +0,0 @@
## install_subdir() supports elide_directory
If elide_directory=true install_subdir() installs directory contents
instead of directory itself, eliding name of the source directory.

@ -0,0 +1,4 @@
## install_subdir() supports strip_directory
If strip_directory=true install_subdir() installs directory contents
instead of directory itself, stripping basename of the source directory.

@ -852,7 +852,7 @@ int dummy;
sd.installable_subdir).rstrip('/')
dst_dir = os.path.join(self.environment.get_prefix(),
sd.install_dir)
if not sd.elide_directory:
if not sd.strip_directory:
dst_dir = os.path.join(dst_dir, os.path.basename(src_dir))
d.install_subdirs.append([src_dir, dst_dir, sd.install_mode,
sd.exclude])

@ -507,14 +507,14 @@ class DataHolder(InterpreterObject, ObjectHolder):
return self.held_object.install_dir
class InstallDir(InterpreterObject):
def __init__(self, src_subdir, inst_subdir, install_dir, install_mode, exclude, elide_directory):
def __init__(self, src_subdir, inst_subdir, install_dir, install_mode, exclude, strip_directory):
InterpreterObject.__init__(self)
self.source_subdir = src_subdir
self.installable_subdir = inst_subdir
self.install_dir = install_dir
self.install_mode = install_mode
self.exclude = exclude
self.elide_directory = elide_directory
self.strip_directory = strip_directory
class Man(InterpreterObject):
@ -1391,7 +1391,7 @@ permitted_kwargs = {'add_global_arguments': {'language'},
'install_data': {'install_dir', 'install_mode', 'sources'},
'install_headers': {'install_dir', 'subdir'},
'install_man': {'install_dir'},
'install_subdir': {'elide_directory', 'exclude_files', 'exclude_directories', 'install_dir', 'install_mode'},
'install_subdir': {'exclude_files', 'exclude_directories', 'install_dir', 'install_mode', 'strip_directory'},
'jar': jar_kwargs,
'project': {'version', 'meson_version', 'default_options', 'license', 'subproject_dir'},
'run_target': {'command', 'depends'},
@ -2675,12 +2675,12 @@ root and issuing %s.
install_dir = kwargs['install_dir']
if not isinstance(install_dir, str):
raise InvalidArguments('Keyword argument install_dir not a string.')
if 'elide_directory' in kwargs:
if not isinstance(kwargs['elide_directory'], bool):
raise InterpreterException('"elide_directory" keyword must be a boolean.')
elide_directory = kwargs['elide_directory']
if 'strip_directory' in kwargs:
if not isinstance(kwargs['strip_directory'], bool):
raise InterpreterException('"strip_directory" keyword must be a boolean.')
strip_directory = kwargs['strip_directory']
else:
elide_directory = False
strip_directory = False
if 'exclude_files' in kwargs:
exclude = extract_as_list(kwargs, 'exclude_files')
for f in exclude:
@ -2703,7 +2703,7 @@ root and issuing %s.
exclude_directories = set()
exclude = (exclude_files, exclude_directories)
install_mode = self._get_kwarg_install_mode(kwargs)
idir = InstallDir(self.subdir, subdir, install_dir, install_mode, exclude, elide_directory)
idir = InstallDir(self.subdir, subdir, install_dir, install_mode, exclude, strip_directory)
self.build.install_dirs.append(idir)
return idir

@ -12,6 +12,6 @@ subdir('subdir')
install_subdir('sub1', install_dir : 'share', install_mode : ['rwxr-x--t', 'root'])
install_subdir('sub/sub1', install_dir : 'share')
# elide_directory
install_subdir('sub_elided', install_dir : 'share', elide_directory : true)
install_subdir('nested_elided/sub', install_dir : 'share', elide_directory : true)
# strip_directory
install_subdir('sub_elided', install_dir : 'share', strip_directory : true)
install_subdir('nested_elided/sub', install_dir : 'share', strip_directory : true)

@ -2,4 +2,4 @@ install_subdir('sub1', install_dir : 'share',
# This mode will be overridden by the mode set in the outer install_subdir
install_mode : 'rwxr-x---')
install_subdir('sub_elided', install_dir : 'share', elide_directory : true)
install_subdir('sub_elided', install_dir : 'share', strip_directory : true)

Loading…
Cancel
Save