[Scons-users] Is there something like a try-finally surrounding for multiple actions in scons?

Dirk Bächle tshortik at gmx.de
Thu Nov 14 14:11:13 EST 2013


Hi Andreas,

given your description below I think you should a have a look at
pseudo-Builders. You can find more infos about them in the manual,
"chap. 20, Pseudo-Builders: the AddMethod function",

http://www.scons.org/doc/production/HTML/scons-user/c3938.html

and in the

http://www.scons.org/wiki/ToolsForFools

guide. For a more practical example have a look at the Qt4/Qt5 tools
(see our index at http://www.scons.org/wiki/ToolsIndex ), e.g. the Ts4()
Builder.

If you have further questions or get stuck, please don't hesitate to ask
again.

Best regards,

Dirk

On 14.11.2013 12:42, andreas.ames at de.transport.bombardier.com wrote:

>

> Hi all,

>

> I have a local Builder defined as follows:

>

> sql_gen = SCons.Script.Builder(action = _primos_sql_gen

> , emitter = _primos_sql_gen_emitter

> , source_scanner = PrimosSqlGenScanner

> , src_suffix = '.sql'

> , suffix = '.c'

> , single_source = 1)

>

> Please note, that it is a single-source builder. I call it with a

> long list of sources (like 60 input files). The action is a python

> function and I like that the builds of the individual targets are

> nicely seperated from each other.

>

> However the performance of this approach is somewhat lacking as the

> the function _primos_sql_gen has to call an expensive preparation

> process and an equally expensive tear-down process in a try-finally

> environment.

>

> Thus I'm wondering if there is any mechanism avaiable in scons that

> allows me to:

>

> 1. Make sure that scons builds all out-of-date targets defined by a

> single call to the Builder (with multiple sources) in sequence without

> scheduling other build actions from different builders in between this

> sequence. (This is necessary as the preperation step has side-effects

> that might influence other build actions.) (NB: A more flexible

> approach would be to provide a way to define such a non-premptable

> sequence as a list of targets whose build actions must always be

> executed in sequence.)

>

> 2. Specify one preparation and one tear-down process around that

> sequence. It would be good if there was a way to run the tear-down

> step regardless of the way the action sequence is ended (i.e. even in

> the face of exceptions). (NB: This could be specified as hooks, i.e.

> python function callbacks, for the sequence mentioned above.)

>

> Such a mechanism would allow me to speed-up my build considerably

> while preseving the nice modularisation and self-containedness of my

> current approach.

>

> Please note, that it would *not be necessary* in my case to require

> transactional semantics from such a mechanism.

>

>

> Thanks in advance,

>

> aa

>

>

> Please consider the environment before you print / Merci de penser à

> l'environnement avant d'imprimer / Bitte denken Sie an die Umwelt

> bevor Sie drucken

>

> Bombardier Transportation GmbH

> Vorsitzender des Aufsichtsrats / Chairman of Supervisory Board: Prof.

> Dr. Wilhelm Bender

> Geschäftsführung / Executive Board: Michael Clausecker

> (Vorsitzender/Chairman), Dr. Susanne Kortendick, David Barry, Matthias

> Keller

> Sitz der Gesellschaft / Principal Office: Berlin

> Registergericht / Registration Court: Amtsgericht Charlottenburg, HRB

> 64838

>

> _______________________________________________________________________________________________________________

>

> This e-mail communication (and any attachment/s) may contain

> confidential or privileged information and is intended only for the

> individual(s) or entity named above and to others who have been

> specifically authorized to receive it. If you are not the intended

> recipient, please do not read, copy, use or disclose the contents of

> this communication to others. Please notify the sender that you have

> received this e-mail in error by reply e-mail, and delete the e-mail

> subsequently. Please note that in order to protect the security of our

> information systems an AntiSPAM solution is in use and will browse

> through incoming emails.

> Thank you.

> _________________________________________________________________________________________________________________

>

>

> Ce message (ainsi que le(s) fichier(s)), transmis par courriel, peut

> contenir des renseignements confidentiels ou protégés et est destiné à

> l'usage exclusif du destinataire ci-dessus. Toute autre personne est,

> par les présentes, avisée qu'il est strictement interdit de le

> diffuser, le distribuer ou le reproduire. Si vous l'avez reçu par

> inadvertance, veuillez nous en aviser et détruire ce message. Veuillez

> prendre note qu'une solution antipollupostage (AntiSPAM) est utilisée

> afin d'assurer la sécurité de nos systèmes d'information et qu'elle

> furètera les courriels entrants.

> Merci.

> _________________________________________________________________________________________________________________

>

>

>

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131114/a33afeaf/attachment.html


More information about the Scons-users mailing list