buildlogs methods¶
*logging with termialC stream subclass*
-
class
buildlogs.
func
(hi, lo)¶ “logging” way to filter by each FILE record at lvl 45. Also use custom level to only send level 45 to filelog if log.critical = 50 then log console goes to File.
-
buildlogs.
dynfile
(name, pathfilelog=None)¶ split log files and log console by lvl and filter
buildcheck methods¶
-
buildcheck.
checkBuildConfig
(usrconfig, show=False)¶ Re-check to final config file
-
buildcheck.
showUserConfig
(configuration)¶ Output the configuration file
buildmake methods¶
method: | makeBuild() internal call |
---|
Compile the exe or dll files given the user information
Use modified pyc.py to compile with subprocess call to IronPython ipy.exe.
Stop build on partialError that is Fatal to Compile Let makeBuild finish so that user can fix partialErrs
Assembly setup:
flag (exe) | state | parameter(s) | ipy run result |
---|---|---|---|
standalone plus embed |
true | listexe | App self embedded: no AddRef Can run without Ironpython. |
listdll | User libs embedded: no AddRef Can run without Ironpython. | ||
standalone plus embed plus libembed |
true | any or None listexe/listdll |
No AddRef - any can run without Ironpython. |
standalone | true | all any or Non | Distribute and AddRef Stdlib if Lib imports (i.e. zip, etc) Can run without Ironpython. |
embed | true | listexe and/or listdll | modules.py (listexe) and .dlls (listdll) embedded. No AddRef imports within app.exe |
all | false | listexe and listdll | Import modules.py and .dlls (listdll) copyied to outdir. Distribute with app.exe. |
libembed | true | Distribute and AddRef Stdlib |
flag (dll) | state | parameter(s) | ipy run result |
---|---|---|---|
no effect | NA | listexe | App dll .py modules needed in path. |
listdll | User libs need to AddRef |
-
class
buildmake.
CompileVars
¶ Consolidate all system and user input values for compile run.
-
buildmake.
makeBuild
(config)¶ - Compile the exe or dll files based on:
- user args
- user assembly flags (f_embed, f_libembed, f_standalone)
-
buildmake.
createUserLibs
(config)¶ Loads files from user arg “listdll”. If .py file creates .dll then/else adds created or listdll .dll file to to compiler config.dlls.
- If assembly f_embed or f_standalone:
- is true:
- Agglomerates all dll libraries into one dll that is embeded and then removed from user arg “outDir” or or auto-named outdir.
- else:
- Add each lib .dll file to “outDir” or outdir.
filecontrol methods¶
-
filecontrol.
checkRequired
(path)¶ Read file list of required files and check they if exist or partial error.
Param: - path [str] - of file to read list
- tag= [opt][str] - writelog tag for filtering
Returns: list of files not found - should be empty [list]
Raise: partialError - sink errors for stdout in PartialErrors [list]
-
filecontrol.
delTestFileWrites
(dellst)¶ Handle test file cleanup delete created files
Param: dellst [list] - list log files filtered for deletion Returns: True [bool] - if all dellst files deleted
-
filecontrol.
getFilesDeleted
(loglst)¶ Handle deletion of test generated files that have been parsed and filtered in logfile list.
Param: loglst [list] - list log files during lookback Returns: [list] - existing files
-
filecontrol.
getFilesExist
(loglst)¶ Handle parsed and filtered logfile list
Param: loglst [list] - list log files during lookback Returns: [list] - existing files
-
filecontrol.
CompareFilesConfirmedToRequired
(confirmlst, reqlst)¶ Handle parsed and filtered logfile list
Param: - confirmlst [list] - log files confirmed during lookback
- reqlst [list] - log files that should be in confirmed list
return: [list] - non-conformed files - should return []
-
filecontrol.
getFilesWritten
(loglst)¶ Handle parsed and filtered logfile list
Param: loglst [list] - list log files during lookback Returns: [list] - written files
-
filecontrol.
getFilesConfirmed
(loglst)¶ Handle parsed and filtered logfile list
Param: loglst [list] - list log files during lookback Returns: [list] - existing files
-
filecontrol.
delBuildFileWrites
(dellst)¶ Handle build file cleanup delete created files
Param: dellst [list] - list log files filter for deletion Returns: status True [bool] - if all dellst files deleted
-
filecontrol.
setLogLookBackTimeSec
(lookback=30)¶ Set log output look-back time (sec)
Param: sec [int]
-
filecontrol.
getLogLookBackTimeSec
()¶ Get log output look-back time (sec)
Returns: sec [int]
-
filecontrol.
getWriteLog
(tag='')¶ Find writelog lines matching timestamps between lookbacktime (default 30 sec back) and current local time
logpath: cwdUserDefaultedfilewrite.log - no limit storage
Param: tag= [str] - filter by tag Returns: writelog data [list]
globalstate class¶
-
class
globalstate.
GlobalState
¶ #TODO trying to clean up globals currently only used for the required module
gsBuild: Global class holding required paths and existence information when the install IronPython path is/is not found.
-
__init__
()¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__weakref__
¶ list of weak references to the object (if defined)
-
makedefault methods¶
-
makedefault.
validatePath
(txt)¶ Regex parse a valid filepath into path:name:ext group
param: txt [str] - valid file path return: path:name:ext [list] or []
-
makedefault.
BasePathDir
(dp)¶ Parse a file path and return dict of info about path
Param: dp [str] - user arg path Returns: - (main, base, basetype, isFile, isdefault) [tuple]
- main [str] - fullpath parent
- base [str] - base of path dir or file path
- basetype [basetype [python, json, config, None]]
- isFile [bool]
- isdefault [ bool] - True if output is going to UserDefaulted/
-
makedefault.
SlashArgs
(config, name, jsn, out)¶ Runs SlashControl and BasePath for each user path arg:
params: (configPath, mainName, jsonp, outDir) return: (argc, argm, argj, argo) [tuple]
-
makedefault.
setConfig
(configPath, mainName, jsonarg, argc, argm, argj)¶ Path json with assembly >> main >> if config None
-
makedefault.
setMain
(configPath, mainName, jsonarg, argc, argm, argj)¶ path json with assembly >> main >> if config None reset mainName path to outDir if no arg “outDir”
-
makedefault.
setPath
(configPath, mainName, jsonarg, argout, f_type='json')¶ Well this doesn’t end - way too complex
-
class
makedefault.
TestCaseJson
(methodName='runTest')¶ -
classmethod
setUpClass
()¶ Hook method for setting up class fixture before running tests in the class.
-
setUp
()¶ Hook method for setting up the test fixture before exercising it.
-
tearDown
()¶ Hook method for deconstructing the test fixture after testing it.
-
classmethod
makeload methods¶
-
makeload.
pathRead
(fpaths)¶ Try to read a file path or or lst of file paths.
Params: fpath[s] [str][list] - path[s] to check Returns: path[s] read [str] or [list]
-
makeload.
CheckConfig
(uconfig)¶ Check for valid config entries after parse/loading
Param: config Dict from LoadConfig [OrderedDict] Returns: userconfig [config Dict] - as written to file path shown in writefiles.log Raise: FatalError or partialError [Exception] or [error sink list] user can re-run ipybuild on a partialError fix why FatalError - a user messed with defaults - error vs program error
-
makeload.
getTrueFilePath
(fnpath)¶ Find absolute file path if exists.
Param: fnpath [str] - file path to check. Returns: absolute path to existing file [str]. Raise: [IOError] if can’t find or read.
-
makeload.
LoadConfig
(parsedArgs)¶ Load user defined “configPath” or start with auto-renamed default configuration as helper, if started with “two quotes” no space (“”) as configPath parameter.
After user adjustments to default_config.config content orname, or path, user will need to re-run using “auto-renamed” config path.
The auto-renamed file is shown as output in the output log.This will finish a build.
Provides user opportunity to change defaults in an editor before building on default settings and assembly information.
If you use “two quotes no space (“”) as the first arg then the default config path is used and build proceeds with an auto re-named appname:_config.config file or if no main name was provided the default_config.config file which user can modify.
If the output path (“ourDir” arg) is not resolved generated files go to the “/UserDefaulted” directory.
Param: parsredArgs from ParseArg [OrderedDict] Returns: userconfig [config Dict] - written to file path shown in writefiles.log Raises: FatalError or partialError [Exception] or [error sink list] user can re-run ipybuild on a partialError fix
-
makeload.
loadRes
(arg)¶ Check a filepath(s) and return path or list of paths
Param: arg [str] or [list] - path to listfile of filepaths Returns: filepaths(s) [str] or [list]
-
makeload.
openResListFiles
(rpath)¶ #TODO always partial error in final recursive read as #this last try read the text content and not a valid path. #Even a regx match errors on “someClass.run” because it #looks like a path
Check if path is existing file or partial error
Filters: .dll and .exe files to not read Param: rpath [str] - a file path Returns: [str] - path if isfile Raise: [IOError] sent to partialError
makeparse methods¶
-
makeparse.
CommandLineParse
(arguments)¶ space separated - use relative or absolute paths non-quoted args
ConfigPath: user .config path or ‘’ to use default_config.config [str] [opt] MainName: python/ironpython .py file to compile as library .dll or .exe [str] [opt] - if you leave mainName out final compile is suspended until re-run with mainName OutDir: path output directory [str] [opt] = default “release/” Jsonarg: path to assembly and embedding flags .json file [str] [opt] - defaults to “defaults/”asembly_config.json” and requires the file path subdirectory “defaults/”. MakeEXE: True - make exe [bool] [opt] - default False to make dll file Args: single file paths [str] to add in compile - MUST contain key word (‘exe’, ‘dll’, or ‘zip’) - like mypydll.py or zip.txt kwargs filepath - like listexe=myprojectpyfilelist.txt [opt]
listexe: - all .py required to run the main.py file as an exe
listdll: - pre-compiled .dlls or .py module file to add or embed in main
listzip: - file path structure and file archive into output directory
see help (-h -v) and documentation for more
-
makeparse.
ParseArgs
(*sargs)¶ Parse cmd or script args with ability to parse/accept multiple user type entries. :return: user args [ordered dict]
partialerror methods¶
-
exception
partialerror.
FatalError
(name, msg)¶ ipybuild Exception catcher
-
partialerror.
partialError
(ex, msg)¶ Aggregates (sinks) non-fatal errors that may require a re-run with fix’
Output: errors to consider [list]
regt methods¶
-
regt.
SlashContrl
(strpath)¶ Solves windows - os.path normalize fail for i.e. teststests, considers an escape sequence.
:filters:: [‘r’, ‘t’, ‘f’, ‘a’, ‘v’].
Returns: true path [str] other specific escape chars not filtered
required methods¶
-
required.
FindIronPython
()¶ Walk directories to find IronPython Install
Returns: IronPython install path [str] - or - if not main sets gsBuild.IPATH Raise: NotImplementedError
terminalcolorlog methods¶
-
class
terminalcolorlog.
terminalC
(stream=<colorama.ansitowin32.StreamWrapper object>)¶ Sheds light on a dark subject.
Uses wincon and winbase constants and handles or ANSI codes for platform specific awesomeness in concert with with logging.
Sad note: that if you run bash in windows you must manually tweak the “code” for bash. No-way to know what tty your running
Glad note: it works in bash mingw win 64
87 88 89 90 91 92 93 94
def assignColor(self): if 'win' in sys.platform: self.setColor = self.emitWin else: self.setColor = self.emitAnsi :TODO: add cmd on-the-fly switch to instantiated class between bash and windows