Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#11837 closed enhancement (fixed)

Make darwinports scripting easier

Reported by: kballard (Lily Ballard) Owned by: macports-tickets@…
Priority: Low Milestone: MacPorts 1.4
Component: base Version: 1.4.3
Keywords: Cc: kballard (Lily Ballard)
Port:

Description

Currently writing a script that uses the darwinports infrastructure requires defining several procs and passing around arrays of options. Ideally I could write a script that looked like

package require darwinports
dportinit
# do stuff here

but instead I need to do something like

package require darwinports

proc ui_isset {val} { if {$val == "ports_debug"} {return 1} {return 0} }

proc global_option_isset {val} { return 0 }

# UI callback
proc ui_prefix {priority} {
    switch $priority {
        debug {
            return "DEBUG: "
        }
        error {
            return "Error: "
        }
        warn {
            return "Warning: "
        }
        default {
            return ""
        }
    }
}

proc ui_channels {priority} {
    return {stderr}
}

array set ui_options {ports_debug yes}
array set global_options {}
array set global_variations {}
dportinit ui_options global_options global_variations

Darwinports should gracefully handle the lack of these procs and should also allow you to pass nothing to dportinit to mean default behaviour.

Change History (6)

comment:1 Changed 18 years ago by kballard (Lily Ballard)

Milestone: Needs developer review

comment:2 Changed 18 years ago by kballard (Lily Ballard)

Cc: eridius@… added

comment:3 Changed 18 years ago by kballard (Lily Ballard)

Resolution: fixed
Status: newclosed

Fixed in r24460

comment:4 Changed 18 years ago by jmpalacios (Juan Manuel Palacios)

Milestone: Needs developer reviewMacPorts 1.4

comment:5 Changed 17 years ago by nox@…

Priority: Nice to haveLow

comment:6 Changed 17 years ago by jmpalacios (Juan Manuel Palacios)

Merged into the release_1_4 branch in r24908.

-jmpp

Note: See TracTickets for help on using tickets.