Implement Lib.package

Gets the opam package of a library for a public or installed library
This commit is contained in:
Jérémie Dimino 2018-03-16 11:10:22 +08:00 committed by Rudi Grinberg
parent b59dab57da
commit 69c5a4a79d
2 changed files with 11 additions and 0 deletions

View File

@ -353,6 +353,15 @@ let is_local t = Path.is_local t.obj_dir
let status t = t.status
let package t =
match t.status with
| Installed ->
Some (Findlib.root_package_name t.name
|> Package.Name.of_string)
| Public p -> Some p.name
| Private _ ->
None
let to_id t : Id.t =
{ unique_id = t.unique_id
; path = t.src_dir

View File

@ -43,6 +43,8 @@ end
val status : t -> Status.t
val package : t -> Package.Name.t option
(** Operations on list of libraries *)
module L : sig
type nonrec t = t list