Overview
Comment: | Completely refactor the 'package unknown' handler error handling. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7a658563b409a52f167b519d34185e31 |
User & Date: | mistachkin on 2016-08-17 05:27:03 |
Other Links: | manifest | tags |
Context
2016-08-17
| ||
06:18 | Do not try to auto-hook the 'package unknown' handler if it is already hooked. check-in: e7c21e360a user: mistachkin tags: trunk | |
05:27 | Completely refactor the 'package unknown' handler error handling. check-in: 7a658563b4 user: mistachkin tags: trunk | |
02:27 | Adjust comments. check-in: 607e185516 user: mistachkin tags: trunk | |
Changes
Modified client/pkgr.eagle from [c24c2305f9] to [a9e801c84e].
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # NOTE: This package absolutely requires the Eagle core script library # package, even when it is being used by native Tcl. If needed, # prior to loading this package, the native Tcl auto-path should # be modified to include the "Eagle1.0" directory (i.e. the one # containing the Eagle core script library file "init.eagle"). # package require Eagle.Library proc stringIsList { value } { if {[isEagle]} then { return [string is list $value] } else { global tcl_version | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # NOTE: This package absolutely requires the Eagle core script library # package, even when it is being used by native Tcl. If needed, # prior to loading this package, the native Tcl auto-path should # be modified to include the "Eagle1.0" directory (i.e. the one # containing the Eagle core script library file "init.eagle"). # package require Eagle.Library proc formatPackageName { package version } { return [string trim [appendArgs \ $package " " [getLookupVersion $version]]] } proc formatResult { code result } { switch -exact -- $code { 0 {set codeString ok} 1 {set codeString error} 2 {set codeString return} 3 {set codeString break} 4 {set codeString continue} default {set codeString [appendArgs unknown( $code )]} } if {[string length $result] > 0} then { return [appendArgs $codeString ": " [list $result]] } else { return $codeString } } proc pkgLog { string } { catch { tclLog [appendArgs [pid] " : " [clock seconds] " : pkgr : " $string] } } proc stringIsList { value } { if {[isEagle]} then { return [string is list $value] } else { global tcl_version |
︙ | ︙ | |||
759 760 761 762 763 764 765 766 767 768 | # # NOTE: This version argument to this procedure must be optional, because # Eagle does not add a version argument when one is not supplied to # the [package require] sub-command itself. # proc packageUnknownHandler { package {version ""} } { # # NOTE: First, run our [package unknown] handler. # | > > | | < < < < < | < < < < < < < < < < | | | | | < | < | | | > > > > | | | > | | > > | | < < > | | > > | < < < | < < > | < < < | | < | > | | < | < | < | | > | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | # # NOTE: This version argument to this procedure must be optional, because # Eagle does not add a version argument when one is not supplied to # the [package require] sub-command itself. # proc packageUnknownHandler { package {version ""} } { variable verboseUnknownResult # # NOTE: First, run our [package unknown] handler. # set code(1) [catch {main $package $version handler} result(1)] if {$verboseUnknownResult} then { pkgLog [appendArgs \ "repository handler results for package \"" [formatPackageName \ $package $version] "\", are " [formatResult $code(1) $result(1)]] } # # NOTE: Next, run the saved [package unknown] handler. # set code(2) [catch { runSavedPackageUnknownHandler $package $version } result(2)] if {$verboseUnknownResult} then { pkgLog [appendArgs \ "saved handler results for package \"" [formatPackageName \ $package $version] "\" are " [formatResult $code(2) $result(2)]] } # # NOTE: Finally, check if the package was actually loaded and then # optionally record/log the results. # set command [list package present $package] if {[string length $version] > 0} then {lappend command $version} if {[catch $command] == 0} then { if {$verboseUnknownResult} then { pkgLog [appendArgs \ "package \"" [formatPackageName $package $version] \ "\" was loaded."] } } else { if {$verboseUnknownResult} then { pkgLog [appendArgs \ "package \"" [formatPackageName $package $version] \ "\" was not loaded."] } set result(3) [appendArgs \ "can't find package " [formatPackageName $package $version]] error [array get result] } } proc setupPackageUnknownVars {} { # # NOTE: Prevent progress messages from being displayed while downloading # from the repository, etc? By default, this is enabled. # |
︙ | ︙ | |||
888 889 890 891 892 893 894 895 896 897 898 899 900 901 | # when called from the [package unknown] handler? # variable strictUnknownLanguage; # DEFAULT: true if {![info exists strictUnknownLanguage]} then { set strictUnknownLanguage true } } proc main { package version caller } { # # NOTE: Issue the lookup request to the remote package repository. # set data [getLookupData \ | > > > > > > > > > > | 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | # when called from the [package unknown] handler? # variable strictUnknownLanguage; # DEFAULT: true if {![info exists strictUnknownLanguage]} then { set strictUnknownLanguage true } # # NOTE: Emit diagnostic messages when a [package unknown] handler # is called? # variable verboseUnknownResult; # DEFAULT: false if {![info exists verboseUnknownResult]} then { set verboseUnknownResult false } } proc main { package version caller } { # # NOTE: Issue the lookup request to the remote package repository. # set data [getLookupData \ |
︙ | ︙ |
Modified client/pkgr.eagle.harpy from [bf0d393649] to [f7f47c423a].
︙ | ︙ | |||
17 18 19 20 21 22 23 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> | | | | | | | | | | | | | | | | | | | | | | 17 18 19 20 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 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> <Id>2a821830-6f0d-48e2-a69a-c6a1e4566199</Id> <HashAlgorithm>SHA512</HashAlgorithm> <EntityType>Script</EntityType> <TimeStamp>2016-08-17T05:26:13.0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