aboutsummaryrefslogtreecommitdiffstats
path: root/build/platform/python
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /build/platform/python
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'build/platform/python')
-rw-r--r--build/platform/python/ldflags/ya.make17
-rw-r--r--build/platform/python/python27/ya.make22
-rw-r--r--build/platform/python/python310/ya.make30
-rw-r--r--build/platform/python/python34/ya.make18
-rw-r--r--build/platform/python/python35/ya.make18
-rw-r--r--build/platform/python/python36/ya.make18
-rw-r--r--build/platform/python/python37/ya.make18
-rw-r--r--build/platform/python/python38/ya.make23
-rw-r--r--build/platform/python/python39/ya.make22
-rw-r--r--build/platform/python/readme.md83
-rw-r--r--build/platform/python/resources.inc32
-rw-r--r--build/platform/python/tests/test_common.py31
-rw-r--r--build/platform/python/tests/testlib.py21
-rw-r--r--build/platform/python/tests/ya.make36
-rw-r--r--build/platform/python/ya.make136
-rw-r--r--build/platform/python/ymake_python3/ya.make33
16 files changed, 558 insertions, 0 deletions
diff --git a/build/platform/python/ldflags/ya.make b/build/platform/python/ldflags/ya.make
new file mode 100644
index 0000000000..d81ec31876
--- /dev/null
+++ b/build/platform/python/ldflags/ya.make
@@ -0,0 +1,17 @@
+RESOURCES_LIBRARY()
+
+OWNER(g:contrib)
+
+IF (USE_SYSTEM_PYTHON)
+ IF (OS_LINUX)
+ LDFLAGS("-L$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/lib/x86_64-linux-gnu -lpython${PY_VERSION}")
+ ELSEIF (OS_DARWIN)
+ LDFLAGS("-L$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/Python.framework/Versions/${PY_FRAMEWORK_VERSION}/lib -lpython${PY_VERSION}")
+ ELSEIF (OS_WINDOWS)
+ LDFLAGS("/LIBPATH:$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/libs")
+ ENDIF()
+ELSEIF (NOT USE_ARCADIA_PYTHON)
+ LDFLAGS($PYTHON_LDFLAGS $PYTHON_LIBRARIES)
+ENDIF()
+
+END()
diff --git a/build/platform/python/python27/ya.make b/build/platform/python/python27/ya.make
new file mode 100644
index 0000000000..35d2ef8405
--- /dev/null
+++ b/build/platform/python/python27/ya.make
@@ -0,0 +1,22 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+IF (OS_LINUX)
+ IF (ARCH_ARM64 OR ARCH_AARCH64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON27 ${PYTHON27_LINUX_ARM64})
+ ELSE()
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON27 ${PYTHON27_LINUX})
+ ENDIF()
+ELSEIF (OS_DARWIN)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON27 ${PYTHON27_DARWIN})
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON27 ${PYTHON27_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/python310/ya.make b/build/platform/python/python310/ya.make
new file mode 100644
index 0000000000..fea3696e6d
--- /dev/null
+++ b/build/platform/python/python310/ya.make
@@ -0,0 +1,30 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE(
+ PYTHON310
+ ${PYTHON310_DARWIN} FOR DARWIN
+ ${PYTHON310_DARWIN_ARM64} FOR DARWIN-ARM64
+ ${PYTHON310_LINUX} FOR LINUX
+ ${PYTHON310_WINDOWS} FOR WIN32
+)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON310 ${PYTHON310_LINUX})
+ELSEIF (OS_DARWIN)
+ IF (ARCH_ARM64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON310 ${PYTHON310_DARWIN_ARM64})
+ ELSEIF(ARCH_X86_64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON310 ${PYTHON310_DARWIN})
+ ENDIF()
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON310 ${PYTHON310_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/python34/ya.make b/build/platform/python/python34/ya.make
new file mode 100644
index 0000000000..61be788bec
--- /dev/null
+++ b/build/platform/python/python34/ya.make
@@ -0,0 +1,18 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON34 ${PYTHON34_LINUX})
+ELSEIF (OS_DARWIN)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON34 ${PYTHON34_DARWIN})
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON34 ${PYTHON34_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/python35/ya.make b/build/platform/python/python35/ya.make
new file mode 100644
index 0000000000..7a6292efa0
--- /dev/null
+++ b/build/platform/python/python35/ya.make
@@ -0,0 +1,18 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON35 ${PYTHON35_LINUX})
+ELSEIF (OS_DARWIN)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON35 ${PYTHON35_DARWIN})
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON35 ${PYTHON35_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/python36/ya.make b/build/platform/python/python36/ya.make
new file mode 100644
index 0000000000..c9dcf5d88b
--- /dev/null
+++ b/build/platform/python/python36/ya.make
@@ -0,0 +1,18 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON36 ${PYTHON36_LINUX})
+ELSEIF (OS_DARWIN)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON36 ${PYTHON36_DARWIN})
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON36 ${PYTHON36_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/python37/ya.make b/build/platform/python/python37/ya.make
new file mode 100644
index 0000000000..724c3f5b76
--- /dev/null
+++ b/build/platform/python/python37/ya.make
@@ -0,0 +1,18 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON37 ${PYTHON37_LINUX})
+ELSEIF (OS_DARWIN)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON37 ${PYTHON37_DARWIN})
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON37 ${PYTHON37_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/python38/ya.make b/build/platform/python/python38/ya.make
new file mode 100644
index 0000000000..b6820ca6ca
--- /dev/null
+++ b/build/platform/python/python38/ya.make
@@ -0,0 +1,23 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON38 ${PYTHON38_LINUX})
+ELSEIF (OS_DARWIN)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON38 ${PYTHON38_DARWIN})
+ IF (ARCH_ARM64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON38 ${PYTHON38_DARWIN_ARM64})
+ ELSEIF(ARCH_X86_64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON38 ${PYTHON38_DARWIN})
+ ENDIF()
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON38 ${PYTHON38_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/python39/ya.make b/build/platform/python/python39/ya.make
new file mode 100644
index 0000000000..2579542d1e
--- /dev/null
+++ b/build/platform/python/python39/ya.make
@@ -0,0 +1,22 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/platform/python/resources.inc)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON39 ${PYTHON39_LINUX})
+ELSEIF (OS_DARWIN)
+ IF (ARCH_ARM64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON39 ${PYTHON39_DARWIN_ARM64})
+ ELSEIF(ARCH_X86_64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON39 ${PYTHON39_DARWIN})
+ ENDIF()
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON39 ${PYTHON39_WINDOWS})
+ENDIF()
+
+END()
diff --git a/build/platform/python/readme.md b/build/platform/python/readme.md
new file mode 100644
index 0000000000..1eaafad35b
--- /dev/null
+++ b/build/platform/python/readme.md
@@ -0,0 +1,83 @@
+# Инструкция по добавлению нового бандла с системным питоном
+
+## Майним бандлы системного питона
+Бандлы системного питон майнятся для трех платформ: linux, darwin, windows.
+Подставляем под PYTHON_VERSION - версию нужного питона
+### Linux
+
+1. Устанавливаем систему с версией ubuntu, из которой планируется брать системный питон. Здесь есть два варианта
+ 1. Если нужно собрать системный питон, который будет запускать тесты на дистбилде, то нужно использовать ubuntu такой же версии, что и на дистбилде.
+ Тут стоит учитывать, что на дистбилде может быть достаточно старая версия ubuntu, на котором не будет нужной версии питона.
+ 2. Выбрать ту версию ubuntu, в которой есть нужный питон
+2. `mkdir -p ~/work/packages`
+3. `cd ~/work/packages`
+4. майним deb-пакеты питона
+ 1. Майним системный питон для запуска на дистбилде:
+
+ apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances python{PYTHON_VERSION}-dev python{|3}-pkg-resources python{|3}-setuptools | grep "^\w" | sort -u)
+ rm libc6* libc-*
+
+ 2. Майним системный питон для сборки сошек:
+
+ apt download python{PYTHON_VERSION} python{PYTHON_VERSION}-dev python{PYTHON_VERSION}-minimal libpython{PYTHON_VERSION} libpython{PYTHON_VERSION}-dev libpython{PYTHON_VERSION}-stdlib libpython{PYTHON_VERSION}-minimal
+
+5. `cd ..`
+6. `for path in $(ls packages); do ar -xf packages/$path; tar -xf data.tar.xz; done;`
+7. `mv usr python`
+8. `tar -czf python{PYTHON_VERSION}_linux.tar.gz python`
+9. `ya upload python{PYTHON_VERSION}_linux.tar.gz -d "Ubuntu {UBUNTU_VERSION} x86_64 python{PYTHON_VERSION} installation" --do-not-remove`
+
+UBUNTU_VERSION - версия ubuntu, на которой майнился системный питон
+
+### Darwin
+1. Находим macbook.
+2. Все установленные питоны лежат в `/Library/Frameworks/Python.framework/Versions`
+3. Копируем `/Library/Frameworks/Python.framework` в директорию с именем `python`
+4. Чистим `python/Python.framework/Versions/` от ненужных питонов
+5. Проверяем, что симлинки указывают в правильные места
+ 1. `python/Python.framework/Versions/Current -> {PYTHON_VERSION}`
+ 2. `python/Python.framework/Headers -> Versions/Current/Headers`
+ 3. `python/Python.framework/Python -> Versions/Current/Python`
+ 4. `python/Python.framework/Resources -> Versions/Current/Resources`
+6. `tar -czf python{PYTHON_VERSION}_darwin.tar.gz python`
+7. `ya upload python{PYTHON_VERSION}_darwin.tar.gz -d "Darwin x86_64 python{PYTHON_VERSION} installation" --do-not-remove`
+
+Если нужного питона нет в системе, его нужно установить из `python.org`, его установку можно найти в стандартном месте.
+
+Если нужен питон из `brew`, его установку можно найти в `/usr/local/Cellar/python*/{python_version}/Frameworks/`,
+ а дальше следовать стандартной инструкции
+
+### Windows
+1. Находим машинку с windows
+2. Устанавливаем нужную версию питона из `python.org`
+3. Копируем содержимое установки питона в директорию `python`
+4. Пакуем директорию `python` в `python{PYTHON_VERSION}_windows.tar.gz`
+5. `ya upload python{PYTHON_VERSION}_windows.tar.gz -d "Windows x86_64 python{PYTHON_VERSION} installation" --do-not-remove`
+
+## Добавляем бандлы системного питона в сборку
+
+1. Конфигурация бандлов системных питонов находится здесь [build/platform/python](https://a.yandex-team.ru/arc/trunk/arcadia/build/platform/python)
+2. Добавляем сендбокс ресурсы собранных бандлов в файл [resources.inc](https://a.yandex-team.ru/arc/trunk/arcadia/build/platform/python/resources.inc)
+
+ SET(PYTHON38_LINUX sbr:1211259884)
+
+3. Добавляем служебные переменные `_SYSTEM_PYTHON*, PY_VERSION, PY_FRAMEWORK_VERSION` для системного питона, если их еще нет,
+в [ymake.core.conf](https://a.yandex-team.ru/arc/trunk/arcadia/build/ymake.core.conf?rev=7640792#L380) по аналогии.
+
+ "3.8" ? {
+ _SYSTEM_PYTHON38=yes
+ PY_VERSION=3.8
+ PY_FRAMEWORK_VERSION=3.8
+ }
+
+4. Добавляем ресурс в [build/platform/python/ya.make](https://a.yandex-team.ru/arc/trunk/arcadia/build/platform/python/ya.make)
+
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_LINUX})
+
+## Проверяем сборку
+1. Создаем тривиальный PY2MODULE с использование `c api` положенного питона, или находим подходящий в репозитории
+2. Собираем его:
+ 1. linux `ya make -DUSE_SYSTEM_PYTHON=3.8 --target-platform linux`
+ 2. darwin `ya make -DUSE_SYSTEM_PYTHON=3.8 --target-platform darwin`
+ 3. windows `ya make -DUSE_SYSTEM_PYTHON=3.8 --target-platform win`
+3. Проверяем, что получившиеся модули импортятся в питонах на соответсвующих системах
diff --git a/build/platform/python/resources.inc b/build/platform/python/resources.inc
new file mode 100644
index 0000000000..a730a5039b
--- /dev/null
+++ b/build/platform/python/resources.inc
@@ -0,0 +1,32 @@
+SET(PYTHON27_LINUX sbr:1666107838) # Different from others(compatible with running tests) DEVTOOLS-7424
+SET(PYTHON34_LINUX sbr:419260733)
+SET(PYTHON35_LINUX sbr:1658217692) # Different from others(compatible with running tests) DEVTOOLS-7424
+SET(PYTHON36_LINUX sbr:2569180519) # Different from others(compatible with running tests) DEVTOOLS-7424
+SET(PYTHON37_LINUX sbr:616675620)
+SET(PYTHON38_LINUX sbr:1211259884)
+SET(PYTHON39_LINUX sbr:2019057022)
+SET(PYTHON310_LINUX sbr:2505611617)
+
+SET(PYTHON27_LINUX_ARM64 sbr:2145006545)
+
+SET(PYTHON27_DARWIN sbr:426406952)
+SET(PYTHON34_DARWIN sbr:426379328)
+SET(PYTHON35_DARWIN sbr:426409804)
+SET(PYTHON36_DARWIN sbr:426412777)
+SET(PYTHON37_DARWIN sbr:616740054)
+SET(PYTHON38_DARWIN sbr:1211286783)
+SET(PYTHON39_DARWIN sbr:2046345566)
+SET(PYTHON310_DARWIN sbr:2505677448)
+
+SET(PYTHON38_DARWIN_ARM64 sbr:2577173323)
+SET(PYTHON39_DARWIN_ARM64 sbr:2533263197)
+SET(PYTHON310_DARWIN_ARM64 sbr:2577250782)
+
+SET(PYTHON27_WINDOWS sbr:629001312)
+SET(PYTHON34_WINDOWS sbr:419220860)
+SET(PYTHON35_WINDOWS sbr:410155020)
+SET(PYTHON36_WINDOWS sbr:410161131)
+SET(PYTHON37_WINDOWS sbr:629042628)
+SET(PYTHON38_WINDOWS sbr:1211466284)
+SET(PYTHON39_WINDOWS sbr:2018972280)
+SET(PYTHON310_WINDOWS sbr:2506068927)
diff --git a/build/platform/python/tests/test_common.py b/build/platform/python/tests/test_common.py
new file mode 100644
index 0000000000..7a685330ea
--- /dev/null
+++ b/build/platform/python/tests/test_common.py
@@ -0,0 +1,31 @@
+import subprocess
+
+import pytest
+
+from build.platform.python.tests import testlib
+
+PYTHON_VERSIONS = ["2.7", "3.4", "3.5", "3.6"] # 3.7, 3.8 are not runnable
+
+
+@pytest.mark.parametrize("pyver", PYTHON_VERSIONS)
+def test_version_matched(pyver):
+ testlib.check_python_version(pyver)
+
+
+@pytest.mark.parametrize("pyver", PYTHON_VERSIONS)
+def test_python_max_unicode_bytes(pyver):
+ cmd = [testlib.get_python_bin(pyver), '-c', 'import sys; print(sys.maxunicode)']
+ maxunicode = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8')
+ assert int(maxunicode) > 65535, "Found UCS2 build"
+
+
+@pytest.mark.parametrize("pyver", PYTHON_VERSIONS)
+def test_python_imports(pyver):
+ imports = {
+ "2.7": ['pkg_resources'],
+ "3.4": [],
+ "3.5": ['pkg_resources'],
+ "3.6": [],
+ }
+ for imp in imports[pyver]:
+ subprocess.check_call([testlib.get_python_bin(pyver), '-c', 'import ' + imp])
diff --git a/build/platform/python/tests/testlib.py b/build/platform/python/tests/testlib.py
new file mode 100644
index 0000000000..d12f2815d4
--- /dev/null
+++ b/build/platform/python/tests/testlib.py
@@ -0,0 +1,21 @@
+import os
+import subprocess
+
+import yatest.common
+
+
+def get_python_bin(ver):
+ res_name = 'EXTERNAL_PYTHON{}_RESOURCE_GLOBAL'.format(ver.replace('.', ''))
+ gr = yatest.common.global_resources()
+ if res_name in gr:
+ bindir = os.path.join(gr[res_name], 'python', 'bin')
+ if ('python' + ver) in os.listdir(bindir):
+ return os.path.join(bindir, 'python' + ver)
+ return os.path.join(bindir, 'python')
+
+ raise AssertionError("Resource '{}' is not available: {}".format(res_name, gr))
+
+
+def check_python_version(version):
+ ver = subprocess.check_output([get_python_bin(version), '-V'], stderr=subprocess.STDOUT).decode('utf-8')
+ assert version in ver
diff --git a/build/platform/python/tests/ya.make b/build/platform/python/tests/ya.make
new file mode 100644
index 0000000000..0d8965240e
--- /dev/null
+++ b/build/platform/python/tests/ya.make
@@ -0,0 +1,36 @@
+PY3TEST()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+IF (OS_DARWIN)
+ SIZE(LARGE)
+
+ TAG(
+ ya:fat
+ ya:force_sandbox ya:exotic_platform
+ )
+ENDIF()
+
+PY_SRCS(
+ testlib.py
+)
+
+TEST_SRCS(
+ test_common.py
+)
+
+PEERDIR(
+ build/platform/python/python27
+ build/platform/python/python34
+ build/platform/python/python35
+ build/platform/python/python36
+ build/platform/python/python37
+ build/platform/python/python38
+ build/platform/python/python39
+ build/platform/python/python310
+)
+
+END()
diff --git a/build/platform/python/ya.make b/build/platform/python/ya.make
new file mode 100644
index 0000000000..247e65f4c9
--- /dev/null
+++ b/build/platform/python/ya.make
@@ -0,0 +1,136 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:contrib
+ g:yatool
+)
+
+INCLUDE(resources.inc)
+
+IF (USE_SYSTEM_PYTHON)
+ IF (OS_LINUX)
+ IF (ARCH_ARM64 OR ARCH_AARCH64)
+ IF (_SYSTEM_PYTHON27)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_LINUX_ARM64})
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ELSEIF (ARCH_X86_64)
+ IF (_SYSTEM_PYTHON27)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_LINUX})
+ ELSEIF (_SYSTEM_PYTHON34)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON34_LINUX})
+ ELSEIF (_SYSTEM_PYTHON35)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON35_LINUX})
+ ELSEIF (_SYSTEM_PYTHON36)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON36_LINUX})
+ ELSEIF (_SYSTEM_PYTHON37)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON37_LINUX})
+ ELSEIF (_SYSTEM_PYTHON38)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_LINUX})
+ ELSEIF (_SYSTEM_PYTHON39)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_LINUX})
+ ELSEIF (_SYSTEM_PYTHON310)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_LINUX})
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ CFLAGS(
+ GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include"
+ GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include/python${PY_VERSION}"
+ )
+ ELSEIF (OS_DARWIN)
+ IF (PYTHON_DISTR == "macos-brew")
+ IF (ARCH_X86_64)
+ IF (_SYSTEM_PYTHON27)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON sbr:562720527)
+ ELSEIF (_SYSTEM_PYTHON36)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON sbr:562721643)
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ELSE()
+ IF (ARCH_X86_64)
+ IF (_SYSTEM_PYTHON27)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_DARWIN})
+ ELSEIF (_SYSTEM_PYTHON34)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON34_DARWIN})
+ ELSEIF (_SYSTEM_PYTHON35)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON35_DARWIN})
+ ELSEIF (_SYSTEM_PYTHON36)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON36_DARWIN})
+ ELSEIF (_SYSTEM_PYTHON37)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON37_DARWIN})
+ ELSEIF (_SYSTEM_PYTHON38)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_DARWIN})
+ ELSEIF (_SYSTEM_PYTHON39)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_DARWIN})
+ ELSEIF (_SYSTEM_PYTHON310)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_DARWIN})
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ELSEIF(ARCH_ARM64)
+ IF (_SYSTEM_PYTHON38)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_DARWIN_ARM64})
+ ELSEIF(_SYSTEM_PYTHON39)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_DARWIN_ARM64})
+ ELSEIF(_SYSTEM_PYTHON310)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_DARWIN_ARM64})
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ENDIF()
+ CFLAGS(GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/Python.framework/Versions/${PY_FRAMEWORK_VERSION}/include/python${PY_VERSION}")
+ ELSEIF (OS_WINDOWS)
+ IF (ARCH_X86_64)
+ IF (_SYSTEM_PYTHON27)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_WINDOWS})
+ ELSEIF (_SYSTEM_PYTHON34)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON34_WINDOWS})
+ ELSEIF (_SYSTEM_PYTHON35)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON35_WINDOWS})
+ ELSEIF (_SYSTEM_PYTHON36)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON36_WINDOWS})
+ ELSEIF (_SYSTEM_PYTHON37)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON37_WINDOWS})
+ ELSEIF (_SYSTEM_PYTHON38)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_WINDOWS})
+ ELSEIF (_SYSTEM_PYTHON39)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_WINDOWS})
+ ELSEIF (_SYSTEM_PYTHON310)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_WINDOWS})
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ ELSE()
+ ENABLE(PYTHON_NOT_FOUND)
+ ENDIF()
+ CFLAGS(GLOBAL "/I$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include")
+ LDFLAGS("/LIBPATH:$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/libs")
+ ENDIF()
+
+ IF (PYTHON_NOT_FOUND)
+ MESSAGE(FATAL_ERROR "No system Python ${USE_SYSTEM_PYTHON} for the selected platform")
+ ENDIF()
+ELSEIF (NOT USE_ARCADIA_PYTHON)
+ CFLAGS(GLOBAL $PYTHON_FLAGS)
+ IF (OS_WINDOWS)
+ LDFLAGS($PYTHON_LDFLAGS $PYTHON_LIBRARIES)
+ ENDIF()
+ENDIF()
+
+END()
+
+RECURSE_FOR_TESTS(
+ tests
+)
diff --git a/build/platform/python/ymake_python3/ya.make b/build/platform/python/ymake_python3/ya.make
new file mode 100644
index 0000000000..c781448641
--- /dev/null
+++ b/build/platform/python/ymake_python3/ya.make
@@ -0,0 +1,33 @@
+RESOURCES_LIBRARY()
+
+OWNER(
+ g:arcadia-devtools
+ g:yatool
+)
+
+SET(YMAKE_PYTHON3_LINUX sbr:2693706966)
+SET(YMAKE_PYTHON3_DARWIN sbr:2693705780)
+SET(YMAKE_PYTHON3_DARWIN_ARM64 sbr:2693704462)
+SET(YMAKE_PYTHON3_WINDOWS sbr:2693706398)
+
+DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE(
+ YMAKE_PYTHON3
+ ${YMAKE_PYTHON3_DARWIN} FOR DARWIN
+ ${YMAKE_PYTHON3_DARWIN_ARM64} FOR DARWIN-ARM64
+ ${YMAKE_PYTHON3_LINUX} FOR LINUX
+ ${YMAKE_PYTHON3_WINDOWS} FOR WIN32
+)
+
+IF (OS_LINUX)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_YMAKE_PYTHON3 ${YMAKE_PYTHON3_LINUX})
+ELSEIF (OS_DARWIN)
+ IF (ARCH_ARM64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_YMAKE_PYTHON3 ${YMAKE_PYTHON3_DARWIN_ARM64})
+ ELSEIF(ARCH_X86_64)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_YMAKE_PYTHON3 ${YMAKE_PYTHON3_DARWIN})
+ ENDIF()
+ELSEIF (OS_WINDOWS)
+ DECLARE_EXTERNAL_RESOURCE(EXTERNAL_YMAKE_PYTHON3 ${YMAKE_PYTHON3_WINDOWS})
+ENDIF()
+
+END()