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 odate work with OCaml >4.06 and OPAM >2.0 #5

Merged
merged 2 commits into from
Nov 17, 2020
Merged

Make odate work with OCaml >4.06 and OPAM >2.0 #5

merged 2 commits into from
Nov 17, 2020

Conversation

dmbaturin
Copy link
Contributor

Right now oDate cannot be built and installed with OCaml >4.06 and OPAM 2.x. This is unfortunate because there's no better library for parsing datetime strings!
calendar is fine for parsing dates, but its implementation doesn't work right with formats that include both date and time (ocaml-community/calendar#35).

Thus I really would love to see a new release of oDate. These patches update the code to use Stdlib rather than old-style Pervasives. Since there's only one dependent package (coclobas), I believe it will not cause big problems.
@smondet Please confirm or deny whether you are fine with this change.

The OPAM file now works with 2.0 and should be ready for a PR. I successfully did opam pin add . with OCaml 4.10 and opam 2.0.7:

utop # ODate.Unix.From.string (ODate.Unix.From.generate_parser "%F %H:%M" |> Option.get) "2020-11-17 06:05" |> ODate.Unix.Printer.to_iso ;;
- : string = "2020-11-17T06:05:00Z"

@smondet
Copy link
Contributor

smondet commented Nov 17, 2020

@dmbaturin LGTM 👍

@dmbaturin
Copy link
Contributor Author

It's possible to make it compatible with older OCaml versions using stdlib-shims, but I believe it's better to keep it legacy-free, at least until users of old OCaml versions come to demand support. :)

@hhugo hhugo merged commit db1341b into hhugo:master Nov 17, 2020
@hhugo
Copy link
Owner

hhugo commented Nov 17, 2020

Testing is using should that is not compatible with ocaml > 4.06

@dmbaturin
Copy link
Contributor Author

@hhugo I can help with rewriting tests using something that does work. We need to decide what to use though.

Do you consider non-working tests a blocker for the OPAM release?

@hhugo
Copy link
Owner

hhugo commented Nov 17, 2020

I'd be happy to switch to expect tests https://github.com/janestreet/ppx_expect

@hhugo
Copy link
Owner

hhugo commented Nov 17, 2020

#6

@hhugo
Copy link
Owner

hhugo commented Nov 17, 2020

I'll try to make a release today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants