diff --git a/lib/package.gi b/lib/package.gi index edaa0d41de..08e582e80c 100644 --- a/lib/package.gi +++ b/lib/package.gi @@ -1078,7 +1078,7 @@ InstallGlobalFunction( IsPackageMarkedForLoading, function( name, version ) #F DefaultPackageBannerString( ) ## InstallGlobalFunction( DefaultPackageBannerString, function( inforec ) - local len, sep, i, str, authors, role, fill, person; + local len, sep, i, str, authors, maintainers, contributors, printPersons; # Start with a row of `-' signs. len:= SizeScreen()[1] - 3; @@ -1114,19 +1114,13 @@ InstallGlobalFunction( DefaultPackageBannerString, function( inforec ) fi; Add( str, '\n' ); - # Add info about the authors if there are authors; - # otherwise add maintainers. - if IsBound( inforec.Persons ) then - authors:= Filtered( inforec.Persons, x -> x.IsAuthor ); - role:= "by "; - if IsEmpty( authors ) then - authors:= Filtered( inforec.Persons, x -> x.IsMaintainer ); - role:= "maintained by "; - fi; + # Add info about the authors and/or maintainers + printPersons := function( role, persons ) + local fill, person; fill:= ListWithIdenticalEntries( Length(role), ' ' ); Append( str, role ); - for i in [ 1 .. Length( authors ) ] do - person:= authors[i]; + for i in [ 1 .. Length( persons ) ] do + person:= persons[i]; Append( str, person.FirstNames ); Append( str, " " ); Append( str, person.LastName ); @@ -1135,9 +1129,9 @@ InstallGlobalFunction( DefaultPackageBannerString, function( inforec ) elif IsBound( person.Email ) then Append( str, Concatenation( " (", person.Email, ")" ) ); fi; - if i = Length( authors ) then + if i = Length( persons ) then Append( str, ".\n" ); - elif i = Length( authors )-1 then + elif i = Length( persons )-1 then if i = 1 then Append( str, " and\n" ); else @@ -1149,6 +1143,22 @@ InstallGlobalFunction( DefaultPackageBannerString, function( inforec ) Append( str, fill ); fi; od; + end; + if IsBound( inforec.Persons ) then + authors:= Filtered( inforec.Persons, x -> x.IsAuthor ); + if not IsEmpty( authors ) then + printPersons( "by ", authors ); + fi; + contributors:= Filtered( inforec.Persons, x -> not x.IsAuthor and not x.IsMaintainer ); + if not IsEmpty( contributors ) then + Append( str, "with contributions by:\n"); + printPersons( " ", contributors ); + fi; + maintainers:= Filtered( inforec.Persons, x -> x.IsMaintainer ); + if not IsEmpty( maintainers ) and authors <> maintainers then + Append( str, "maintained by:\n"); + printPersons( " ", maintainers ); + fi; fi; # Add info about the home page of the package. @@ -1158,6 +1168,13 @@ InstallGlobalFunction( DefaultPackageBannerString, function( inforec ) Append( str, "\n" ); fi; + # Add info about the issue tracker of the package. + if IsBound( inforec.IssueTrackerURL ) then + Append( str, "Report issues at " ); + Append( str, inforec.IssueTrackerURL ); + Append( str, "\n" ); + fi; + # temporary hack, in some package names with umlauts are in HTML encoding str := Concatenation(sep, RecodeForCurrentTerminal(str), sep); str:= ReplacedString( str, "ä", RecodeForCurrentTerminal("รค") ); diff --git a/tst/testinstall/package.tst b/tst/testinstall/package.tst index 3d1ab1f08b..20c32d032c 100644 --- a/tst/testinstall/package.tst +++ b/tst/testinstall/package.tst @@ -52,19 +52,20 @@ gap> Display(DefaultPackageBannerString(rec())); ----------------------------------------------------------------------------- -# +# gap> pkginfo := rec( > PackageName := "TestPkg", > Version := "1.0", > PackageWWWHome := "https://www.gap-system.org", > PackageDoc := [ rec( LongTitle := "A test package" ) ], > Persons := [ rec( IsAuthor := true, +> IsMaintainer := true, > FirstNames := "Lord", > LastName := "Vader", > WWWHome := "https://www.gap-system.org/~darth" > ) ]);; -# +# just one author & maintainer gap> Display(DefaultPackageBannerString(pkginfo)); ----------------------------------------------------------------------------- Loading TestPkg 1.0 (A test package) @@ -73,39 +74,120 @@ Homepage: https://www.gap-system.org ----------------------------------------------------------------------------- -# -gap> Add(pkginfo.Persons, rec( IsAuthor := true, FirstNames := "Luke", -> LastName := "Skywalker", Email := "luke.skywalker@gap-system.org" )); +# add a maintainer who is not an author +gap> Add(pkginfo.Persons, rec( IsAuthor := false, IsMaintainer := true, +> FirstNames := "Luke", LastName := "Skywalker", +> Email := "luke.skywalker@gap-system.org" )); +gap> Display(DefaultPackageBannerString(pkginfo)); +----------------------------------------------------------------------------- +Loading TestPkg 1.0 (A test package) +by Lord Vader (https://www.gap-system.org/~darth). +maintained by: + Lord Vader (https://www.gap-system.org/~darth) and + Luke Skywalker (luke.skywalker@gap-system.org). +Homepage: https://www.gap-system.org +----------------------------------------------------------------------------- + + +# add an author who is not a maintainer +gap> Add(pkginfo.Persons, rec( IsAuthor := true, IsMaintainer := false, +> FirstNames := "Leia", LastName := "Organa" )); gap> Display(DefaultPackageBannerString(pkginfo)); ----------------------------------------------------------------------------- Loading TestPkg 1.0 (A test package) by Lord Vader (https://www.gap-system.org/~darth) and + Leia Organa. +maintained by: + Lord Vader (https://www.gap-system.org/~darth) and Luke Skywalker (luke.skywalker@gap-system.org). Homepage: https://www.gap-system.org ----------------------------------------------------------------------------- -# -gap> Add(pkginfo.Persons, rec( IsAuthor := true, FirstNames := "Leia", LastName := "Organa" )); +# add a contributor +gap> Add(pkginfo.Persons, rec( IsAuthor := false, IsMaintainer := false, +> FirstNames := "Yoda", LastName := "", +> WWWHome := "https://www.gap-system.org/~yoda")); gap> Display(DefaultPackageBannerString(pkginfo)); ----------------------------------------------------------------------------- Loading TestPkg 1.0 (A test package) -by Lord Vader (https://www.gap-system.org/~darth), - Luke Skywalker (luke.skywalker@gap-system.org), and +by Lord Vader (https://www.gap-system.org/~darth) and Leia Organa. +with contributions by: + Yoda (https://www.gap-system.org/~yoda). +maintained by: + Lord Vader (https://www.gap-system.org/~darth) and + Luke Skywalker (luke.skywalker@gap-system.org). Homepage: https://www.gap-system.org ----------------------------------------------------------------------------- -# +# test what happens if all are authors and maintainers +gap> for p in pkginfo.Persons do p.IsAuthor:=true; p.IsMaintainer:=true; od; +gap> Display(DefaultPackageBannerString(pkginfo)); +----------------------------------------------------------------------------- +Loading TestPkg 1.0 (A test package) +by Lord Vader (https://www.gap-system.org/~darth), + Luke Skywalker (luke.skywalker@gap-system.org), + Leia Organa, and + Yoda (https://www.gap-system.org/~yoda). +Homepage: https://www.gap-system.org +----------------------------------------------------------------------------- + + +# test what happens if all are authors but not maintainers +gap> for p in pkginfo.Persons do p.IsAuthor:=true; p.IsMaintainer:=false; od; +gap> Display(DefaultPackageBannerString(pkginfo)); +----------------------------------------------------------------------------- +Loading TestPkg 1.0 (A test package) +by Lord Vader (https://www.gap-system.org/~darth), + Luke Skywalker (luke.skywalker@gap-system.org), + Leia Organa, and + Yoda (https://www.gap-system.org/~yoda). +Homepage: https://www.gap-system.org +----------------------------------------------------------------------------- + + +# test what happens if all are maintainers but not authors gap> for p in pkginfo.Persons do p.IsAuthor:=false; p.IsMaintainer:=true; od; gap> Display(DefaultPackageBannerString(pkginfo)); ----------------------------------------------------------------------------- Loading TestPkg 1.0 (A test package) -maintained by Lord Vader (https://www.gap-system.org/~darth), - Luke Skywalker (luke.skywalker@gap-system.org), and - Leia Organa. +maintained by: + Lord Vader (https://www.gap-system.org/~darth), + Luke Skywalker (luke.skywalker@gap-system.org), + Leia Organa, and + Yoda (https://www.gap-system.org/~yoda). +Homepage: https://www.gap-system.org +----------------------------------------------------------------------------- + + +# test what happens if all are contributors +gap> for p in pkginfo.Persons do p.IsAuthor:=false; p.IsMaintainer:=false; od; +gap> Display(DefaultPackageBannerString(pkginfo)); +----------------------------------------------------------------------------- +Loading TestPkg 1.0 (A test package) +with contributions by: + Lord Vader (https://www.gap-system.org/~darth), + Luke Skywalker (luke.skywalker@gap-system.org), + Leia Organa, and + Yoda (https://www.gap-system.org/~yoda). +Homepage: https://www.gap-system.org +----------------------------------------------------------------------------- + + +# test IssueTrackerURL +gap> pkginfo.IssueTrackerURL := "https://issues.gap-system.org/";; +gap> Display(DefaultPackageBannerString(pkginfo)); +----------------------------------------------------------------------------- +Loading TestPkg 1.0 (A test package) +with contributions by: + Lord Vader (https://www.gap-system.org/~darth), + Luke Skywalker (luke.skywalker@gap-system.org), + Leia Organa, and + Yoda (https://www.gap-system.org/~yoda). Homepage: https://www.gap-system.org +Report issues at https://issues.gap-system.org/ -----------------------------------------------------------------------------