- Update to version 3.0.0
See included CHANGES for details - Remove obsolete ocaml-calendar.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:ocaml/ocaml-calendar?expand=0&rev=30
This commit is contained in:
parent
89331f9920
commit
5857475372
7
_service
7
_service
@ -1,10 +1,13 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="disabled">
|
||||
<param name="filename">ocaml-calendar</param>
|
||||
<param name="revision">7f7ba9196f6018c8365ac5c6ef4a60891c4da761</param>
|
||||
<param name="revision">d2ad63325bca1ec98ff0d292183614924df2668c</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="submodules">disable</param>
|
||||
<param name="url">https://github.com/ocaml-community/calendar.git</param>
|
||||
<param name="versionformat">2.04</param>
|
||||
<param name="versionformat">@PARENT_TAG@</param>
|
||||
<param name="versionrewrite-pattern">[v]?([^+]+)(.*)</param>
|
||||
<param name="versionrewrite-replacement">\1</param>
|
||||
</service>
|
||||
<service name="recompress" mode="disabled">
|
||||
<param name="file">*.tar</param>
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b246712e6d024a5a1e1103c9d74ff498cf28d57b284292526e5dfabddec94905
|
||||
size 78452
|
BIN
ocaml-calendar-3.0.0.tar.xz
(Stored with Git LFS)
Normal file
BIN
ocaml-calendar-3.0.0.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Jan 1 01:01:01 UTC 2023 - ohering@suse.de
|
||||
|
||||
- Update to version 3.0.0
|
||||
See included CHANGES for details
|
||||
- Remove obsolete ocaml-calendar.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 21 21:21:21 UTC 2021 - ohering@suse.de
|
||||
|
||||
|
@ -1,232 +0,0 @@
|
||||
--- /dev/null
|
||||
+++ b/calendar.opam
|
||||
@@ -0,0 +1,25 @@
|
||||
+opam-version: "2.0"
|
||||
+version: "dev"
|
||||
+author: "Julien Signoles"
|
||||
+maintainer: "ocaml-community"
|
||||
+license: "LGPL-2.1 with OCaml linking exception"
|
||||
+synopsis: "Library for handling dates and times in your program"
|
||||
+build: [
|
||||
+ ["dune" "build" "-p" name]
|
||||
+ ["dune" "build" "@doc" "-p" name] {with-doc}
|
||||
+ ["dune" "runtest" "-p" name] {with-test}
|
||||
+]
|
||||
+depends: [
|
||||
+ "re"
|
||||
+ "dune" {build}
|
||||
+ "odoc" {with-doc}
|
||||
+ "alcotest" {with-test}
|
||||
+]
|
||||
+tags: [ "calendar" "date" "time" "datetime" ]
|
||||
+homepage: "https://github.com/ocaml-community/calendar"
|
||||
+doc: "https://ocaml-community.github.io/calendar/"
|
||||
+bug-reports: "https://github.com/ocaml-community/calendar/issues"
|
||||
+dev-repo: "git+https://github.com/ocaml-community/calendar"
|
||||
+description:"""
|
||||
+Calendar is a library for handling dates and times in your program.
|
||||
+"""
|
||||
--- /dev/null
|
||||
+++ b/dune-project
|
||||
@@ -0,0 +1 @@
|
||||
+(lang dune 1.0)
|
||||
--- a/src/date.ml
|
||||
+++ b/src/date.ml
|
||||
@@ -70,7 +70,7 @@ let hash = Utils.Int.hash
|
||||
(* Constructors. *)
|
||||
|
||||
let lt (d1 : int * int * int) (d2 : int * int * int) =
|
||||
- Pervasives.compare d1 d2 < 0
|
||||
+ Stdlib.compare d1 d2 < 0
|
||||
|
||||
(* [date_ok] returns [true] is the date belongs to the Julian period;
|
||||
[false] otherwise. *)
|
||||
@@ -249,10 +249,10 @@ module Period = struct
|
||||
let sub x y = { m = x.m - y.m; d = x.d - y.d }
|
||||
let opp x = { m = - x.m; d = - x.d }
|
||||
|
||||
- (* exactly equivalent to [Pervasives.compare] but more flexible typing *)
|
||||
+ (* exactly equivalent to [Stdlib.compare] but more flexible typing *)
|
||||
let compare x y =
|
||||
- let n = Pervasives.compare x.m y.m in
|
||||
- if n = 0 then Pervasives.compare x.d y.d else n
|
||||
+ let n = Stdlib.compare x.m y.m in
|
||||
+ if n = 0 then Stdlib.compare x.d y.d else n
|
||||
let equal x y = compare x y = 0
|
||||
let hash = Hashtbl.hash
|
||||
|
||||
@@ -337,7 +337,7 @@ let weeks_in_year y =
|
||||
| _ -> 52
|
||||
|
||||
let week_first_last w y =
|
||||
- let d = make y 1 1 in
|
||||
+ let d = make y 1 4 in (* January 4th must be in the first week (ISO 8601) *)
|
||||
let d = d - d mod 7 in
|
||||
let b = d + 7 * (w - 1) in
|
||||
b, 6 + b
|
||||
--- /dev/null
|
||||
+++ b/src/dune
|
||||
@@ -0,0 +1,16 @@
|
||||
+(library
|
||||
+ (name calendarLib)
|
||||
+ (public_name calendar)
|
||||
+ (libraries re unix)
|
||||
+ (modules_without_implementation calendar_sig date_sig period time_sig)
|
||||
+ (flags :standard -warn-error -32 -safe-string))
|
||||
+
|
||||
+(rule
|
||||
+ (targets version.ml)
|
||||
+ (action
|
||||
+ (with-stdout-to %{targets}
|
||||
+ (progn
|
||||
+ (echo "let version = String.trim \"" %{version:calendar} "\"\n")
|
||||
+ (echo "let date = String.trim \"")
|
||||
+ (echo "\"\n")))))
|
||||
+
|
||||
--- a/src/printer.ml
|
||||
+++ b/src/printer.ml
|
||||
@@ -121,7 +121,7 @@ let gen_day_of_name f fmt name =
|
||||
let day_of_name = gen_day_of_name name_of_day "%a"
|
||||
let day_of_short_name = gen_day_of_name short_name_of_day "%A"
|
||||
|
||||
-let word_regexp = ref (Str.regexp "[a-zA-Z]+")
|
||||
+let word_regexp = ref (Re.Str.regexp "[a-zA-Z]+")
|
||||
|
||||
let set_word_regexp r = word_regexp := r
|
||||
|
||||
@@ -181,7 +181,7 @@ struct
|
||||
let print_int pad k n = print_number fmt pad k (Lazy.force n) in
|
||||
let print_string pad s =
|
||||
let pad s = match pad with
|
||||
- | Uppercase -> String.uppercase s
|
||||
+ | Uppercase -> String.uppercase_ascii s
|
||||
| Empty | Zero | Blank -> s
|
||||
in
|
||||
Format.pp_print_string fmt (pad (Lazy.force s))
|
||||
@@ -236,7 +236,7 @@ struct
|
||||
| 'n' -> print_char '\n'
|
||||
| 'p' -> print_string pad apm
|
||||
| 'P' ->
|
||||
- Format.pp_print_string fmt (String.lowercase (Lazy.force apm))
|
||||
+ Format.pp_print_string fmt (String.lowercase_ascii (Lazy.force apm))
|
||||
| 'r' ->
|
||||
print_time pad shour;
|
||||
print_char ' ';
|
||||
@@ -259,10 +259,10 @@ struct
|
||||
print_number fmt Zero 10 0
|
||||
| ':' ->
|
||||
let idx =
|
||||
- try Str.search_forward (Str.regexp "z\\|:z\\|::z") f (i+1)
|
||||
+ try Re.Str.search_forward (Re.Str.regexp "z\\|:z\\|::z") f (i+1)
|
||||
with Not_found -> bad_format f
|
||||
in
|
||||
- let next = Str.matched_string f in
|
||||
+ let next = Re.Str.matched_string f in
|
||||
if idx <> i+1 then bad_format f;
|
||||
if Lazy.force tz >= 0 then print_char '+';
|
||||
print_int pad 10 tz;
|
||||
@@ -352,15 +352,15 @@ struct
|
||||
in
|
||||
let read_word ?(regexp=(!word_regexp)) () =
|
||||
let jn =
|
||||
- try Str.search_forward regexp s !j with Not_found -> not_match f s
|
||||
+ try Re.Str.search_forward regexp s !j with Not_found -> not_match f s
|
||||
in
|
||||
if jn <> !j then not_match f s;
|
||||
- let w = Str.matched_string s in
|
||||
+ let w = Re.Str.matched_string s in
|
||||
j := jn + String.length w;
|
||||
w
|
||||
in
|
||||
let read_float =
|
||||
- let regexp = Str.regexp "[0-9][0-9]\\(\\.[0-9]*\\)?" in
|
||||
+ let regexp = Re.Str.regexp "[0-9][0-9]\\(\\.[0-9]*\\)?" in
|
||||
fun () ->
|
||||
try float_of_string (read_word ~regexp ())
|
||||
with Failure _ -> not_match f s
|
||||
@@ -390,7 +390,7 @@ struct
|
||||
let parse_y () = year := read_number 2 + 1900 in
|
||||
let parse_Y () = year := read_number 4 in
|
||||
let parse_tz () =
|
||||
- let sign = match read_word ~regexp:(Str.regexp "[\\+-]") () with
|
||||
+ let sign = match read_word ~regexp:(Re.Str.regexp "[\\+-]") () with
|
||||
| "+" -> -1
|
||||
| "-" -> 1
|
||||
| _ -> assert false
|
||||
--- a/src/printer.mli
|
||||
+++ b/src/printer.mli
|
||||
@@ -125,7 +125,7 @@ val short_name_of_month : Date.month ->
|
||||
[name_of_month d].
|
||||
Used by the specifier [%b]. *)
|
||||
|
||||
-val set_word_regexp: Str.regexp -> unit
|
||||
+val set_word_regexp: Re.Str.regexp -> unit
|
||||
(** Set the regular expression used to recognize words in
|
||||
[from_fstring]. Default is [[a-zA-Z]*].
|
||||
@since 1.10 *)
|
||||
--- a/src/time_Zone.ml
|
||||
+++ b/src/time_Zone.ml
|
||||
@@ -44,7 +44,6 @@ let gap_gmt_local =
|
||||
let current () = !tz
|
||||
|
||||
let change = function
|
||||
- | UTC_Plus x when out_of_bounds x -> invalid_arg "Not a valid time zone"
|
||||
| _ as t -> tz := t
|
||||
|
||||
let gap t1 t2 =
|
||||
--- a/src/utils.ml
|
||||
+++ b/src/utils.ml
|
||||
@@ -29,8 +29,8 @@ end
|
||||
|
||||
module Int = struct
|
||||
type t = int
|
||||
- let equal = Pervasives.(=)
|
||||
- let compare = Pervasives.compare
|
||||
+ let equal = Stdlib.(=)
|
||||
+ let compare = Stdlib.compare
|
||||
let hash = Hashtbl.hash
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ module Float = struct
|
||||
|
||||
type t = float
|
||||
|
||||
- let precision = ref 1e-3
|
||||
+ let precision = ref 1e-8
|
||||
|
||||
let set_precision f = precision := f
|
||||
|
||||
--- a/src/utils.mli
|
||||
+++ b/src/utils.mli
|
||||
@@ -58,8 +58,8 @@ module Float: sig
|
||||
val set_precision: float -> unit
|
||||
(** Set the precision of [equal] and [compare] for float.
|
||||
If the precision is [p], then the floats [x] and [y] are equal iff
|
||||
- [abs(x-y) < p]. By default, the precision is [1e-3] (that is one
|
||||
- millisecond if floats represents seconds). *)
|
||||
+ [abs(x-y) < p]. By default, the precision is [1e-8] (that is 0.864
|
||||
+ milliseconds if floats represent days). *)
|
||||
|
||||
val round: t -> int
|
||||
(** Round a float to the nearest integer. *)
|
||||
--- /dev/null
|
||||
+++ b/tests/dune
|
||||
@@ -0,0 +1,8 @@
|
||||
+(executable
|
||||
+ (name test)
|
||||
+ (libraries calendar))
|
||||
+
|
||||
+(alias
|
||||
+ (name runtest)
|
||||
+ (deps test.exe)
|
||||
+ (action (run ./test.exe -e)))
|
||||
--- a/tests/test_timezone.ml
|
||||
+++ b/tests/test_timezone.ml
|
||||
@@ -29,6 +29,7 @@ open Time_Zone;;
|
||||
include Gen_test;;
|
||||
reset ();;
|
||||
|
||||
+change UTC;;
|
||||
test (current () = UTC) "current () = UTC";;
|
||||
change Local;;
|
||||
test (current () = Local) "current () = Local";;
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ocaml-calendar
|
||||
#
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
%define pkg ocaml-calendar
|
||||
Name: %pkg%nsuffix
|
||||
Version: 2.04
|
||||
Version: 3.0.0
|
||||
Release: 0
|
||||
%{?ocaml_preserve_bytecode}
|
||||
Summary: Objective Caml library for managing dates and times
|
||||
@ -33,10 +33,9 @@ License: LGPL-2.0-only
|
||||
Group: Development/Languages/OCaml
|
||||
URL: https://opam.ocaml.org/packages/calendar
|
||||
Source0: %pkg-%version.tar.xz
|
||||
Patch0: ocaml-calendar.patch
|
||||
BuildRequires: ocaml
|
||||
BuildRequires: ocaml-dune
|
||||
BuildRequires: ocaml-rpm-macros >= 20210121
|
||||
BuildRequires: ocaml-rpm-macros >= 20220707
|
||||
%if 1
|
||||
BuildRequires: ocamlfind(re)
|
||||
BuildRequires: ocamlfind(unix)
|
||||
@ -44,6 +43,7 @@ BuildRequires: ocamlfind(unix)
|
||||
|
||||
%if "%build_flavor" == "testsuite"
|
||||
BuildRequires: ocamlfind(calendar)
|
||||
BuildRequires: ocamlfind(alcotest)
|
||||
%endif
|
||||
|
||||
%description
|
||||
|
Loading…
Reference in New Issue
Block a user