Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FirstNames optional in Persons records in package metadata #5822

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/ref/gappkg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,17 @@ The following components of the record are <E>optional</E>.
<Item>
a string,
</Item>
<Mark><C>FirstNames</C></Mark>
<Item>
a string,
</Item>
<Mark>at least one of <C>IsAuthor</C> or <C>IsMaintainer</C></Mark>
<Item>
<K>true</K> or <K>false</K>,
</Item>
</List>
and optional components
<List>
<Mark><C>FirstNames</C></Mark>
<Item>
a string (was mandatory before &GAP; 4.14),
</Item>
<Mark><C>PostalAddress</C></Mark>
<Item>
a string,
Expand Down
21 changes: 15 additions & 6 deletions lib/package.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1234,8 +1234,10 @@ InstallGlobalFunction( DefaultPackageBannerString,
Append( str, role );
for i in [ 1 .. Length( persons ) ] do
person:= persons[i];
Append( str, person.FirstNames );
Append( str, " " );
if IsBound( person.FirstNames ) then
Append( str, person.FirstNames );
Append( str, " " );
fi;
Append( str, person.LastName );
if IsBound( person.WWWHome ) then
Append( str, Concatenation( " (", person.WWWHome, ")" ) );
Expand Down Expand Up @@ -2402,7 +2404,7 @@ InstallGlobalFunction( ValidatePackageInfo, function( info )
and IsBound( record.Persons ) then
for subrec in record.Persons do
TestMandat( subrec, "LastName", IsString, "a string" );
TestMandat( subrec, "FirstNames", IsString, "a string" );
TestOption( subrec, "FirstNames", IsString, "a string" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we make it optional here we should also adjust doc/ref/gappkg.xml to say it is (now) optional. (Indeed besides moving it from the list of required components to optional ones, I'd add some text to the effect "since GAP 4.14 this is optional" or so

if not ( IsBound( subrec.IsAuthor )
or IsBound( subrec.IsMaintainer ) ) then
if ValueOption( "quiet" ) <> true then
Expand Down Expand Up @@ -2899,8 +2901,11 @@ InstallGlobalFunction( BibEntry, function( arg )
author:= List( Filtered( pkginfo.Persons,
person -> person.IsAuthor or person.IsMaintainer ),
person -> Concatenation(
" <name><first>", person.FirstNames,
"</first><last>", person.LastName, "</last></name>\n" ) );
" <name>",
CallFuncList( function(x) if IsBound( x.FirstNames ) then
return Concatenation( "<first>", person.FirstNames, "</first>" );
else return ""; fi; end, [ person ] ),
"<last>", person.LastName, "</last></name>\n" ) );
if not IsEmpty( author ) then
Append( entry, Concatenation(
" <author>\n",
Expand All @@ -2911,7 +2916,7 @@ InstallGlobalFunction( BibEntry, function( arg )
" <title><C>", pkginfo.PackageName, "</C>" ) );
if IsBound( pkginfo.Subtitle ) then
Append( entry, Concatenation(
", ", ps( pkginfo.Subtitle ) ) );
", <C>", ps( pkginfo.Subtitle ), "</C>" ) );
fi;
if IsBound( pkginfo.Version ) then
Append( entry, Concatenation(
Expand Down Expand Up @@ -2982,6 +2987,10 @@ InstallGlobalFunction( Cite, function(arg)
Print("WARNING: No working version of package ", name, " is available!\n");
return;
fi;
# special handling for "The GAP Team"
bib:= ReplacedString( bib,
"<name><first>The</first><last>GAP Team</last></name>",
"<name><last>The GAP Team</last></name>" );
parse:= ParseBibXMLextString( bib );
# use encoding of terminal for printing
en := function(str)
Expand Down
6 changes: 3 additions & 3 deletions tst/testinstall/package.tst
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ BibXML:
<name><first>Retired</first><last>Author</last></name>
<name><first>Only</first><last>Maintainer</last></name>
</author>
<title><C>mockpkg</C>, A mock package for use by the GAP test suite,
<title><C>mockpkg</C>, <C>A mock package for use by the GAP test suite</C>,
<C>V</C>ersion 0.1</title>
<howpublished><URL>https://mockpkg.gap-system.org/</URL></howpublished>
<month>Mar</month>
Expand All @@ -578,8 +578,8 @@ BibTeX:

@misc{ mockpkg,
author = {Author, A. and Author, R. and Maintainer, O.},
title = {{mockpkg}, A mock package for use by the GAP test
suite, {V}ersion 0.1},
title = {{mockpkg}, {A mock package for use by the GAP test
suite}, {V}ersion 0.1},
month = {Mar},
year = {2018},
note = {GAP package},
Expand Down
Loading