Skip to content

Added support for loading Python at runtime (supports both Python 3 and 2) #20674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ if(SWIFT_BUILD_STDLIB)
endif()

# SWIFT_ENABLE_TENSORFLOW
find_package(PythonLibs 2.7 EXACT)
if(SWIFT_BUILD_STDLIB AND PYTHONLIBS_FOUND)
add_subdirectory(CPython)
if(SWIFT_BUILD_STDLIB)
add_subdirectory(Python)
endif()

Expand Down
73 changes: 0 additions & 73 deletions stdlib/public/CPython/CMakeLists.txt

This file was deleted.

162 changes: 0 additions & 162 deletions stdlib/public/CPython/module.modulemap

This file was deleted.

7 changes: 2 additions & 5 deletions stdlib/public/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#
#===----------------------------------------------------------------------===#

find_package(PythonLibs 2.7 EXACT REQUIRED)
message(STATUS "Building Python.")

set(SWIFT_PYTHON_EXISTS TRUE PARENT_SCOPE)

set(SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES)
Expand All @@ -29,9 +26,10 @@ endif()

add_swift_target_library(swiftPython ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
Python.swift
PythonLibrary.swift
PythonLibrary+Symbols.swift
NumpyConversion.swift

DEPENDS cpython_modulemap
TARGET_SDKS OSX CYGWIN FREEBSD LINUX HAIKU
SWIFT_MODULE_DEPENDS_IOS Darwin
SWIFT_MODULE_DEPENDS_OSX Darwin
Expand All @@ -42,5 +40,4 @@ add_swift_target_library(swiftPython ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS
SWIFT_MODULE_DEPENDS_CYGWIN Glibc
SWIFT_MODULE_DEPENDS_HAIKU Glibc
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
PRIVATE_LINK_LIBRARIES "${PYTHON_LIBRARIES}"
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
2 changes: 1 addition & 1 deletion stdlib/public/Python/NumpyConversion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down
Loading