-
Notifications
You must be signed in to change notification settings - Fork 1
Код FET и скрипты компиляции и запуска #1
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
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,6 @@ | |||
from os import mkdir | |||
from subprocess import run | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subprocess плох в данном случае тем, что мы не сможем отслеживать процесс выполнения (пакет билдится в другом процессе)
Давай лучше просто использовать os.system()
Отсюда проблема, что неуспешный билд мы никак не сможем определить. Хочется, чтобы билд, который завершился не с кодом 0, выдавал ошибку
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Насколько я знаю, это можно сделать и с subprocess, чуть позже пофикшу. Просто в доках питона написано, что вместо os.system рекомендуется использовать subprocess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Окей, тут библиотека не сильно важна, сам привык через os.system делать - так код попроще выглядит
There was a problem hiding this comment.
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 | |||
|
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавь файл requirements.txt со всеми необходимыми библиотекам для запуска
Формат стандартный - по библиотеке в каждой строке
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так я кроме стандартной библиотеки вроде ничего и не использую. Или просто пустой файл добавить?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ага
И наверное скрипт с установкой qmake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
С этим сложнее, это ведь зависит от конкретного дистрибутива. Делать под убунту?
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add -j 8 too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь нет смысла, qmake просто генерирует файлы сборки (что происходит за секунду), он ничего не компилирует
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Когда пишешь программу с неочевидными аргументами, проще вначале в паре закомменченных строк расписать, как этим пользоваться
Посмотрел ещё раз на размеры: из ~250MB проекта, ~200MB - examples and translations folders давай удалим из них все ненужное (оставляем русский и английский) |
См. https://tracker.yandex.ru/TIMETABLEAPP-5