Skip to content

Commit

Permalink
Guard swift python import to apple devices.
Browse files Browse the repository at this point in the history
* this is because we ship python on apple devices ourselves,
  which allowed us to fix the python headers, to ensure no
  #include's happen within extern "C" blocks, this is all that's
  missing for Pyton to import into Swift on Linux platforms.
  • Loading branch information
furby-tm committed Aug 3, 2024
1 parent 997266e commit e5c91c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/MetaversalDemo/Creator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ import OpenVDB
#if !os(Windows)
import Ptex
#endif // !os(Windows)
#if canImport(Python)
#if canImport(Python) && (os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS))
import PyBundle
import Python
#endif // canImport(Python)
#endif // canImport(Python) && os(macOS)

/* --- xxx --- */

Expand Down Expand Up @@ -114,11 +114,11 @@ class Creator
{
let C: Creator

#if canImport(Python)
#if canImport(Python) && os(macOS)
/* embed & init python. */
PyBundler.shared.pyInit()
PyBundler.shared.pyInfo()
#endif /* canImport(Python) */
#endif // canImport(Python) && os(macOS)

C = Creator()

Expand Down

0 comments on commit e5c91c7

Please sign in to comment.