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

Split bootstrap.py into separate modules #48

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers = [
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Compilers",
"Topic :: Software Development :: Embedded Systems",
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
Expand All @@ -35,7 +35,7 @@ issues = "https://github.com/flipperdevices/flipperzero-ufbt/issues"

[project.scripts]
ufbt = "ufbt:ufbt_cli"
ufbt-bootstrap = "ufbt.bootstrap:bootstrap_cli"
ufbt-bootstrap = "ufbt.bootstrap.cli:entry_point"

# https://setuptools-git-versioning.readthedocs.io/en/stable/schemas/file/dev_release_file.html#development-releases-prereleases-from-dev-branch
[tool.setuptools-git-versioning]
Expand Down
19 changes: 9 additions & 10 deletions ufbt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@
import pathlib
import platform
import sys

import oslex

from .bootstrap import (
DEFAULT_UFBT_HOME,
ENV_FILE_NAME,
bootstrap_cli,
bootstrap_subcommands,
get_ufbt_package_version,
)
from .bootstrap.paths import DEFAULT_UFBT_HOME, ENV_FILE_NAME
from .bootstrap.util import get_ufbt_package_version

__version__ = get_ufbt_package_version()

Expand All @@ -54,6 +50,9 @@ def _load_env_file(env_file):


def ufbt_cli():
from .bootstrap.cli import entry_point
from .bootstrap.command import ALL_NAMES

# load environment variables from .env file in current directory
try:
env_vars = _load_env_file(ENV_FILE_NAME)
Expand All @@ -78,11 +77,11 @@ def ufbt_cli():

# if any of bootstrap subcommands are in the arguments - call it instead
# kept for compatibility with old scripts, better use `ufbt-bootstrap` directly
if any(map(sys.argv.__contains__, bootstrap_subcommands)):
return bootstrap_cli()
if any(map(sys.argv.__contains__, ALL_NAMES)):
return entry_point()

if not os.path.exists(ufbt_state_dir / "current"):
bootstrap_cli(["update"])
entry_point(["update"])

if not (
ufbt_script_root := ufbt_state_dir / "current" / "scripts" / "ufbt"
Expand Down
Loading
Loading