makelint package

Module contents

class makelint.DependencyItem(path, digest, name)

Bases: tuple

digest

Alias for field number 1

name

Alias for field number 2

path

Alias for field number 0

class makelint.NullProgressReport[source]

Bases: object

No-op for quiet mode

class makelint.ProgressReporter[source]

Bases: object

Prints a status message

do_print()[source]
get_istep()[source]

Return the index of our current step

get_nsteps()[source]

Return the total number of steps to completion

get_progress()[source]

Return current progress as a percentage

makelint.cat_log(logfile_path, header, merged_log)[source]

Copy the content from logfile_path into merged_log

makelint.chunk_iter_file(infile, chunk_size=4096)[source]

Read a file chunk by chunk

makelint.depmap_is_uptodate(target_tree, relpath_file)[source]

Given a dictionary of dependency data, return true if all of the files listed are unchanged since we last ran the scan.f

makelint.digest_file(source_path, digest_path)[source]

Compute a message digest of the file content, write the digest (in hexadecimal ascii encoding) to the output file

makelint.digest_sourcetree_content(source_tree, target_tree, progress, njobs)[source]

The sha1 of each tracked file is computed and stored in a digest file (one per source file). The digest file depends on the modification time of the source file. If the sourcefile hasn’t changed, the digest file doesn’t need to be updated.

makelint.discover_sourcetree(source_tree, target_tree, exclude_patterns, include_patterns, progress)[source]

The discovery step performs a filesystem walk in order to build up an index of files to be checked. You can use configuration files to setup inclusion and exclusion filters for the discovery process. In general, though, each directory that is scanned produces a list of files to lint. If the timestamp of a tracked directory changes, it is rescanned for new files, or new directories.

The output of the discovery phase is a manifest file per-directory tracked. The creation of this manifest depends on the modification time of the directory it corresponds to and will be re-built if the directory is changed. If a new subdirectory is added, the system will recursively index that new directory. If a directory is removed, it will recursively purge that directory from the manifest index.

makelint.execute_tool_ontree(source_tree, target_tree, tool, env, fail_fast, merged_log, progress, njobs)[source]

Execute the given tool

makelint.get_progress_bar(numchars, fraction=None, percent=None)[source]

Return a high resolution unicode progress bar

makelint.map_dependencies(source_tree, target_tree, source_relpath)[source]

Get a dependency list from the sourcefile. Writeout the dependency file and it’s sha1 digest.

makelint.map_sourcetree_dependencies(source_tree, target_tree, progress, njobs)[source]

During this phase each tracked source file is indexed to get a complete dependency footprint. Note that this is done by importing each module file in a clean interpreter process, and then inspecting the __file__ attribute of all modules loaded by interpreter.

makelint.toolstamp_is_uptodate(toolstamp_path, depmap_path)[source]

Return true if the toolstamp is up to date with respect to the dependency map

makelint.waitforsize(pidset, njobs)[source]

Given a set() of pids, wait until it has at most njobs alive children

Submodules

makelint.configuration module

class makelint.configuration.ConfigObject[source]

Bases: object

Provides simple serialization to a dictionary based on the assumption that all args in the __init__() function are fields of this object.

as_dict()[source]

Return a dictionary mapping field names to their values only for fields specified in the constructor

classmethod get_field_names()[source]

Return a list of field names, extracted from kwargs to __init__(). The order of fields in the tuple representation is the same as the order of the fields in the __init__ function

class makelint.configuration.Configuration(include_patterns=None, exclude_patterns=None, source_tree=None, target_tree=None, tools=None, env=None, fail_fast=False, merge_log=None, quiet=False, jobs=None, **extra)[source]

Bases: makelint.configuration.ConfigObject

Encapsulates various configuration options/parameters

clone()[source]

Return a copy of self.

class makelint.configuration.SimpleTool(name)[source]

Bases: object

Simple implementation of the tool API that works for commands which just take the name of the file as an argument.

as_dict()[source]
execute(source_tree, source_relpath, env, outfile)[source]
get_stamp(target_cwd, filename)[source]
makelint.configuration.get_default(value, default)[source]

return value if it is not None, else default

makelint.configuration.parse_bool(string)[source]

Evaluate the truthiness of a string

makelint.configuration.serialize(obj)[source]

Return a serializable representation of the object. If the object has an as_dict method, then it will call and return the output of that method. Otherwise return the object itself.

makelint.get_dependencies module

Helper module to get dependencies. exec() a python file and then inspect sys.modules and record everything that was read in.

makelint.get_dependencies.main()[source]

makelint.__main__ module

Incremental execution system for python code analysis (linting).

makelint.__main__.add_config_options(optgroup)[source]

Add configuration options as flags to the argument parser

makelint.__main__.dump_config(args, config_dict, outfile)[source]

Dump the default configuration to stdout

makelint.__main__.load_config(configfile_path)[source]

Read a configuration file and return as a configuration object

makelint.__main__.main()[source]

Parse arguments, open files, start work.

makelint.__main__.setup_argparser(parser)[source]

Add argparse options to the parser.