From 4faec88a9b3e9d6695d262433eb778c7131148f4 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Mon, 25 Oct 2021 21:00:50 +0200 Subject: [PATCH 1/4] Added sys module (partly) --- src/Fable.Python.fsproj | 5 +++-- src/stdlib/Os.fs | 3 +++ src/stdlib/Sys.fs | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/stdlib/Sys.fs diff --git a/src/Fable.Python.fsproj b/src/Fable.Python.fsproj index 213a444..a39da9f 100644 --- a/src/Fable.Python.fsproj +++ b/src/Fable.Python.fsproj @@ -12,10 +12,11 @@ + - - + + diff --git a/src/stdlib/Os.fs b/src/stdlib/Os.fs index 70133d5..9cf6735 100644 --- a/src/stdlib/Os.fs +++ b/src/stdlib/Os.fs @@ -1,14 +1,17 @@ module Fable.Python.Os +open System.Collections.Generic open Fable.Core // fsharplint:disable MemberNames type IExports = + abstract environ : Dictionary abstract getenv : key: string -> string option abstract getenv : key: string * ``default``: string -> string abstract putenv : key: string * value: string -> unit +/// Miscellaneous operating system interfaces [] let os: IExports = nativeOnly diff --git a/src/stdlib/Sys.fs b/src/stdlib/Sys.fs new file mode 100644 index 0000000..36c16cb --- /dev/null +++ b/src/stdlib/Sys.fs @@ -0,0 +1,33 @@ +module Fable.Python.Sys + +open Fable.Core + +// fsharplint:disable MemberNames + +[] +type ByteOrder = + | Little + | Big + +type VersionInfo = + abstract major : int + abstract minor: int + abstract micro: int + abstract releaselevel: string + abstract serial: int + +type IExports = + abstract argv : string array + abstract byteorder: ByteOrder + abstract hexversion: int + abstract maxsize: int + abstract maxunicode: int + abstract path : string array + abstract platform : string + abstract prefix: string + abstract version: string + abstract version_info: VersionInfo + +/// System-specific parameters and functions +[] +let sys: IExports = nativeOnly From b5070df1f637549e7fab05174e4f8c9856c690a2 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Mon, 25 Oct 2021 21:09:54 +0200 Subject: [PATCH 2/4] Update for os --- src/stdlib/Os.fs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stdlib/Os.fs b/src/stdlib/Os.fs index 9cf6735..1e14d6c 100644 --- a/src/stdlib/Os.fs +++ b/src/stdlib/Os.fs @@ -6,9 +6,14 @@ open Fable.Core // fsharplint:disable MemberNames type IExports = + abstract chdir : string -> unit + abstract chroot : string -> unit + abstract close : fd: int -> unit abstract environ : Dictionary + abstract getcwd : unit -> string abstract getenv : key: string -> string option abstract getenv : key: string * ``default``: string -> string + abstract kill : pid: int * ``sig``: int -> unit abstract putenv : key: string * value: string -> unit From c8c7502b67c6fd783e06c85ad9d96a86911b99d6 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Mon, 25 Oct 2021 21:20:44 +0200 Subject: [PATCH 3/4] Add some time functions --- src/Fable.Python.fsproj | 1 + src/stdlib/Time.fs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/stdlib/Time.fs diff --git a/src/Fable.Python.fsproj b/src/Fable.Python.fsproj index a39da9f..a1e41a5 100644 --- a/src/Fable.Python.fsproj +++ b/src/Fable.Python.fsproj @@ -16,6 +16,7 @@ + diff --git a/src/stdlib/Time.fs b/src/stdlib/Time.fs new file mode 100644 index 0000000..f28e09c --- /dev/null +++ b/src/stdlib/Time.fs @@ -0,0 +1,22 @@ +module Fable.Python.Time + +open Fable.Core + +// fsharplint:disable MemberNames + +type IExports = + abstract altzone : int + abstract ctime : unit -> string + abstract ctime : float -> string + abstract dayligth : int + abstract monotonic : unit -> float + abstract perf_counter : unit -> float + abstract process_time : unit -> float + abstract sleep : secs: float -> unit + abstract time : unit -> float + abstract timezone : int + abstract tzname : string * string + +/// Time access and conversions +[] +let time: IExports = nativeOnly From ebfac457fbea95ed9e14d73e0caede5ac52a82c8 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Mon, 25 Oct 2021 21:24:45 +0200 Subject: [PATCH 4/4] Fix typo --- src/stdlib/Time.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdlib/Time.fs b/src/stdlib/Time.fs index f28e09c..e682a1b 100644 --- a/src/stdlib/Time.fs +++ b/src/stdlib/Time.fs @@ -8,7 +8,7 @@ type IExports = abstract altzone : int abstract ctime : unit -> string abstract ctime : float -> string - abstract dayligth : int + abstract daylight : int abstract monotonic : unit -> float abstract perf_counter : unit -> float abstract process_time : unit -> float