Skip to content
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

Args processing fix #47

Merged
merged 2 commits into from
Jul 9, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.11]
python-version: [3.8, 3.11, 3.12]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.5
0.2.6
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ authors = [{ name = "Flipper Devices Inc.", email = "[email protected]" }]
description = "uFBT - micro Flipper Build Tool. Tool for building and developing applications (.fap) for Flipper Zero and its device family."
readme = "README.md"
requires-python = ">=3.8"
dependencies = ["oslex>=0.1.3"]
keywords = ["ufbt", "flipperzero", "fbt", "stm32", "fap"]
license = { text = "GPL-3.0" }
classifiers = [
Expand All @@ -26,7 +27,6 @@ classifiers = [
"Operating System :: POSIX :: Linux",
]


[project.urls]
homepage = "https://github.com/flipperdevices/flipperzero-ufbt"
documentation = "https://github.com/flipperdevices/flipperzero-ufbt"
Expand Down
34 changes: 21 additions & 13 deletions ufbt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import pathlib
import platform
import sys
import oslex

from .bootstrap import (
DEFAULT_UFBT_HOME,
Expand Down Expand Up @@ -83,30 +84,37 @@ def ufbt_cli():
if not os.path.exists(ufbt_state_dir / "current"):
bootstrap_cli(["update"])

if not (ufbt_state_dir / "current" / "scripts" / "ufbt").exists():
if not (
ufbt_script_root := ufbt_state_dir / "current" / "scripts" / "ufbt"
).exists():
print("SDK is missing scripts distribution!")
print("You might be trying to use an SDK in an outdated format.")
print("Run `ufbt update -h` for more information on how to update.")
print("You can clean up current state with `ufbt clean --purge`.")
print("Run `ufbt update -h` for more information on SDK installation.")
return 1

UFBT_APP_DIR = os.getcwd()

if platform.system() == "Windows":
commandline = (
r'call "%UFBT_STATE_DIR%/current/scripts/toolchain/fbtenv.cmd" env & '
"python -m SCons -Q --warn=target-not-built "
r'-C "%UFBT_STATE_DIR%/current/scripts/ufbt" '
f'"UFBT_APP_DIR={UFBT_APP_DIR}" ' + " ".join(sys.argv[1:])
)

commandline = r'call "%UFBT_STATE_DIR%/current/scripts/toolchain/fbtenv.cmd" env & python '
else:
commandline = (
'. "$UFBT_STATE_DIR/current/scripts/toolchain/fbtenv.sh" && '
"python3 -m SCons -Q --warn=target-not-built "
'-C "$UFBT_STATE_DIR/current/scripts/ufbt" '
f'"UFBT_APP_DIR={UFBT_APP_DIR}" ' + " ".join(sys.argv[1:])
'. "$UFBT_STATE_DIR/current/scripts/toolchain/fbtenv.sh" && python3 '
)

commandline += oslex.join(
[
"-m",
"SCons",
"-Q",
"--warn=target-not-built",
"-C",
str(ufbt_script_root),
f"UFBT_APP_DIR={UFBT_APP_DIR}",
*sys.argv[1:],
]
)

# print(commandline)
retcode = os.system(commandline)
if platform.system() != "Windows":
Expand Down
Loading