Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot pass object generators nor files to add_install_script #6175

Closed
nacho opened this issue Nov 13, 2019 · 4 comments · Fixed by #7060
Closed

Cannot pass object generators nor files to add_install_script #6175

nacho opened this issue Nov 13, 2019 · 4 comments · Fixed by #7060
Assignees

Comments

@nacho
Copy link
Contributor

nacho commented Nov 13, 2019

If I try to pass an object generated by a generator or if I try to pass a file to meson.add_install_script I get the following error:
ERROR: add_install_script args must be strings

@zackw
Copy link

zackw commented Jan 10, 2020

+1 I just tripped over this myself. In my case, I have all of my build scripts in a scripts/ subdirectory, and meson.build in that directory sets variables for files() objects for each, for instance

S_install_symlink = files('install-symlink')[0]

Then in another subdirectory's meson.build I had

  if INSTALL_SHARED_LIB
    meson.add_install_script(S_install_symlink, get_option('libdir'),
                             'libcrypt.so', 'libxcrypt.so')
  endif

and this blows up with

lib/meson.build:208:10: ERROR: add_install_script args must be strings

and this in the logfile:

Element not a string: [<File: scripts/install-symlink (not built)>, 'lib/x86_64-linux-gnu', 'libcrypt.so', 'libxcrypt.so']

This is particularly annoying because there's no documented way to turn a File object back into a string from the meson.build language. (In fact, File objects don't seem to be documented at all!) The Python-level File object (mesonlib.File) has an absolute_path method but it's not callable from the meson.build language.

Anyway, it seems like add_install_script should accept the same kinds of positional arguments that run_command does.

@zackw
Copy link

zackw commented Jan 10, 2020

Another thing that doesn't work but really should:

pymod = import('python')
python = pymod.find_installation('python3')
meson.add_install_script(python, 'install-hook.py')

->

Element not a string: [<Holder: <ExternalProgram 'python3' -> ['/usr/bin/python3']>>, 'install-hook.py']

@alex-tee
Copy link
Contributor

+1

can't pass the result of a configure_file() to meson.add_install_script() and can't see a reason to not allow that

i pass meson.build_root () / .... / 'my_script.sh' instead which is pretty much the same thing, but weird

@dcbaker
Copy link
Member

dcbaker commented Apr 29, 2020

I have a patch for this in a branch, I'll clean it up and send it out.

@dcbaker dcbaker self-assigned this Apr 29, 2020
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 29, 2020
This adds support for Files, CustomTarget, Indexs of CustomTargets,
ConfigureFiles, ExternalPrograms, and Executables.

Fixes: mesonbuild#1234
Fixes: mesonbuild#3552
Fixes: mesonbuild#6175
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 29, 2020
This adds support for Files, CustomTarget, Indexs of CustomTargets,
ConfigureFiles, ExternalPrograms, and Executables.

Fixes: mesonbuild#1234
Fixes: mesonbuild#3552
Fixes: mesonbuild#6175
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 29, 2020
This adds support for Files, CustomTarget, Indexs of CustomTargets,
ConfigureFiles, ExternalPrograms, and Executables.

Fixes: mesonbuild#1234
Fixes: mesonbuild#3552
Fixes: mesonbuild#6175
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 30, 2020
This adds support for Files, CustomTarget, Indexs of CustomTargets,
ConfigureFiles, ExternalPrograms, and Executables.

Fixes: mesonbuild#1234
Fixes: mesonbuild#3552
Fixes: mesonbuild#6175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants