KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_special_execute.cpp File Reference
#include <jobs/job_special_execute.h>
#include <jobs/job_registry.h>
#include <common.h>
#include <i18n_utility.h>
#include <paths.h>
#include <project.h>
#include <project/project_file.h>
#include <wildcards_and_files_ext.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/utils.h>

Go to the source code of this file.

Functions

wxString FindBundledPython (const std::vector< wxString > &aToolDirs)
 Find the interpreter shipped with KiCad in the given tool directories.
 
static wxString onlyFileWithExt (const wxString &aDir, const wxString &aExt)
 
static wxString projectBoard (const PROJECT &aProject)
 
static wxString projectSchematic (const PROJECT &aProject)
 
std::map< wxString, wxString > GetExecuteBuiltinVariables (const PROJECT *aProject)
 Return the variables an Execute Command job can use beyond the environment and project variables.
 
std::map< wxString, wxString > GetExecuteBuiltinVariableHelp ()
 Describe each variable returned by GetExecuteBuiltinVariables() for the user.
 
wxString ExpandExecuteCommand (const wxString &aCommand, const PROJECT *aProject)
 Expand an Execute Command string, including the built-in variables.
 
 REGISTER_JOB (special_execute, _HKI("Special: Execute Command"), KIWAY::KIWAY_FACE_COUNT, JOB_SPECIAL_EXECUTE)
 

Function Documentation

◆ ExpandExecuteCommand()

wxString ExpandExecuteCommand ( const wxString & aCommand,
const PROJECT * aProject )

Expand an Execute Command string, including the built-in variables.

A variable the user already defined, as an environment variable or a project text variable, wins over the built-in of the same name so a portable jobset can still be overridden on one machine.

Definition at line 168 of file job_special_execute.cpp.

References ExpandEnvVarSubstitutions(), GetExecuteBuiltinVariables(), name, and PROJECT::TextVarResolver().

Referenced by BOOST_AUTO_TEST_CASE(), DIALOG_EXECUTECOMMAND_JOB_SETTINGS::populateEnvironReadOnlyTable(), JOBS_RUNNER::runSpecialExecute(), and DIALOG_EXECUTECOMMAND_JOB_SETTINGS::updateExpandedPreview().

◆ FindBundledPython()

wxString FindBundledPython ( const std::vector< wxString > & aToolDirs)

Find the interpreter shipped with KiCad in the given tool directories.

Returns
the full path of the first interpreter found, or an empty string when none is shipped.

Definition at line 51 of file job_special_execute.cpp.

References name.

Referenced by BOOST_AUTO_TEST_CASE(), and GetExecuteBuiltinVariables().

◆ GetExecuteBuiltinVariableHelp()

std::map< wxString, wxString > GetExecuteBuiltinVariableHelp ( )

◆ GetExecuteBuiltinVariables()

std::map< wxString, wxString > GetExecuteBuiltinVariables ( const PROJECT * aProject)

Return the variables an Execute Command job can use beyond the environment and project variables.

KICAD_PYTHON is the bundled interpreter, or the bare interpreter name when KiCad ships none. KICAD_PROJECT_PCB and KICAD_PROJECT_SCH are the project's board and top-level schematic. The schematic comes from the project file. The board is named after the project, or is the only board in the project folder.

Definition at line 131 of file job_special_execute.cpp.

References EXEC_PROJECT_PCB_VAR_NAME, EXEC_PROJECT_SCH_VAR_NAME, EXEC_PYTHON_VAR_NAME, FindBundledPython(), PATHS::GetExecutableDir(), PROJECT::GetProjectFullName(), PATHS::GetToolDirectories(), projectBoard(), and projectSchematic().

Referenced by ExpandExecuteCommand().

◆ onlyFileWithExt()

static wxString onlyFileWithExt ( const wxString & aDir,
const wxString & aExt )
static

Definition at line 76 of file job_special_execute.cpp.

Referenced by projectBoard(), and projectSchematic().

◆ projectBoard()

static wxString projectBoard ( const PROJECT & aProject)
static

◆ projectSchematic()

◆ REGISTER_JOB()

REGISTER_JOB ( special_execute ,
_HKI("Special: Execute Command") ,
KIWAY::KIWAY_FACE_COUNT ,
JOB_SPECIAL_EXECUTE  )