-
Notifications
You must be signed in to change notification settings - Fork 170
Allow packages to use ISO 8601 dates in their PackageInfo.g
files (so YYYY-MM-DD
instead of DD/MM/YYYY
)
#3355
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
Allow packages to use ISO 8601 dates in their PackageInfo.g
files (so YYYY-MM-DD
instead of DD/MM/YYYY
)
#3355
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good start, I've requested some changes.
First, note that this is not everything, otherwise it would be too simple. For example, .Date
is used by the package updates system - see this line and below:
and as it stands now, it will reject ISO 8601 dates. Second, the linked code does some checks for the validity of the date, which may be transferred here.
For some reason, there is a conflict in |
1597a99
to
4d47cfa
Compare
@alex-konovalov I submitted a pull request to change this in gap-distribution too. Also |
Thanks @wucas - I will look. A cross-reference to that PR from here would be useful though. Saves time when navigating and connects things belonging together. |
4d47cfa
to
e9ea8fc
Compare
Codecov Report
@@ Coverage Diff @@
## master #3355 +/- ##
==========================================
- Coverage 84.63% 77.03% -7.6%
==========================================
Files 698 690 -8
Lines 345553 341652 -3901
==========================================
- Hits 292442 263176 -29266
- Misses 53111 78476 +25365
|
The test in |
e9ea8fc
to
750681f
Compare
750681f
to
e5a30d6
Compare
@alex-konovalov you're right I overlooked the issue with the ambiguity of the dd/mm/yyyy format. I added a Mandat in the CheckDateValidity function. That way seemed most easy to me and I think with the comment it is clear what the code is supposed to do. I return true if that's the case so the "invalid Date" message is not printed. |
It just occurred to me that this PR will not fully resolve the problem. In fact, it could even make it more difficult. If So, I suggest that in addition to adjusting validation we should also change |
Yes, please make sure that after loading, dates are in a uniform format. I'd indeed prefer ISO 8601 for that in the long run, but for the time being, we must make sure no tooling is broken. Right now, that might affect AutoDoc, which parses the Date for package manuals (see here and also the code for So perhaps it'd be better to "normalize" everything to the dd/mm/yyyy format; it'll then be trivial to switch over to the ISO format at any time, and also buys us time to adapt AutoDoc and whatever else might need it. And in case there is a problem, it is trivial to roll back, too. |
@fingolfin wrote
Ok, I thought initially about more radical change and switch to ISO 8601 now, but OK, let's do it gradually - that will allow to make a small adjustment and merge this PR then. |
@fingolfin I looked at this again since I'd like to finish this up during the GAP Days next week. |
@wucas unless I miss something, I see only
but then |
1451646
to
c0b5610
Compare
I have added a normalization routine. As far as I can't tell now GAPInfo.PackagesInfo.pkgname[1].Date has the format "dd/mm/yyyy" even if in the respective PackageInfo.g the date has the format "yyyy-mm-dd". @alex-konovalov does this address @fingolfin s request? |
c0b5610
to
e5a7083
Compare
This would be good to have in 4.11.0 - added it to the milestone to ensure that its stays on the radar. |
10113d4
to
d68df66
Compare
This was added to the 4.11 Milestone and @alex-konovalov requested changes. From what I understand @wucas changed code according to @wilfwilson requests. What is the status of this? |
This waits for me to review in conjunction with gap-system/gap-distribution#78 |
Unfortunately, moving this to GAP 4.12 milestone. |
It's rather frustrating that @wucas opened this comparatively simple change request (which is by no means to belittle the effort it took to get there) over a year ago and it is still not merged, and now has a conflict, so a rebase is necessary. I don't understand why we can't merge this right away (or could have done so in September) -- adding the ability to GAP to load packages with ISO dates before teaching the website and package distribution about ISO dates seems perfectly reasonable to me, esp. as long as we don't accept such packages for distribution. I will attempt to rebase this now, and I really hope we can then merge it ASAP. And perhaps next week the website counterpart can be taken care of. But even if not, I think we should just merge this! |
d68df66
to
aed7d3d
Compare
Just realized the PR is not over a year, but exactly one year old. Happy birthday then ;-). And I managed to rebase it, too. |
@alex-konovalov can we merge this now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one comment and one bug report.
@@ -213,7 +213,7 @@ end ); | |||
#F AddPackageInfo( files ) | |||
## | |||
BindGlobal( "AddPackageInfos", function( files, pkgdir, ignore ) | |||
local file, record, pkgname, version; | |||
local file, record, pkgname, version, date, dd, mm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we call ValidatePackageInfo
from LoadPackage
but not from AddPackageInfos
. I wonder if we should do that in AddPackageInfos
too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, but that goes beyond the purpose of this PR, doesn't it?
If the date format is dd/mm/yyyy and InfoLevel InfoPackageLoading is set to at least 2 it prints a hint to change the format. Add validity check for dates Add normalisation of date format to AddPackageInfos Update relevant testfile Fixes gap-system#2727
aed7d3d
to
a58cab8
Compare
I fixed one minor whitespace typo and rebased this PR to see whether the tests pass. I also dismissed @alex-konovalov "request for changes" review, as I believe I refuted his "bug report" and consider his "concern" a feature request that goes beyond this PR. If I hear no new concerns about this PR, I'll merge it next week. |
Well, to do this properly, one should check:
As there is no pressing needs for this (except that this is one year old, and it would be nice to merge it), I don't plan to look at these before the middle of the next week... |
@wucas @fingolfin thanks & let's do it. |
PackageInfo.g
files (so YYYY-MM-DD
instead of DD/MM/YYYY
)
If the date format is dd/mm/yyyy and InfoLevel InfoPackageLoading is set to at least 2 it prints a hint to change the format as was suggested in #2727. This pull request is intended to fix issue #2727.