]> matita.cs.unibo.it Git - helm.git/blobdiff - components/library/librarian.ml
removed all Developments related stuff in glade file,
[helm.git] / components / library / librarian.ml
index 72f8c50db9fcfca38e13070a79271e26206bc771..9a16e814d56527354b66d4e8d5d5bdc6477795a3 100644 (file)
@@ -41,7 +41,7 @@ let load_root_file rootpath =
   List.map 
     (fun l -> 
       match Str.split (Str.regexp "=") l with
-      | [k;v] -> Pcre.replace ~pat:" " k, Pcre.replace ~pat:" " v
+      | [k;v] -> Pcre.replace ~pat:"^ *" k, Pcre.replace ~pat:" *$" v
       | _ -> raise (Failure ("Malformed root file: " ^ rootpath)))
     lines
 ;;
@@ -70,8 +70,8 @@ let find_root_for ~include_paths file =
      HLog.error (rootpath ^ " sets an incorrect baseuri: " ^ buri);
    ensure_trailing_slash root, remove_trailing_slash uri, path
  with Failure "find_in" -> 
-   HLog.error ("Unable to find: "^file^"\nPaths explored:\n");
-   List.iter (fun x -> HLog.error (" - "^x^"\n")) include_paths;
+   HLog.error ("Unable to find: "^file^"\nPaths explored:");
+   List.iter (fun x -> HLog.error (" - "^x)) include_paths;
    raise (NoRootFor file)
 ;;
 
@@ -118,7 +118,9 @@ let load_deps_file f =
       begin
         let l = input_line ic in
         match Str.split (Str.regexp " ") l with
-        | [] -> HLog.error ("malformed deps file: " ^ f); exit 1
+        | [] -> 
+            HLog.error ("Malformed deps file: " ^ f); 
+            raise (Failure ("Malformed deps file: " ^ f)) 
         | he::tl -> deps := (he,tl) :: !deps
       end
     done; !deps
@@ -241,7 +243,8 @@ module Make = functor (F:Format) -> struct
         let todo =
           let local, remote =
             List.partition
-              (fun (file,d) -> d<>[] || F.root_of local_options file = Some root)
+              (fun (file,d) -> 
+                d<>[] || F.root_of local_options file = Some root)
               todo
           in
           remote @ local
@@ -256,7 +259,7 @@ module Make = functor (F:Format) -> struct
               | Some froot ->
                   make froot [file]
               | None -> 
-                  HLog.error ("No root for: "^F.string_of_source_object file);            
+                  HLog.error ("No root for: "^F.string_of_source_object file);
                   false
             in
             if rc then (file::c,f)
@@ -287,9 +290,11 @@ module Make = functor (F:Format) -> struct
 end
   
 let write_deps_file root deps =
-  let oc = open_out "depends" in
-  List.iter (fun (t,d) -> output_string oc (t^" "^String.concat " " d^"\n")) deps;
+  let oc = open_out (root ^ "/depends") in
+  List.iter 
+    (fun (t,d) -> output_string oc (t^" "^String.concat " " d^"\n")) 
+    deps;
   close_out oc;
-  HLog.message ("Generated " ^ Sys.getcwd () ^ "/depends")
+  HLog.message ("Generated: " ^ root ^ "/depends")
 ;;