makelint package

Module contents

class makelint.DependencyItem(path, digest, name)

Bases: tuple


Alias for field number 1


Alias for field number 2


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


Return the index of our current step


Return the total number of steps to completion


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


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.


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


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.

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


Evaluate the truthiness of a string


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.__main__ module

Incremental execution system for python code analysis (linting).


Add configuration options as flags to the argument parser

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

Dump the default configuration to stdout


Read a configuration file and return as a configuration object


Parse arguments, open files, start work.


Add argparse options to the parser.