You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a proper Python project for the Python scripts (#470)
* Start on improving Python project structure
* Finish migrating to pyproject.toml
* Add find program for python scripts
* Remove existing mbed-tools, re-add dependency
* Remove dependency on future
* Print package dir
* Augh missing quote
* Oh neat reordering the commands already fixed it
* Install pyocd and cysecuretools lazily
* mbed-tools needs setuptools
* Set min version of setuptools
* Bump click version
* Install cysecuretools in CI
* Install xml apt packages
* augh no sudo
* Allow tests to be run from anywhere
* Update tools/run_python_tests.sh
Co-authored-by: VictorWTang <33789988+VictorWTang@users.noreply.github.com>
---------
Co-authored-by: VictorWTang <33789988+VictorWTang@users.noreply.github.com>
message(FATAL_ERROR"mbedtools configure failed! Cannot build this project. Command was cd ${CMAKE_CURRENT_LIST_DIR}/../python &&${MBEDTOOLS_COMMAND_SPC_SEP}")
107
+
message(FATAL_ERROR"mbedtools configure failed! Cannot build this project. Command was ${MBEDTOOLS_COMMAND_SPC_SEP}")
# CMake script to find the Python interpreter and either install or find
5
5
# Mbed's dependencies.
6
6
7
+
include(CheckPythonPackage)
8
+
7
9
option(MBED_CREATE_PYTHON_VENV"If true, Mbed OS will create its own virtual environment (venv) and install its Python packages there. This removes the need to manually install Python packages."TRUE)
message(STATUS"Missing Python dependencies (at least one of: python3, intelhex, prettytable) so the memory map cannot be printed")
117
+
if(NOTHAVE_MBED_CE_TOOLS)
118
+
message(FATAL_ERROR"Did not detect the Mbed CE Python tools installed into the python interpreter ${Python3_EXECUTABLE}. Install them with a command like: ${Python3_EXECUTABLE} -m pip install -e ${MBED_CE_TOOLS_BASE_DIR}")
97
119
endif()
98
120
121
+
# For now, don't supply any hints and assume that the script install dir is correctly on PATH
122
+
set(PYTHON_SCRIPT_LOC_HINTS)
99
123
endif()
124
+
125
+
# Find scripts provided by the Python package
126
+
find_program(mbed_tools
127
+
NAMESmbed-tools
128
+
HINTS${PYTHON_SCRIPT_LOC_HINTS}
129
+
DOC"Path to mbed-tools Python script."
130
+
REQUIRED)
131
+
132
+
find_program(mbedhtrun
133
+
NAMESmbedhtrun
134
+
HINTS${PYTHON_SCRIPT_LOC_HINTS}
135
+
DOC"Path to mbedhtrun Python script."
136
+
REQUIRED)
137
+
138
+
find_program(memap
139
+
NAMESmemap
140
+
HINTS${PYTHON_SCRIPT_LOC_HINTS}
141
+
DOC"Path to memap Python script."
142
+
REQUIRED)
143
+
144
+
#
145
+
# Utility function to check for a Python package with the given import name.
146
+
# If the package is not found and the Mbed venv is in use,
147
+
# then the package will be installed by passing PACKAGE_INSTALL_CONSTRAINT to Pip.
148
+
# If the install fails or the venv is not being used, FOUND_VAR will be set to false.
message(WARNING"Mbed: ${PACKAGE_IMPORT_NAME} cannot be installed because the Mbed virtualenv is not being used. Please install ${PACKAGE_INSTALL_CONSTRAINT} into Mbed's Python interpeter manually.")
0 commit comments