Skip to content

Commit 711db21

Browse files
authored
Merge pull request #11 from fable-compiler/feature/sys
Added sys module (partly)
2 parents 35aac3a + ebfac45 commit 711db21

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

src/Fable.Python.fsproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
<Compile Include="stdlib/Ast.fs" />
1313
<Compile Include="stdlib/Builtins.fs" />
1414
<Compile Include="stdlib/Json.fs" />
15+
<Compile Include="stdlib/Math.fs" />
1516
<Compile Include="stdlib/Os.fs" />
16-
<Compile Include="stdlib/TkInter.fs" />
1717
<Compile Include="stdlib/Queue.fs" />
18-
<Compile Include="stdlib/Math.fs" />
18+
<Compile Include="stdlib/Sys.fs" />
19+
<Compile Include="stdlib/Time.fs" />
20+
<Compile Include="stdlib/TkInter.fs" />
1921

2022
<Compile Include="cognite-sdk/CogniteSdk.fs" />
2123
<Compile Include="flask/Flask.fs" />

src/stdlib/Os.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
module Fable.Python.Os
22

3+
open System.Collections.Generic
34
open Fable.Core
45

56
// fsharplint:disable MemberNames
67

78
type IExports =
9+
abstract chdir : string -> unit
10+
abstract chroot : string -> unit
11+
abstract close : fd: int -> unit
12+
abstract environ : Dictionary<string, string>
13+
abstract getcwd : unit -> string
814
abstract getenv : key: string -> string option
915
abstract getenv : key: string * ``default``: string -> string
16+
abstract kill : pid: int * ``sig``: int -> unit
1017
abstract putenv : key: string * value: string -> unit
1118

1219

20+
/// Miscellaneous operating system interfaces
1321
[<ImportAll("os")>]
1422
let os: IExports = nativeOnly

src/stdlib/Sys.fs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module Fable.Python.Sys
2+
3+
open Fable.Core
4+
5+
// fsharplint:disable MemberNames
6+
7+
[<StringEnum>]
8+
type ByteOrder =
9+
| Little
10+
| Big
11+
12+
type VersionInfo =
13+
abstract major : int
14+
abstract minor: int
15+
abstract micro: int
16+
abstract releaselevel: string
17+
abstract serial: int
18+
19+
type IExports =
20+
abstract argv : string array
21+
abstract byteorder: ByteOrder
22+
abstract hexversion: int
23+
abstract maxsize: int
24+
abstract maxunicode: int
25+
abstract path : string array
26+
abstract platform : string
27+
abstract prefix: string
28+
abstract version: string
29+
abstract version_info: VersionInfo
30+
31+
/// System-specific parameters and functions
32+
[<ImportAll("sys")>]
33+
let sys: IExports = nativeOnly

src/stdlib/Time.fs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module Fable.Python.Time
2+
3+
open Fable.Core
4+
5+
// fsharplint:disable MemberNames
6+
7+
type IExports =
8+
abstract altzone : int
9+
abstract ctime : unit -> string
10+
abstract ctime : float -> string
11+
abstract daylight : int
12+
abstract monotonic : unit -> float
13+
abstract perf_counter : unit -> float
14+
abstract process_time : unit -> float
15+
abstract sleep : secs: float -> unit
16+
abstract time : unit -> float
17+
abstract timezone : int
18+
abstract tzname : string * string
19+
20+
/// Time access and conversions
21+
[<ImportAll("time")>]
22+
let time: IExports = nativeOnly

0 commit comments

Comments
 (0)