On Sep 2, 2:42 pm, "Edward K. Ream" <[email protected]> wrote:

> As of rev 2380 of the trunk, this work is mostly complete.  The script
> uses top-level python constants to describe the app.  These constants
> are then used to modify the boilerplate code.
>
> Although this work, it does make the boilerplate harder to scan, but I
> suppose this can't be helped.

I corrected this by using something akin to string.Template. The new
code replaces patterns of the form {{name}} by the app_name constant.
This is much safer and easier to understand than using %s
substitutions as was done previously.

A typical example is:

    s = ''' a long string'''

    table = (
        ('{{icon}}',app_icon),
        ('{{license}}',app_license),
        ('{{name}}',app_name),
        ('{{target}}',target_file),
        ('{{version}}',app_version))

    for pattern,val in table:
        s = s.replace(pattern,val)

It would be difficult to use string.Template because the triple quoted
strings have a lot of dollar signs that don't correspond to top-level
python vars.

Except for a blank line, the new .nsi file is the same as the old, so
no errors have crept in.

Edward
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to