Skip to content
Snippets Groups Projects
Commit e2c97414 authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[dune] avoid 'cat' in configurator for better Windows compatibility

parent fc8a5141
No related branches found
No related tags found
No related merge requests found
...@@ -198,12 +198,17 @@ module Fc_version = struct ...@@ -198,12 +198,17 @@ module Fc_version = struct
; name: string ; name: string
} }
let get configurator = let head1 file = (* output first line from file, without '\n' *)
let out_VERSION = try
let out = C.Process.run configurator "cat" ["VERSION"] in let ic = open_in file in
if out.exit_code <> 0 then C.die "Can't read VERSION." ; let s = input_line ic in
out.stdout close_in ic;
in s
with _exc ->
C.die "Can't read " ^ file ^ "."
let get () =
let out_VERSION = head1 "VERSION" in
let re_version = let re_version =
Str.regexp {|\([1-9][0-9]\)\.\([0-9]\)\(.*\)|} Str.regexp {|\([1-9][0-9]\)\.\([0-9]\)\(.*\)|}
in in
...@@ -213,14 +218,9 @@ module Fc_version = struct ...@@ -213,14 +218,9 @@ module Fc_version = struct
Str.matched_group 2 out_VERSION, Str.matched_group 2 out_VERSION,
try Str.matched_group 3 out_VERSION with Not_found -> "" try Str.matched_group 3 out_VERSION with Not_found -> ""
else else
C.die "Can't read VERSION." C.die "Invalid VERSION contents."
in
let name =
let out = C.Process.run configurator "cat" ["VERSION_CODENAME"] in
if out.exit_code <> 0 then
C.die "Can't read VERSION_CODENAME." ;
String.sub out.stdout 0 (String.length out.stdout - 1)
in in
let name = head1 "VERSION_CODENAME" in
{ major; minor; ext; name } { major; minor; ext; name }
let pp_sed fmt version = let pp_sed fmt version =
...@@ -275,7 +275,7 @@ let python_available configurator = ...@@ -275,7 +275,7 @@ let python_available configurator =
with Not_found | Failure _ -> false with Not_found | Failure _ -> false
let configure configurator = let configure configurator =
let version = Fc_version.get configurator in let version = Fc_version.get () in
let cpp = Cpp.get configurator in let cpp = Cpp.get configurator in
let os = OS.get configurator in let os = OS.get configurator in
let config_sed = open_out "config.sed" in let config_sed = open_out "config.sed" in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment