0

Background

Our build script use Install() and InstallAs() to install a number of .dylib and .so files to a "dist" directory.

Install(dist_dir, 'libfoo')
Install(dist_dir, 'libbar')
...

The problem

After the library files are copied to dist_dir, we would like to run a custom function on each of the files. That custom command is as followed:

def add_magic(lib_filename, arg1, arg2, arg3)

We appreciate any help to achieve our goals.

What have we tried so far?

  • We just started looked into creating custom builder via Builder()
  • We also looked at Command() builder
  • We also looked at the AddMethod() function to create pseudo-builder

Right now our bets are on the first two approaches, we are reading the user guide and working on simple examples. We are no where near the end and appreciate any tips/hint.

Hai Vu
  • 37,849
  • 11
  • 66
  • 93

1 Answers1

3

You can try something like this:

AddPostAction(target, action)
env.AddPostAction(target, action)

Arranges for the specified action to be performed after the specified target has been built. The specified action(s) may be an Action object, or anything that can be converted into an Action object (see below).

When multiple targets are supplied, the action may be called multiple times, once after each action that generates one or more targets in the list.

Example:

installBarCmd = Install(dist_dir, 'libbar')
AddPostAction(installBarCmd, Action(...))
Torsten
  • 21,726
  • 5
  • 24
  • 31
  • This seems to be an excellent solution. I am test driving it and will provide feedback as soon as I am done. Thank you. – Hai Vu Jul 25 '12 at 18:56
  • This solution is right on the money. I appreciate the quick response, Torsten. – Hai Vu Jul 25 '12 at 19:08