File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ This swift package enables you to use python modules in your iOS apps.
10
10
11
11
## Usage
12
12
13
- Use https://github.com/kewlbear/PythonKit .
13
+ See https://github.com/kewlbear/PythonPlayground .
14
14
15
15
## Credits
16
16
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import Symbols
27
27
28
28
public let libURL = Bundle . module. url ( forResource: " lib " , withExtension: nil )
29
29
30
+ /// Initialize Python runtime
30
31
public func Init( ) {
31
32
setenv ( " PYTHONOPTIMIZE " , " 1 " , 1 )
32
33
setenv ( " PYTHONDONTWRITEBYTECODE " , " 1 " , 1 )
@@ -38,13 +39,19 @@ public func Init() {
38
39
FileManager . default. urls ( for: . documentDirectory, in: . userDomainMask) [ 0 ] . path,
39
40
1 )
40
41
41
- setenv ( " TMP " , NSTemporaryDirectory ( ) , 1 )
42
+ SetTMP ( )
42
43
43
44
Py_Initialize ( )
44
45
}
45
46
47
+ /// Set Python Home to enable finding basic Python modules
46
48
public func SetPythonHome( ) {
47
49
let pythonHome = Bundle . module. bundleURL. path
48
50
let wHome = Py_DecodeLocale ( pythonHome, nil )
49
51
Py_SetPythonHome ( wHome)
50
52
}
53
+
54
+ /// Set directory path for temporary files
55
+ public func SetTMP( ) {
56
+ setenv ( " TMP " , NSTemporaryDirectory ( ) , 1 )
57
+ }
Original file line number Diff line number Diff line change 63
63
}
64
64
65
65
void *symbol = [(NSValue *) symbols[[NSString stringWithUTF8String: name]] pointerValue ];
66
- NSLog (@" %s : %s " , __func__, name);
66
+ // NSLog(@"%s: %s", __func__, name);
67
67
assert (symbol);
68
68
return symbol;
69
69
}
You can’t perform that action at this time.
0 commit comments