From 728f152af4e6d890787c93899f5f58be9c8e7519 Mon Sep 17 00:00:00 2001 From: Markus Mottl Date: Tue, 4 Aug 2020 19:47:38 -0400 Subject: [PATCH] Removed base and stdio build dependencies --- CHANGES.md | 5 +++++ dune-project | 2 -- postgresql.opam | 2 -- src/config/discover.ml | 23 +++++++++++------------ src/config/dune | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 947631a..0949863 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +### 4.6.2 (2020-08-04) + + * Removed `base` and `stdio` build dependencies. + + ### 4.6.1 (2020-07-29) * Fixed a bug in `request_cancel` that turned errors into success and diff --git a/dune-project b/dune-project index fd50a35..5bc8a9f 100644 --- a/dune-project +++ b/dune-project @@ -25,8 +25,6 @@ Postgresql offers library functions for accessing PostgreSQL databases.") (ocaml (>= 4.08)) (dune (>= 1.10)) dune-configurator - (base :build) - (stdio :build) (conf-postgresql :build) base-bytes ) diff --git a/postgresql.opam b/postgresql.opam index c9b835d..d98a0e1 100644 --- a/postgresql.opam +++ b/postgresql.opam @@ -24,8 +24,6 @@ depends: [ "ocaml" {>= "4.08"} "dune" {>= "1.10"} "dune-configurator" - "base" {build} - "stdio" {build} "conf-postgresql" {build} "base-bytes" ] diff --git a/src/config/discover.ml b/src/config/discover.ml index 4281451..ea455f6 100644 --- a/src/config/discover.ml +++ b/src/config/discover.ml @@ -1,5 +1,4 @@ -open Base -open Stdio +open Printf let find_number ~pos str = let len = String.length str in @@ -20,7 +19,7 @@ let find_number ~pos str = | _ -> [], pos in let number_lst, next = loop ~pos in - String.concat number_lst, next + String.concat "" number_lst, next let () = let module C = Configurator.V1 in @@ -30,26 +29,26 @@ let () = try Unix.open_process_in cmd with exc -> eprintf "could not open pg_config, cmd: '%s'" cmd; raise exc in - Exn.protectx ic ~finally:In_channel.close ~f:(fun ic -> - let pgsql_includedir = "-I" ^ In_channel.input_line_exn ic in - let pgsql_libdir = "-L" ^ In_channel.input_line_exn ic in + Fun.protect ~finally:(fun () -> close_in ic) (fun () -> + let pgsql_includedir = "-I" ^ input_line ic in + let pgsql_libdir = "-L" ^ input_line ic in let major, minor = - let line = In_channel.input_line_exn ic in + let line = input_line ic in let print_fail () = eprintf "Unable to find versions from line '%s', cmd: '%s'" line cmd in - let exit_fail () = print_fail (); Caml.exit 1 in + let exit_fail () = print_fail (); exit 1 in try - let first_space = String.index_exn line ' ' in + let first_space = String.index line ' ' in let major, next = find_number ~pos:first_space line in let minor = (* Can also handle release candidates *) let c = line.[next] in - if Char.(c = '.') then fst (find_number ~pos:next line) - else if Char.(c <> 'r' || line.[next + 1] <> 'c') then exit_fail () + if c = '.' then fst (find_number ~pos:next line) + else if c <> 'r' || line.[next + 1] <> 'c' then exit_fail () else "0" in - if String.(major = "" || minor = "") then exit_fail () + if major = "" || minor = "" then exit_fail () else "-DPG_OCAML_MAJOR_VERSION=" ^ major, "-DPG_OCAML_MINOR_VERSION=" ^ minor diff --git a/src/config/dune b/src/config/dune index c64a73d..ddf8924 100644 --- a/src/config/dune +++ b/src/config/dune @@ -1,4 +1,4 @@ (executables (names discover) - (libraries base stdio dune.configurator) + (libraries dune.configurator) )