Skip to content

Conversation

elkcl
Copy link
Collaborator

@elkcl elkcl commented Apr 11, 2021

@@ -0,0 +1,6 @@
from os import mkdir
from subprocess import run

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subprocess плох в данном случае тем, что мы не сможем отслеживать процесс выполнения (пакет билдится в другом процессе)
Давай лучше просто использовать os.system()
Отсюда проблема, что неуспешный билд мы никак не сможем определить. Хочется, чтобы билд, который завершился не с кодом 0, выдавал ошибку

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Насколько я знаю, это можно сделать и с subprocess, чуть позже пофикшу. Просто в доках питона написано, что вместо os.system рекомендуется использовать subprocess.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Окей, тут библиотека не сильно важна, сам привык через os.system делать - так код попроще выглядит

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А что нам вообще нужно делать? То есть, на данный момент весь stdout make и так выводится в консоль. Что нужно делать в случае ошибки?

@@ -0,0 +1,5 @@
from sys import argv
from subprocess import run

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То же, что и для build.py - хочу понимать, если что-то пошло не так

from subprocess import run

mkdir('fet-build')
run(['qmake-qt5', '../fet-src/fet.pro', 'DEFINES+=USE_SYSTEM_LOCALE'], encoding='utf-8', cwd='fet-build')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавь файл requirements.txt со всеми необходимыми библиотекам для запуска
Формат стандартный - по библиотеке в каждой строке

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так я кроме стандартной библиотеки вроде ничего и не использую. Или просто пустой файл добавить?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ага
И наверное скрипт с установкой qmake

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С этим сложнее, это ведь зависит от конкретного дистрибутива. Делать под убунту?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, считай, что есть apt
Ещё у меня на убунте 20.04 билдится не qmake-qt5 а просто qmake - сейчас это править не надо, но на будущее стоит запомнить

from os import mkdir
from subprocess import run

mkdir('fet-build')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если папка уже существует, будет выдаваться ошибка. Самое простое - добавить try:

from subprocess import run

mkdir('fet-build')
run(['qmake-qt5', '../fet-src/fet.pro', 'DEFINES+=USE_SYSTEM_LOCALE'], encoding='utf-8', cwd='fet-build')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add -j 8 too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь нет смысла, qmake просто генерирует файлы сборки (что происходит за секунду), он ничего не компилирует

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK


mkdir('fet-build')
run(['qmake-qt5', '../fet-src/fet.pro', 'DEFINES+=USE_SYSTEM_LOCALE'], encoding='utf-8', cwd='fet-build')
run(['make', '-j8'], encoding='utf-8', cwd='fet-build')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-j is argument; 8 - it's value, space is needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну, в принципе, оно и без пробела работает, но ок, исправлю

@@ -0,0 +1,5 @@
from sys import argv
from subprocess import run

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Когда пишешь программу с неочевидными аргументами, проще вначале в паре закомменченных строк расписать, как этим пользоваться

@vekarpov
Copy link
Owner

Посмотрел ещё раз на размеры: из ~250MB проекта, ~200MB - examples and translations folders давай удалим из них все ненужное (оставляем русский и английский)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants