silnrsi / smith

font development, testing and release
Other
14 stars 5 forks source link

smith configure messages correct? #2

Closed bobh0303 closed 6 years ago

bobh0303 commented 8 years ago

If I have the following in my wscript:

def configure(ctx) :
    ctx.env['MAKE_GDL'] = 'perl ../bin/my_make_gdl'

is it expected that smith configure output indicates:

Checking for program make_gdl            : /usr/bin/make_gdl

? Seems it should indicate I am using my_make_gdl

mhosken commented 7 years ago

Yeh it's lying. What you are doing is overriding the calculated result. What is shown is the calculated result. Not a lot we can do about that since the configure() is called after a value is calculated for MAKE_GDL. How is smith to know you are overriding it and adapt accordingly?

If you really wanted to, we could add a function to set the environment as in: setenv(ctx, 'MAKE_GDL', 'perl ../bin/my_make_gdl') which would set the env entry and print a message. But it seems a lot for not much?

bobh0303 commented 7 years ago

Oh, I thought smith configure was doing some processing of the wscript file -- Didn't you say every time the wscript changes one should run configure again? Maybe I'm misremembering.

So perhaps this is just a documentation issue.

mhosken commented 7 years ago

smith configure runs your wscript, but it doesn't call the configure function at that point. After running the script, it uses that information to tell it which programs it needs to go and look for. After working out where all the programs are, for which it produces the report on the screen, it then runs your configure function (if it's there) and silently changes things (like where MAKE_GDL points).

bobh0303 commented 7 years ago

OK, I understand how the current program generates the output it does, but if it is under our control -- and I realize it may not be -- it would be more useful if it displayed the final configuration instead of an intermediate one. Can your last two steps (produce report, run configure function) be easily reversed?

mhosken commented 7 years ago

no since the reporting is done at the point of searching for the program. And your configure function isn't calling that particular function. So, yes, all things are possible, but how many weeks would you like me to spend on it?

bobh0303 commented 7 years ago

If it is more than an hour it probably isn't worth it because wscript authors can add the output they want in configure(), e.g.:

    print "wcript-specific configuration:"
    for k in ('MAKE_GDL', 'FFCOPYGLYPHS', 'PDFSHAPED') :
        print "%-20s: %s" % (k.lower(), ctx.env[k])

Maybe we could suggest this in the manual...

mhosken commented 7 years ago

or more simply something like:

def configure(ctx) : 
    myprogs = { 'MYPROG' : '../tools/myprog', 'OTHERPROG' : 'perl ../tools/otherprog.pl' }
    for k, v in myprogs.items() : 
        ctx.env[k] = v
        ctx.msg("Local config for " + k.lower(), v)