pymakelib package

Submodules

pymakelib.addon module

class pymakelib.addon.AddonAbstract(projectSettings, compilerSettings)

Bases: object

init()
pymakelib.addon.add(inst)
pymakelib.addon.init(func)

pymakelib.armsize module

class pymakelib.armsize.ItemSizeStat(name, size, addr)

Bases: object

getAddr()
getSize()
string()
pymakelib.armsize.getSizeAddr(line)
pymakelib.armsize.main(argv)
pymakelib.armsize.printKB(value, decimals=1)
pymakelib.armsize.printPrtg(value, decimals=1)

pymakelib.ceedling module

pymakelib.ceedling.getCeedlingHeaderFiles()

pymakelib.eclipse_addon module

class pymakelib.eclipse_addon.EclipseAddon(projectSettings, compilerSettings)

Bases: pymakelib.addon.AddonAbstract

Generate Eclipse cproject files.

generateCProject()
generateLanguageSettings()
init()

pymakelib.eclipse_cproject module

pymakelib.eclipse_cproject.generate_cproject(listconf: dict)
pymakelib.eclipse_cproject.generate_languageSettings(compilerSettings: dict)
pymakelib.eclipse_cproject.writeXmlExcluding(excList)
pymakelib.eclipse_cproject.writeXmlIncludes(incList)
pymakelib.eclipse_cproject.writeXmlSymbols(symList)

pymakelib.eclipse_files module

pymakelib.exclude module

pymakelib.git module

pymakelib.git.getBranchName()
pymakelib.git.getCommitHash(abbreviated=True)
pymakelib.git.getDescribe(options='--long')
pymakelib.git.printRelativePath(filemacro)

pymakelib.make_files module

pymakelib.module module

class pymakelib.module.AbstractModule

Bases: abc.ABC

Abstract class of pymaketool module

Parameters:path (str) – path to module, _mk.py file.
path

path of module

Type:str
findIncs(inc_type: pymakelib.module.IncType) → list

Util method for find includes in module path

Parameters:inc_type (IncType) – Type of includes C or CPP
Returns:list of includes paths realtive to project
Return type:list
findSrcs(src_type: pymakelib.module.SrcType) → list

Util method for find sources in module path

Parameters:src_type (SrcType) – Type of sources C, CPP or ASM
Returns:list of sources paths realtive to project
Return type:list
getAllIncsC() → list

Ütil method for get all includes in module, type C

Returns:list of includes paths realtive to project
Return type:list
getAllSrcsC() → list

Util method for get all sources in module, type C

Returns:list of sources paths realtive to project
Return type:list
getCompilerOpts()

Get special compiler options for module

getIncs() → list

Abstract method to get the includes paths of module

Returns:list of includes paths realtive to project
Return type:list
getSrcs() → list

Abstract method to get the sources paths of module

Returns:list of sources paths realtive to project
Return type:list
get_module_name() → str

Module name

Returns:name of module (default: class name)
Return type:str
get_path()

Get path of module in filesystem

Returns:path (default: self.__module__.module_name)
Return type:str
init()

Initialization of module

class pymakelib.module.BasicCModule

Bases: pymakelib.module.AbstractModule

Basic C module, find all sources and includes in module path

Parameters:path (str) – path to module, _mk.py file.
getIncs() → list

return list with all includes in module path

Returns:includes path
Return type:list
getSrcs() → list

Return list with all sources in module path

Returns:sources paths
Return type:list
class pymakelib.module.CompilerOptions(opts: dict)

Bases: object

addOption(key, value)
setOption(key, value)
class pymakelib.module.ExternalModule

Bases: pymakelib.module.AbstractModule

The ExternalModule object that inherits from AbstractModule for include external pymaketool module

Parameters:path (str) – path to module, _mk.py file.
remoteModule

remote module object.

Type:AbstractModule
Raises:AttributeError – path is not valid
getCompilerOpts()

Call and return getCompilerOpts from remote module

Returns:compiler options
Return type:disct
getIncs()

Call and return getIncs from remote module

Returns:list of includes
Return type:list
getModulePath() → str

