aboutsummaryrefslogtreecommitdiffstats
path: root/build/platform/python
diff options
context:
space:
mode:
authormonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
committermonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
commit06e5c21a835c0e923506c4ff27929f34e00761c2 (patch)
tree75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /build/platform/python
parent03f024c4412e3aa613bb543cf1660176320ba8f4 (diff)
downloadydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz
fix ya.make
Diffstat (limited to 'build/platform/python')
-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
4 files changed, 0 insertions, 167 deletions
diff --git a/build/platform/python/readme.md b/build/platform/python/readme.md
deleted file mode 100644
index feb5315cf06..00000000000
--- a/build/platform/python/readme.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# Инструкция по добавлению нового бандла с системным питоном
-
-## Майним бандлы системного питона
-Бандлы системного питон майнятся для трех платформ: 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
deleted file mode 100644
index a730a5039bf..00000000000
--- a/build/platform/python/resources.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-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
deleted file mode 100644
index 7a685330ea7..00000000000
--- a/build/platform/python/tests/test_common.py
+++ /dev/null
@@ -1,31 +0,0 @@
-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
deleted file mode 100644
index d12f2815d48..00000000000
--- a/build/platform/python/tests/testlib.py
+++ /dev/null
@@ -1,21 +0,0 @@
-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