Skip to content

Commit

Permalink
Removed base and stdio build dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mmottl committed Aug 4, 2020
1 parent 90f9fd0 commit 728f152
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
5 changes: 5 additions & 0 deletions 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
Expand Down
2 changes: 0 additions & 2 deletions dune-project
Expand Up @@ -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
)
Expand Down
2 changes: 0 additions & 2 deletions postgresql.opam
Expand Up @@ -24,8 +24,6 @@ depends: [
"ocaml" {>= "4.08"}
"dune" {>= "1.10"}
"dune-configurator"
"base" {build}
"stdio" {build}
"conf-postgresql" {build}
"base-bytes"
]
23 changes: 11 additions & 12 deletions 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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/config/dune
@@ -1,4 +1,4 @@
(executables
(names discover)
(libraries base stdio dune.configurator)
(libraries dune.configurator)
)

0 comments on commit 728f152

Please sign in to comment.