Abstract methos to get string path of external module

Returns:path of external module
Return type:str
getSrcs()

Call and return getSrcs from remote module

Returns:list of sources
Return type:list
init()

Call and return init from remote module

Returns:may be StaticLibrary object or None
Return type:object
class pymakelib.module.GCC_CompilerOpts(copts)

Bases: pymakelib.module.CompilerOptions

addGeneralOpt(opts: list)
addMacroOpts(macro, value=None)
getMacroValue(macro)
isDefine(macro)
isMacroValue(macro, value)
setControlCOpts(opts: list)
setDebuggingOpts(opts: list)
setOptimizationOpts(opts: list)
setWarningdOpts(opts: list)
class pymakelib.module.IncType

Bases: object

C = ['.h']
CPP = ['.h', '.hpp', '.h++', '.hh']
class pymakelib.module.Module(srcs, incs, flags, filename, staticLib: pymakelib.module.StaticLibrary = None)

Bases: object

getDirs()
isEmpty()
pymakelib.module.ModuleClass(clazz)

Add class to modules of pymaketool

Parameters:clazz (class) – Class inheritance of Module.AbstractModule
class pymakelib.module.ModuleHandle(modDir, gCompOpts, goal=None)

Bases: object

getAllIncs(incType: pymakelib.module.IncType)
getAllIncsC()
getAllSrcs(srcType: pymakelib.module.SrcType)
getAllSrcsC()
getFileByNames(names)
getFilesByRegex(regexs, relativePath=None)
getGeneralCompilerOpts()
getGoal()
getRelaptivePath()
getSrcsByPath(srcs)
getWorkspace()
initGitModule = DeprecationWarning(<function ModuleHandle.initGitModule>)
class pymakelib.module.POJOModule(path)

Bases: pymakelib.module.AbstractModule

getCompilerOpts()

Get special compiler options for module

getIncs() → list

Abstract method to get the includes paths of module

Returns:list of includes paths realtive to project
Return type:list
getSrcs() → list

Abstract method to get the sources paths of module

Returns:list of sources paths realtive to project
Return type:list
init()

Initialization of module

class pymakelib.module.SrcType

Bases: object

ASM = ['.s', '.S', '.asm']
C = ['.c']
CPP = ['.C', '.cc', '.cpp', '.CPP', '.c++', '.cp', '.cxx']
class pymakelib.module.StaticLibrary(name: str, outputDir: str, rebuild=False, lib_linked_opts=None, orden=1)

Bases: object

rebuildByCheckStr(checkStr: str)
setRebuild(rebuild: bool)
class pymakelib.module.StaticLibraryModule

Bases: object

decorate_module()
get_command(key) → str
get_lib_name() → str
get_lib_outputdir() → str
get_linker(key) → str
get_linker_opts() → str
get_objects(key) → str
get_order()
get_rebuild()
get_rule(key) → str
pymakelib.module.cleanModuleInstance()
pymakelib.module.getModuleInstance() → pymakelib.module.AbstractModule

pymakelib.moduleignore module

pymakelib.moduleignore.readIgnoreFile(file=PosixPath('.moduleignore'))
pymakelib.moduleignore.writeIgnoreFile(ignoreList: list, file=PosixPath('.moduleignore'))

pymakelib.preconts module

pymakelib.prelib module

pymakelib.prelib.add_value2list(dstList: list, values)
pymakelib.prelib.compilerOptsByModuleToLine(compOpts)
pymakelib.prelib.list2str(l)
pymakelib.prelib.macrosDictToString(macros)
pymakelib.prelib.readModule(modPath, compilerOpts, goals=None)
pymakelib.prelib.read_Makefilepy(workpath='')
pymakelib.prelib.read_Makefilepy_obj(workpath='') → pymakelib.AbstractMake
pymakelib.prelib.read_module(module_path: pathlib.Path, compiler_opts, goals=None) → List[pymakelib.module.AbstractModule]
pymakelib.prelib.reafGenHeader(headerpath)
pymakelib.prelib.wprGetCompilerOpts(mod, modHandle, moduleInstance=None)
pymakelib.prelib.wprGetIncs(mod, modHandle, moduleInstance=None)
pymakelib.prelib.wprGetSrcs(mod, modHandle, moduleInstance=None)
pymakelib.prelib.wprInit(mod, modHandle, moduleInstance=None)

