From 2dd4d4dcf872d98464eabb95983d31d5e73e0129 Mon Sep 17 00:00:00 2001 From: Ivan Manov Date: Wed, 19 Feb 2020 14:59:04 +0300 Subject: [PATCH 1/2] Custom library path --- PythonKit/PythonLibrary.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PythonKit/PythonLibrary.swift b/PythonKit/PythonLibrary.swift index 6f81b9c..92343fc 100644 --- a/PythonKit/PythonLibrary.swift +++ b/PythonKit/PythonLibrary.swift @@ -96,6 +96,17 @@ public extension PythonLibrary { } } +// Methods of `PythonLibrary` required to set a given Python location. +public extension PythonLibrary { + static func useLibrary(_ path: String) { + precondition(librarySymbolsLoaded, """ + Error: \(#function) should not be called before any Python library \ + has already been loaded. + """) + PythonLibrary.Environment.library.set(path) + } +} + // `PythonVersion` struct that defines a given Python version. private extension PythonLibrary { struct PythonVersion { From f7d8811c123b3e96357f970315c4fc0fd490750f Mon Sep 17 00:00:00 2001 From: Ivan Manov Date: Wed, 19 Feb 2020 15:03:53 +0300 Subject: [PATCH 2/2] Update PythonLibrary.swift --- PythonKit/PythonLibrary.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/PythonKit/PythonLibrary.swift b/PythonKit/PythonLibrary.swift index 92343fc..b8d52f8 100644 --- a/PythonKit/PythonLibrary.swift +++ b/PythonKit/PythonLibrary.swift @@ -99,10 +99,6 @@ public extension PythonLibrary { // Methods of `PythonLibrary` required to set a given Python location. public extension PythonLibrary { static func useLibrary(_ path: String) { - precondition(librarySymbolsLoaded, """ - Error: \(#function) should not be called before any Python library \ - has already been loaded. - """) PythonLibrary.Environment.library.set(path) } }