Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Write package files only if something changed. |
---|---|
Timelines: | family | ancestors | trunk |
Files: | files | file ages | folders |
SHA1: |
981e1d91a2a0f4bb6abea95c74d293da |
User & Date: | Tobias 2013-06-08 19:21:45 |
Context
2013-06-08
| ||
19:21 | Write package files only if something changed. Leaf check-in: 981e1d91a2 user: Tobias tags: trunk | |
2012-11-07
| ||
23:17 | Accepted a number of bugfixes and tweaks by Tobias Schueller. The subset packages now have proper TEApot metadata, for example. check-in: 1ce45b61ee user: andreask tags: trunk | |
Changes
Changes to subset.tcl.
︙ | ︙ | |||
21 22 23 24 25 26 27 | # # ## ### ##### ######## ############# ##################### ## API - Start interception and saving. proc ::famfamfam::subset::new {name version dst} { # Create a package NAME + VERSION with saved icons at the given # location. | | | | < > > | > > > > > > > > > > > > > > > > > > > > > > | | | < < < | > > > > > > > > > > > > > > > > > | > > | | > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | # # ## ### ##### ######## ############# ##################### ## API - Start interception and saving. proc ::famfamfam::subset::new {name version dst} { # Create a package NAME + VERSION with saved icons at the given # location. variable destination variable pkg_name variable pkg_version if {$destination ne {}} { return -code error "Assembly in progress, unable to start a second" } set destination $dst set pkg_name $name set pkg_version $version # Create the directory we will collect the images in. file mkdir $destination # Generate administrative files only if they do not exist. # They will be updated later if icons are added. if {![file exists $destination/pkgIndex.tcl] || \ ![file exists $destination/loader.tcl] || \ ![file exists $destination/teapot.txt]} { GeneratePackageFiles } # At last tell the core to report to us which images are loaded so # that we can record them into the package we are creating. famfamfam intercept ::famfamfam::subset::save return } proc ::famfamfam::subset::GeneratePackageFiles {} { # Generate (updated) administrative files. variable destination variable pkg_name variable pkg_version variable ptemplate variable ttemplate variable template lappend map @@name@@ $pkg_name lappend map @@qname@@ [list $pkg_name] lappend map @@version@@ $pkg_version lappend map @@time@@ [clock format [clock seconds]] lappend map @@qtime@@ [list [clock format [clock seconds]]] lappend map @@user@@ $::tcl_platform(user) # Generate a package index ... set c [open $destination/pkgIndex.tcl w] puts $c [string map $map $ptemplate] close $c # ... And the package code set c [open $destination/loader.tcl w] puts $c [string map $map $template] close $c # Generate a teapot.txt ... set c [open $destination/teapot.txt w] puts $c [string map $map $ttemplate] close $c return } proc ::famfamfam::subset::save {iconset iconname iconpath} { variable destination if {$destination eq {}} { return -code error "No assembly in progress." } # Check if the image is really new set oldiconpath [file join $destination/icons/$iconset [file tail $iconpath]] if {[file exists $oldiconpath]} { set fp [open $iconpath r] fconfigure $fp -translation binary set new [read $fp] close $fp set fp [open $oldiconpath r] fconfigure $fp -translation binary set old [read $fp] close $fp } else { # make them different by default set old old set new new } # Record the image into the package we are assembling. # Only if not already there or different. # Update package files also. if {$old ne $new} { file mkdir $destination/icons/$iconset file copy -force -- $iconpath $destination/icons/$iconset/ GeneratePackageFiles } return } proc ::famfamfam::subset::done {} { # Stop recording. variable destination |
︙ | ︙ | |||
174 175 176 177 178 179 180 | namespace export {[a-z]*} namespace ensemble create } # # ## ### ##### ######## ############# ##################### ## Ready | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | namespace export {[a-z]*} namespace ensemble create } # # ## ### ##### ######## ############# ##################### ## Ready package provide famfamfam::subset 1.1 return # # ## ### ##### ######## ############# ##################### # Local variables: # mode: tcl # indent-tabs-mode: nil # End: |