pymakelib.preutil module

pymakelib.preutil.getAllIncs(wkmh, incType: pymakelib.module.IncType)
pymakelib.preutil.getAllIncs_C(wkmh)
pymakelib.preutil.getAllSrcs(wkmh, srcType: pymakelib.module.SrcType)
pymakelib.preutil.getAllSrcs_C(wkmh)
pymakelib.preutil.getSrcsByRgx(wkmh, *regexs)

pymakelib.printsrc module

class pymakelib.printsrc.bcolors

Bases: object

BOLD = '\x1b[1m'
CBEIGE = '\x1b[36m'
CBEIGE2 = '\x1b[96m'
CBEIGEBG = '\x1b[46m'
CBEIGEBG2 = '\x1b[106m'
CBLACK = '\x1b[30m'
CBLACKBG = '\x1b[40m'
CBLINK2 = '\x1b[6m'
CBLUE = '\x1b[34m'
CBLUE2 = '\x1b[94m'
CBLUEBG = '\x1b[44m'
CBLUEBG2 = '\x1b[104m'
CBOLD = '\x1b[1m'
CEND = '\x1b[0m'
CGREEN = '\x1b[32m'
CGREEN2 = '\x1b[92m'
CGREENBG = '\x1b[42m'
CGREENBG2 = '\x1b[102m'
CGREY = '\x1b[90m'
CGREYBG = '\x1b[100m'
CITALIC = '\x1b[3m'
CRED = '\x1b[31m'
CRED2 = '\x1b[91m'
CREDBG = '\x1b[41m'
CREDBG2 = '\x1b[101m'
CSELECTED = '\x1b[7m'
CURL = '\x1b[4m'
CVIOLET = '\x1b[35m'
CVIOLET2 = '\x1b[95m'
CVIOLETBG = '\x1b[45m'
CVIOLETBG2 = '\x1b[105m'
CWHITE = '\x1b[37m'
CWHITE2 = '\x1b[97m'
CWHITEBG = '\x1b[47m'
CWHITEBG2 = '\x1b[107m'
CYELLOW = '\x1b[33m'
CYELLOW2 = '\x1b[93m'
CYELLOWBG = '\x1b[43m'
CYELLOWBG2 = '\x1b[103m'
ENDC = '\x1b[0m'
FAIL = '\x1b[91m'
HEADER = '\x1b[95m'
OKBLUE = '\x1b[94m'
OKGREEN = '\x1b[92m'
UNDERLINE = '\x1b[4m'
WARNING = '\x1b[93m'
pymakelib.printsrc.colorSrc(pathsrc)

pymakelib.project module

pymakelib.project.define(key) → str

Get value of define if exist.

Parameters:key (str) – name of define (macro)
Returns:value of define in string, if define value is None return ‘’,if key is not defined return None
Return type:str
pymakelib.project.getCompilerOpts() → dict

Get the project compiler options

Returns:General project compiler options
Return type:dict
pymakelib.project.getSettings()
pymakelib.project.get_base_build() → str

Get base build folder

Returns:base build folder
Return type:str
pymakelib.project.isdefined(key) → bool

Check if project have define.

Parameters:key (str or D) – name of define or macro
Returns:True if key is defined
Return type:bool
pymakelib.project.setSettings(settings)

pymakelib.pycodegen module

pymakelib.pycodegen.HEADER_FILE(*args, **kwargs)
pymakelib.pycodegen.comment(value: str)
pymakelib.pycodegen.enum(names, values=[0])
pymakelib.pycodegen.enum_sf(strformat, range, init=0)
pymakelib.pycodegen.enum_str_map(name, strdict: dict)
pymakelib.pycodegen.out(value)

pymakelib.toolchain module

