From ea62fecefdd5cf77dd54e5193fe4d624bd01c7ad Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Fri, 27 Jan 2023 00:43:46 +0100 Subject: [PATCH] build: Merge 'completion' into 'src' Ever since commit bafbbe81c9220cb3, the shell completions are generated using the Toolbx binary, and the 'completion' sub-directory no longer has any source code, but only the build scripts to invoke the Toolbx binary to generate them. This is a good opportunity to simplify the layout of this Git repository by reducing the number of sub-directories. The file containing the Bash completions had to be renamed to avoid colliding with the name of the Toolbx binary, since they are both generated in the same sub-directory. https://github.com/containers/toolbox/pull/1216 --- completion/meson.build | 35 -------------- meson.build | 1 - src/meson.build | 47 +++++++++++++++++++ .../meson_generate_completions.py | 0 4 files changed, 47 insertions(+), 36 deletions(-) delete mode 100644 completion/meson.build rename {completion => src}/meson_generate_completions.py (100%) diff --git a/completion/meson.build b/completion/meson.build deleted file mode 100644 index 7183b68..0000000 --- a/completion/meson.build +++ /dev/null @@ -1,35 +0,0 @@ -meson_generate_completions_program = find_program('meson_generate_completions.py') - -if bashcompletionsdir != '' - custom_target( - 'bash-completion', - capture: true, - command: [meson_generate_completions_program, meson.global_source_root() / 'src', 'bash'], - depends: [toolbox_go], - install: true, - install_dir: bashcompletionsdir, - output: 'toolbox', -) -endif - -if fishcompletionsdir != '' - custom_target( - 'fish-completion', - capture: true, - command: [meson_generate_completions_program, meson.global_source_root() / 'src', 'fish'], - depends: [toolbox_go], - install: true, - install_dir: fishcompletionsdir, - output: 'toolbox.fish', -) -endif - -custom_target( - 'zsh-completion', - capture: true, - command: [meson_generate_completions_program, meson.global_source_root() / 'src', 'zsh'], - depends: [toolbox_go], - install: true, - install_dir: zshcompletionsdir, - output: '_toolbox', -) diff --git a/meson.build b/meson.build index 9c2138e..1768bdf 100644 --- a/meson.build +++ b/meson.build @@ -112,6 +112,5 @@ subdir('data') subdir('doc') subdir('profile.d') subdir('src') -subdir('completion') meson.add_install_script('meson_post_install.py') diff --git a/src/meson.build b/src/meson.build index 88b81d3..1d2b868 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,6 +1,7 @@ go_build_wrapper_file = files('go-build-wrapper') go_build_wrapper_program = find_program('go-build-wrapper') +meson_generate_completions_program = find_program('meson_generate_completions.py') meson_go_fmt_program = find_program('meson_go_fmt.py') sources = files( @@ -66,6 +67,52 @@ toolbox_go = custom_target( output: 'toolbox', ) +if bashcompletionsdir != '' + custom_target( + 'bash-completion', + capture: true, + command: [ + meson_generate_completions_program, + meson.current_source_dir(), + 'bash', + ], + depends: [toolbox_go], + install: true, + install_dir: bashcompletionsdir, + output: 'toolbox.bash', +) +endif + +if fishcompletionsdir != '' + custom_target( + 'fish-completion', + capture: true, + command: [ + meson_generate_completions_program, + meson.current_source_dir(), + 'fish', + ], + depends: [toolbox_go], + install: true, + install_dir: fishcompletionsdir, + output: 'toolbox.fish', +) +endif + +custom_target( + 'zsh-completion', + capture: true, + command: [ + meson_generate_completions_program, + meson.current_source_dir(), + 'zsh', + ], + depends: [toolbox_go], + install: true, + install_dir: zshcompletionsdir, + output: '_toolbox', +) + if shellcheck.found() test('shellcheck src/go-build-wrapper', shellcheck, args: [go_build_wrapper_file]) endif diff --git a/completion/meson_generate_completions.py b/src/meson_generate_completions.py similarity index 100% rename from completion/meson_generate_completions.py rename to src/meson_generate_completions.py