mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Update opam dependencies (#626)
This commit is contained in:
commit
69d8f433e7
2
.github/workflows/harness.yml
vendored
2
.github/workflows/harness.yml
vendored
@ -112,7 +112,7 @@ jobs:
|
|||||||
- name: Install LaTeX deps
|
- name: Install LaTeX deps
|
||||||
# This is done late because caching would not benefit compared to
|
# This is done late because caching would not benefit compared to
|
||||||
# installation through apk (1,5G upload is slow)
|
# installation through apk (1,5G upload is slow)
|
||||||
run: sudo apk add texlive-xetex texmf-dist-latexextra texmf-dist-pictures font-dejavu groff
|
run: sudo apk add texlive-xetex texmf-dist-latexextra texmf-dist-binextra texmf-dist-pictures font-dejavu groff
|
||||||
- name: Build Catala extra docs
|
- name: Build Catala extra docs
|
||||||
run: |
|
run: |
|
||||||
cd ~/catala
|
cd ~/catala
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# STAGE 1: setup an opam switch with all dependencies installed
|
# STAGE 1: setup an opam switch with all dependencies installed
|
||||||
#
|
#
|
||||||
# (only depends on the opam files)
|
# (only depends on the opam files)
|
||||||
FROM ocamlpro/ocaml:4.14-2024-01-14 AS dev-build-context
|
FROM ocamlpro/ocaml:4.14-2024-05-26 AS dev-build-context
|
||||||
# Image from https://hub.docker.com/r/ocamlpro/ocaml
|
# Image from https://hub.docker.com/r/ocamlpro/ocaml
|
||||||
|
|
||||||
RUN mkdir catala
|
RUN mkdir catala
|
||||||
@ -25,10 +25,6 @@ RUN opam --cli=2.1 switch create catala ocaml-system && \
|
|||||||
# Note: just `opam switch create . --deps-only --with-test --with-doc && opam clean`
|
# Note: just `opam switch create . --deps-only --with-test --with-doc && opam clean`
|
||||||
# should be enough once opam 2.2 is released (see opam#5185)
|
# should be enough once opam 2.2 is released (see opam#5185)
|
||||||
|
|
||||||
# This is temporary, to avoid pulling in a dependency to Str, until it's merged
|
|
||||||
# and release into dates_calc
|
|
||||||
RUN opam --cli=2.1 pin dates_calc.0.0.5 git+https://github.com/AltGr/dates-calc#nostr
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# STAGE 2: get the whole repo and build
|
# STAGE 2: get the whole repo and build
|
||||||
#
|
#
|
||||||
|
11
Makefile
11
Makefile
@ -99,14 +99,13 @@ prepare-install:
|
|||||||
dune build @install --promote-install-files
|
dune build @install --promote-install-files
|
||||||
|
|
||||||
install: prepare-install
|
install: prepare-install
|
||||||
if [ x$$($(OPAM) --version) = "x2.1.5" ]; then \
|
case x$$($(OPAM) --version) in \
|
||||||
$(OPAM) install . --working-dir; \
|
x2.1.5|x2.1.6) $(OPAM) install . --working-dir;; \
|
||||||
else \
|
*) $(OPAM) install . --working-dir --assume-built;; \
|
||||||
$(OPAM) install . --working-dir --assume-built; \
|
esac
|
||||||
fi
|
|
||||||
# `dune install` would work, but does a dirty install to the opam prefix without
|
# `dune install` would work, but does a dirty install to the opam prefix without
|
||||||
# registering with opam.
|
# registering with opam.
|
||||||
# --assume-built is broken in 2.1.5
|
# --assume-built is broken in 2.1.5 and 2.1.6
|
||||||
|
|
||||||
inst: prepare-install
|
inst: prepare-install
|
||||||
@opam custom-install \
|
@opam custom-install \
|
||||||
|
@ -226,15 +226,18 @@ module Cli = struct
|
|||||||
~doc:"Display the full list of tests that have been run" );
|
~doc:"Display the full list of tests that have been run" );
|
||||||
])
|
])
|
||||||
|
|
||||||
let use_patdiff =
|
let diff_command =
|
||||||
Arg.(
|
Arg.(
|
||||||
value
|
value
|
||||||
& flag
|
& opt ~vopt:(Some None) (some (some string)) None
|
||||||
& info ["patdiff"]
|
& info ["diff"]
|
||||||
~env:(Cmd.Env.info "CATALA_USE_PATDIFF")
|
~env:(Cmd.Env.info "CATALA_DIFF_COMMAND")
|
||||||
~doc:
|
~doc:
|
||||||
"Enable use of the 'patdiff' command for showing test failure \
|
"Use a standard $(i,diff) command instead of the default \
|
||||||
details (no effect if the command is not available)")
|
side-by-side view. If no argument is supplied, the command will \
|
||||||
|
be $(b,patdiff) if available or $(b,diff) otherwise. A supplied \
|
||||||
|
argument will be used as diff command with arguments pointing to \
|
||||||
|
the reference file and the output file")
|
||||||
|
|
||||||
let ninja_flags =
|
let ninja_flags =
|
||||||
let env =
|
let env =
|
||||||
@ -915,10 +918,10 @@ let test_cmd =
|
|||||||
(reset_test_outputs : bool)
|
(reset_test_outputs : bool)
|
||||||
(test_flags : string list)
|
(test_flags : string list)
|
||||||
verbosity
|
verbosity
|
||||||
(use_patdiff : bool)
|
(diff_command : string option option)
|
||||||
(ninja_flags : string list) =
|
(ninja_flags : string list) =
|
||||||
set_report_verbosity verbosity;
|
set_report_verbosity verbosity;
|
||||||
Clerk_report.set_display_flags ~use_patdiff ();
|
Clerk_report.set_display_flags ~diff_command ();
|
||||||
ninja_init ~extra:Seq.empty ~test_flags
|
ninja_init ~extra:Seq.empty ~test_flags
|
||||||
@@ fun build_dir nin_file ->
|
@@ fun build_dir nin_file ->
|
||||||
let targets =
|
let targets =
|
||||||
@ -988,7 +991,7 @@ let test_cmd =
|
|||||||
$ Cli.reset_test_outputs
|
$ Cli.reset_test_outputs
|
||||||
$ Cli.test_flags
|
$ Cli.test_flags
|
||||||
$ Cli.report_verbosity
|
$ Cli.report_verbosity
|
||||||
$ Cli.use_patdiff
|
$ Cli.diff_command
|
||||||
$ Cli.ninja_flags)
|
$ Cli.ninja_flags)
|
||||||
|
|
||||||
let run_cmd =
|
let run_cmd =
|
||||||
@ -1051,11 +1054,11 @@ let runtest_cmd =
|
|||||||
$ Cli.single_file)
|
$ Cli.single_file)
|
||||||
|
|
||||||
let report_cmd =
|
let report_cmd =
|
||||||
let run color debug verbosity use_patdiff build_dir file =
|
let run color debug verbosity diff_command build_dir file =
|
||||||
let _options = Catala_utils.Global.enforce_options ~debug ~color () in
|
let _options = Catala_utils.Global.enforce_options ~debug ~color () in
|
||||||
let build_dir = Option.value ~default:"_build" build_dir in
|
let build_dir = Option.value ~default:"_build" build_dir in
|
||||||
set_report_verbosity verbosity;
|
set_report_verbosity verbosity;
|
||||||
Clerk_report.set_display_flags ~use_patdiff ();
|
Clerk_report.set_display_flags ~diff_command ();
|
||||||
let open Clerk_report in
|
let open Clerk_report in
|
||||||
let tests = read_many file in
|
let tests = read_many file in
|
||||||
let success = summary ~build_dir tests in
|
let success = summary ~build_dir tests in
|
||||||
@ -1071,7 +1074,7 @@ let report_cmd =
|
|||||||
$ Cli.Global.color
|
$ Cli.Global.color
|
||||||
$ Cli.Global.debug
|
$ Cli.Global.debug
|
||||||
$ Cli.report_verbosity
|
$ Cli.report_verbosity
|
||||||
$ Cli.use_patdiff
|
$ Cli.diff_command
|
||||||
$ Cli.build_dir
|
$ Cli.build_dir
|
||||||
$ Cli.single_file)
|
$ Cli.single_file)
|
||||||
|
|
||||||
|
@ -33,22 +33,22 @@ type disp_flags = {
|
|||||||
mutable files : [ `All | `Failed | `None ];
|
mutable files : [ `All | `Failed | `None ];
|
||||||
mutable tests : [ `All | `FailedFile | `Failed | `None ];
|
mutable tests : [ `All | `FailedFile | `Failed | `None ];
|
||||||
mutable diffs : bool;
|
mutable diffs : bool;
|
||||||
mutable use_patdiff : bool;
|
mutable diff_command : string option option;
|
||||||
}
|
}
|
||||||
|
|
||||||
let disp_flags =
|
let disp_flags =
|
||||||
{ files = `Failed; tests = `FailedFile; diffs = true; use_patdiff = false }
|
{ files = `Failed; tests = `FailedFile; diffs = true; diff_command = None }
|
||||||
|
|
||||||
let set_display_flags
|
let set_display_flags
|
||||||
?(files = disp_flags.files)
|
?(files = disp_flags.files)
|
||||||
?(tests = disp_flags.tests)
|
?(tests = disp_flags.tests)
|
||||||
?(diffs = disp_flags.diffs)
|
?(diffs = disp_flags.diffs)
|
||||||
?(use_patdiff = disp_flags.use_patdiff)
|
?(diff_command = disp_flags.diff_command)
|
||||||
() =
|
() =
|
||||||
disp_flags.files <- files;
|
disp_flags.files <- files;
|
||||||
disp_flags.tests <- tests;
|
disp_flags.tests <- tests;
|
||||||
disp_flags.diffs <- diffs;
|
disp_flags.diffs <- diffs;
|
||||||
disp_flags.use_patdiff <- use_patdiff
|
disp_flags.diff_command <- diff_command
|
||||||
|
|
||||||
let write_to f file =
|
let write_to f file =
|
||||||
File.with_out_channel f (fun oc -> Marshal.to_channel oc (file : file) [])
|
File.with_out_channel f (fun oc -> Marshal.to_channel oc (file : file) [])
|
||||||
@ -81,20 +81,14 @@ let longuest_common_prefix_length s1 s2 =
|
|||||||
aux 0
|
aux 0
|
||||||
|
|
||||||
let diff_command =
|
let diff_command =
|
||||||
|
let has_gnu_diff () =
|
||||||
|
File.process_out ~check_exit:ignore "diff" ["--version"]
|
||||||
|
|> Re.(execp (compile (str "GNU")))
|
||||||
|
in
|
||||||
lazy
|
lazy
|
||||||
begin
|
begin
|
||||||
if
|
match disp_flags.diff_command with
|
||||||
disp_flags.use_patdiff
|
| None when Message.has_color stdout && has_gnu_diff () ->
|
||||||
&& has_command "patdiff"
|
|
||||||
&& Message.has_color stdout
|
|
||||||
then
|
|
||||||
( ["patdiff"; "-alt-old"; "expected"; "-alt-new"; "result"],
|
|
||||||
fun ppf s ->
|
|
||||||
s
|
|
||||||
|> String.split_on_char '\n'
|
|
||||||
|> List.filter (( <> ) "")
|
|
||||||
|> Format.pp_print_list Format.pp_print_string ppf )
|
|
||||||
else
|
|
||||||
let width = Message.terminal_columns () - 5 in
|
let width = Message.terminal_columns () - 5 in
|
||||||
( [
|
( [
|
||||||
"diff";
|
"diff";
|
||||||
@ -147,6 +141,21 @@ let diff_command =
|
|||||||
(String.sub r w (String.length r - w))
|
(String.sub r w (String.length r - w))
|
||||||
| _ -> Format.pp_print_string ppf li))
|
| _ -> Format.pp_print_string ppf li))
|
||||||
ppf )
|
ppf )
|
||||||
|
| Some cmd_opt | (None as cmd_opt) ->
|
||||||
|
let command =
|
||||||
|
match cmd_opt with
|
||||||
|
| Some str -> String.split_on_char ' ' str
|
||||||
|
| None ->
|
||||||
|
if Message.has_color stdout && has_command "patdiff" then
|
||||||
|
["patdiff"; "-alt-old"; "Reference"; "-alt-new"; "Result"]
|
||||||
|
else ["diff"; "-u"; "-L"; "Reference"; "-L"; "Result"]
|
||||||
|
in
|
||||||
|
( command,
|
||||||
|
fun ppf s ->
|
||||||
|
s
|
||||||
|
|> String.trim_end
|
||||||
|
|> String.split_on_char '\n'
|
||||||
|
|> Format.pp_print_list Format.pp_print_string ppf )
|
||||||
end
|
end
|
||||||
|
|
||||||
let print_diff ppf p1 p2 =
|
let print_diff ppf p1 p2 =
|
||||||
|
@ -43,6 +43,6 @@ val set_display_flags :
|
|||||||
?files:[ `All | `Failed | `None ] ->
|
?files:[ `All | `Failed | `None ] ->
|
||||||
?tests:[ `All | `FailedFile | `Failed | `None ] ->
|
?tests:[ `All | `FailedFile | `Failed | `None ] ->
|
||||||
?diffs:bool ->
|
?diffs:bool ->
|
||||||
?use_patdiff:bool ->
|
?diff_command:string option option ->
|
||||||
unit ->
|
unit ->
|
||||||
unit
|
unit
|
||||||
|
@ -22,7 +22,7 @@ depends: [
|
|||||||
"bindlib" {>= "6.0"}
|
"bindlib" {>= "6.0"}
|
||||||
"cmdliner" {>= "1.1.0"}
|
"cmdliner" {>= "1.1.0"}
|
||||||
"cppo" {>= "1"}
|
"cppo" {>= "1"}
|
||||||
"dates_calc" {>= "0.0.4"}
|
"dates_calc" {>= "0.0.6"}
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"js_of_ocaml-ppx" {= "4.1.0"}
|
"js_of_ocaml-ppx" {= "4.1.0"}
|
||||||
"menhir" {>= "20200211"}
|
"menhir" {>= "20200211"}
|
||||||
@ -31,7 +31,7 @@ depends: [
|
|||||||
"ocamlfind" {!= "1.9.5"}
|
"ocamlfind" {!= "1.9.5"}
|
||||||
"ocamlgraph" {>= "1.8.8"}
|
"ocamlgraph" {>= "1.8.8"}
|
||||||
"re" {>= "1.10"}
|
"re" {>= "1.10"}
|
||||||
"sedlex" {>= "2.4"}
|
"sedlex" {>= "3.1"}
|
||||||
"uutf" {>= "1.0.3"}
|
"uutf" {>= "1.0.3"}
|
||||||
"ubase" {>= "0.05"}
|
"ubase" {>= "0.05"}
|
||||||
"unionFind" {>= "20220109"}
|
"unionFind" {>= "20220109"}
|
||||||
@ -47,7 +47,6 @@ depends: [
|
|||||||
"conf-npm" {cataladevmode}
|
"conf-npm" {cataladevmode}
|
||||||
"conf-python-3-dev" {cataladevmode}
|
"conf-python-3-dev" {cataladevmode}
|
||||||
"cpdf" {cataladevmode}
|
"cpdf" {cataladevmode}
|
||||||
"conf-diffutils" {cataladevmode}
|
|
||||||
"conf-pandoc" {cataladevmode}
|
"conf-pandoc" {cataladevmode}
|
||||||
"z3" {catalaz3mode}
|
"z3" {catalaz3mode}
|
||||||
"conf-ninja"
|
"conf-ninja"
|
||||||
|
@ -185,21 +185,24 @@ let process_out ?check_exit cmd args =
|
|||||||
let () =
|
let () =
|
||||||
let default = 80 in
|
let default = 80 in
|
||||||
let get_terminal_cols () =
|
let get_terminal_cols () =
|
||||||
|
let from_env () =
|
||||||
|
try int_of_string (Sys.getenv "COLUMNS") with Not_found | Failure _ -> 0
|
||||||
|
in
|
||||||
let count =
|
let count =
|
||||||
try
|
if not Unix.(isatty stdin) then from_env ()
|
||||||
(* terminfo *)
|
else
|
||||||
process_out "tput" ["cols"] |> String.trim |> int_of_string
|
|
||||||
with Failure _ -> (
|
|
||||||
try
|
try
|
||||||
(* stty *)
|
(* terminfo *)
|
||||||
process_out "stty" ["size"]
|
process_out "tput" ["cols"] |> String.trim |> int_of_string
|
||||||
|> String.trim
|
with Failure _ -> (
|
||||||
|> fun s ->
|
try
|
||||||
let i = String.rindex s ' ' + 1 in
|
(* stty *)
|
||||||
String.sub s i (String.length s - i) |> int_of_string
|
process_out "stty" ["size"]
|
||||||
with Failure _ | Not_found | Invalid_argument _ -> (
|
|> String.trim
|
||||||
try int_of_string (Sys.getenv "COLUMNS")
|
|> fun s ->
|
||||||
with Not_found | Failure _ -> 0))
|
let i = String.rindex s ' ' + 1 in
|
||||||
|
String.sub s i (String.length s - i) |> int_of_string
|
||||||
|
with Failure _ | Not_found | Invalid_argument _ -> from_env ())
|
||||||
in
|
in
|
||||||
if count > 0 then count else default
|
if count > 0 then count else default
|
||||||
in
|
in
|
||||||
|
@ -778,9 +778,6 @@ let lex_raw (lexbuf : lexbuf) : token =
|
|||||||
| _ -> (
|
| _ -> (
|
||||||
(* Nested match for lower priority; `_` matches length 0 so we effectively retry the
|
(* Nested match for lower priority; `_` matches length 0 so we effectively retry the
|
||||||
sub-match at the same point *)
|
sub-match at the same point *)
|
||||||
let lexbuf = lexbuf in
|
|
||||||
(* workaround sedlex bug, see https://github.com/ocaml-community/sedlex/issues/12
|
|
||||||
(fixed in 3.1) *)
|
|
||||||
match%sedlex lexbuf with
|
match%sedlex lexbuf with
|
||||||
| Star (Compl '\n'), ('\n' | eof) -> LAW_TEXT (Utf8.lexeme lexbuf)
|
| Star (Compl '\n'), ('\n' | eof) -> LAW_TEXT (Utf8.lexeme lexbuf)
|
||||||
| _ -> L.raise_lexer_error (Pos.from_lpos prev_pos) prev_lexeme)
|
| _ -> L.raise_lexer_error (Pos.from_lpos prev_pos) prev_lexeme)
|
||||||
@ -817,9 +814,6 @@ let lex_law (lexbuf : lexbuf) : token =
|
|||||||
| _ -> (
|
| _ -> (
|
||||||
(* Nested match for lower priority; `_` matches length 0 so we effectively retry the
|
(* Nested match for lower priority; `_` matches length 0 so we effectively retry the
|
||||||
sub-match at the same point *)
|
sub-match at the same point *)
|
||||||
let lexbuf = lexbuf in
|
|
||||||
(* workaround sedlex bug, see https://github.com/ocaml-community/sedlex/issues/12
|
|
||||||
(fixed in 3.1) *)
|
|
||||||
match%sedlex lexbuf with
|
match%sedlex lexbuf with
|
||||||
| Star (Compl '\n'), ('\n' | eof) -> LAW_TEXT (Utf8.lexeme lexbuf)
|
| Star (Compl '\n'), ('\n' | eof) -> LAW_TEXT (Utf8.lexeme lexbuf)
|
||||||
| _ -> L.raise_lexer_error (Pos.from_lpos prev_pos) prev_lexeme)
|
| _ -> L.raise_lexer_error (Pos.from_lpos prev_pos) prev_lexeme)
|
||||||
|
@ -3,7 +3,7 @@ name = "catala-runtime"
|
|||||||
description = "Runtime libraries needed to execute Catala programs compiled to Python"
|
description = "Runtime libraries needed to execute Catala programs compiled to Python"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gmpy2",
|
"gmpy2 ~= 2.2.0rc1",
|
||||||
"typing",
|
"typing",
|
||||||
"mypy",
|
"mypy",
|
||||||
"python-dateutil",
|
"python-dateutil",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
> Module Test_grave_char_en
|
> Module Test_grave_char_en
|
||||||
|
|
||||||
## Law text should be able to contain grave accent '`'.
|
## Law text should be able to contain backquote chars `` ` ``.
|
||||||
|
|
||||||
This is a block of law text containing `.
|
This is a block of law text containing `.
|
||||||
This allows to:
|
This allows to:
|
||||||
@ -60,7 +60,8 @@ $ catala latex
|
|||||||
|
|
||||||
\textbf{This defines the catala module \texttt{Test\_grave\_char\_en}}
|
\textbf{This defines the catala module \texttt{Test\_grave\_char\_en}}
|
||||||
|
|
||||||
\subsection{Law text should be able to contain grave accent ``'.}
|
\subsection{Law text should be able to contain backquote chars
|
||||||
|
\texttt{\textasciigrave{}}.}
|
||||||
|
|
||||||
This is a block of law text containing `. This allows to:
|
This is a block of law text containing `. This allows to:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user