pymakelib.toolchain.confARMeabiGCC(binLocation='', prefix='arm-none-eabi-', extIncludes=[])
pymakelib.toolchain.confGCC(binLocation='', prefix='', extIncludes=[], iscpp=False)
pymakelib.toolchain.confLinuxGCC(binLocation='', extIncludes=[])
pymakelib.toolchain.confToolchain(cmd_gcc, cmd_gxx, cmd_ld, cmd_ar, cmd_as, cmd_objcopy, cmd_size, cmd_objdump, cmd_nm, cmd_ranlib, cmd_strings, cmd_strip, cmd_cxxfilt, cmd_addr2line, cmd_readelf, cmd_elfedit, includes)
pymakelib.toolchain.getGCCHeaderFiles(cmd_gcc)
pymakelib.toolchain.get_c_linux(bin_location='', ext_incs=[]) → dict
pymakelib.toolchain.get_cpp_linux(bin_location='', ext_incs=[]) → dict
pymakelib.toolchain.get_gcc_arm_none_eabi(binLocation='', prefix='arm-none-eabi-', extIncludes=[]) → dict

Get dictionary with gcc compiler set of arm-none-eabi-

Parameters:
  • binLocation (str, optional) – Location of toolchain binary. Defaults to ‘’.
  • prefix (str, optional) – prefix of ARM toolchain. Defaults to ‘arm-none-eabi-‘.
  • extIncludes (list, optional) – list of external includes. Defaults to [].
Returns:

set of gcc compiler e.g. {‘CC’: ‘arm-none-eabi-gcc’ … }

Return type:

dict

pymakelib.toolchain.get_gcc_linux(bin_location='', ext_incs=[]) → dict

Get dictionary with gcc compiler set for linux

Parameters:
  • bin_location (str, optional) – location of toolchain. Defaults to ‘’.
  • ext_incs (list, optional) – list of external includes. Defaults to [].
Returns:

set of gcc compiler e.g. {‘CC’: ‘gcc’ … }

Return type:

dict

pymakelib.toolchain.get_gpp_linux(bin_location='', ext_incs=[]) → dict

Get dictionary with g++ compiler set for linux

Parameters:
  • bin_location (str, optional) – location of toolchain. Defaults to ‘’.
  • ext_incs (list, optional) – list of external includes. Defaults to [].
Returns:

set of gcc compiler e.g. {‘CC’: ‘g++’ … }

Return type:

dict

Module contents

class pymakelib.AbstractMake

Bases: abc.ABC

getCompilerOpts(**kwargs) → dict
getCompilerSet(**kwargs) → dict
getLinkerOpts(**kwargs) → dict
getProjectSettings(**kwargs) → dict
getTargetsScript(**kwargs) → dict
class pymakelib.Define(value)

Bases: object

Direct define: { ‘__USE_FILE__’: D(‘file.h’) } => -D__USE_FILE__=file.h

getDefine()
class pymakelib.Logger

Bases: object

static getInstance()

Static access method.

static getLogger() → logging.Logger
class pymakelib.MKVARS

Bases: object

ADDR2LINE = '$(ADD2LINE)'
CELFEDIT = '$(ELFEDIT)'
CXXFILT = '$(CXXFILT)'
LD = '$(LD)'
LDFLAGS = '$(LDFLAGS)'
NM = '$(NM)'
OBJCOPY = '$(OBJCOPY)'
OBJECTS = '$(OBJECTS)'
PROJECT = '$(PROJECT)'
RANLIB = '$(RANLIB)'
READELF = '$(READELF)'
SIZE = '$(SIZE)'
STATIC_LIBS = '$(SLIBS_NAMES)'
STRINGS = '$(STRINGS)'
STRIP = '$(STRIP)'
TARGET = '$(TARGET)'
pymakelib.MOD_PATH(wk)
pymakelib.Makeclass(clazz)
class pymakelib.Pymaketool(workpath='./')

Bases: object

getModulesPaths() → list
readModules(modulesPaths) → list
read_modules(modulesPaths) → List[pymakelib.module.AbstractModule]
pymakelib.getProjectInstance() → pymakelib.AbstractMake