Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 59 lines (48 sloc) 2.101 kB
2ea5d1d @samoht Solver clean-ups
samoht authored
1 (***********************************************************************)
2 (* *)
3 (* Copyright 2012 OCamlPro *)
4 (* Copyright 2012 INRIA *)
5 (* *)
6 (* All rights reserved. This file is distributed under the terms of *)
7 (* the GNU Public License version 3.0. *)
8 (* *)
4ca3c23 @samoht Remove TypeRex from headers
samoht authored
9 (* OPAM is distributed in the hope that it will be useful, *)
2ea5d1d @samoht Solver clean-ups
samoht authored
10 (* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
11 (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
12 (* GNU General Public License for more details. *)
13 (* *)
14 (***********************************************************************)
15
aa67aa9 @samoht Big refactoring work.
samoht authored
16 open OpamMisc.OP
17
18 type relop = [`Eq|`Geq|`Gt|`Leq|`Lt]
19
20 module Compiler = struct
21
22 include OpamMisc.Base
23
247d8aa @samoht Use any kind of formula for compiler constraints
samoht authored
24 type constr = (relop * t) OpamFormula.formula
aa67aa9 @samoht Big refactoring work.
samoht authored
25
26 let current () =
27 match OpamSystem.ocaml_version () with
28 | None -> None
29 | Some o -> Some (of_string o)
30
31 let compare v1 r v2 =
32 let v1 = to_string v1 in
33 let v2 = to_string v2 in
34 match r with
35 | `Eq -> Debian.Version.equal v1 v2
36 | `Geq -> Debian.Version.compare v1 v2 >= 0
37 | `Gt -> Debian.Version.compare v1 v2 > 0
38 | `Leq -> Debian.Version.compare v1 v2 <= 0
39 | `Lt -> Debian.Version.compare v1 v2 < 0
40
41 let list t =
42 if OpamFilename.exists_dir t then (
43 let files = OpamFilename.list_files t in
44 let files = List.filter (fun f -> OpamFilename.check_suffix f ".comp") files in
45 let l =
46 List.map
47 (OpamFilename.chop_extension
48 |> OpamFilename.basename
49 |> OpamFilename.Base.to_string
50 |> of_string)
51 files in
52 Set.of_list l
53 ) else
54 Set.empty
2ea5d1d @samoht Solver clean-ups
samoht authored
55
56 end
57
aa67aa9 @samoht Big refactoring work.
samoht authored
58 module OPAM = OpamMisc.Base
Something went wrong with that request. Please try again.