Skip to content

Commit

Permalink
Pre-release changes (#195)
Browse files Browse the repository at this point in the history
* Deprecate fprime-util new --project

* Declutter output of version-check

* Update CodeQL action

* spelling and formatting
  • Loading branch information
thomas-bc authored Feb 14, 2024
1 parent d76b216 commit b3b98b7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/actions/codeql/security-pack.yml
Expand Down
25 changes: 19 additions & 6 deletions src/fprime/util/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ def run_info(
f"'{target}'": "" for target in build_info.get("global_targets", [])
}
build_artifacts = (
build_info.get("auto_location")
if build_info.get("auto_location") is not None
else "N/A",
(
build_info.get("auto_location")
if build_info.get("auto_location") is not None
else "N/A"
),
build_info.get("build_dir", "Unknown"),
)
local_generic_targets.update(local_targets)
Expand Down Expand Up @@ -194,10 +196,10 @@ def run_version_check(
try:
import platform

print(f"Python version: {platform.python_version()}")
print(f"Operating System: {platform.system()}")
print(f"CPU Architecture: {platform.machine()}")
print(f"Platform: {platform.platform()}")
print(f"Python version: {platform.python_version()}")
except ImportError: # Python >=3.6
print("[WARNING] Cannot import 'platform'.")

Expand Down Expand Up @@ -228,9 +230,20 @@ def run_version_check(
return

print("Pip packages:")
# Used to print fprime-fpp-* versions together if they are all the same to de-clutter the output
fpp_packages = {}
for tool in FPRIME_PIP_PACKAGES:
try:
version = pkg_resources.get_distribution(tool).version
print(f" {tool}=={version}")
except (OSError, VersionException) as exc:
if tool.startswith("fprime-fpp-"):
fpp_packages[tool] = version
else:
print(f" {tool}=={version}")
except (OSError, VersionException, pkg_resources.DistributionNotFound) as exc:
print(f"[WARNING] {exc}")
if fpp_packages:
if len(set(fpp_packages.values())) == 1:
print(f" fprime-fpp-*=={list(fpp_packages.values())[0]}")
else:
for tool, version in fpp_packages.items():
print(f" {tool}=={version}")
8 changes: 8 additions & 0 deletions src/fprime/util/cookiecutter_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Cookie cutter wrapper used to template out components
"""

import glob
import os
import shutil
Expand Down Expand Up @@ -227,6 +228,13 @@ def new_module(build: Build, parsed_args: "argparse.Namespace"):
def new_project(parsed_args: "argparse.Namespace"):
"""Creates a new F' project"""

print(
"[DEPRECATED] This command is deprecated and will be removed in a future release."
" Please use `fprime-bootstrap project` instead."
" Install fprime-bootstrap with `pip install fprime-bootstrap`,"
" or refer to https://nasa.github.io/fprime/INSTALL.html"
)

# Check if Git is installed and available - needed for cloning F' as submodule
if not shutil.which("git"):
print(
Expand Down
5 changes: 2 additions & 3 deletions src/fprime/util/help_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,8 @@
Usage:
-- New Project --
Generate a new F' project. This will create a Git repository and add F' as a submodule, optionally creating a new
virtual environment. Defaults to current directory, but --path can be used to point to a different location.
Using --overwrite will overwrite only the files that are generated by the new project.
Generating a new project is now available through the fprime-bootstrap package. Please see the F´ Install Guide
at https://nasa.github.io/fprime/INSTALL.html for instructions on how to install and use fprime-bootstrap.
-- New Deployment --
Generate a new F' deployment within a F' project. The new deployment command is expected to be ran at the root of
the project and will create a new deployment in the current directory. Using --overwrite will overwrite only the
Expand Down

0 comments on commit b3b98b7

Please sign in to comment.