Burgerlib Python
Loading...
Searching...
No Matches
Functions | Variables
burger.git Namespace Reference

Package that contains git helper functions. More...

Functions

def where_is_git (verbose=False, refresh=False, path=None)
 Return the location of the git executable. More...
 
def is_under_git_control (working_directory)
 Test if the directory is under git source control. More...
 
def _call_git (cmd, working_dir, verbose)
 Call git and return the output. More...
 
def make_git_version_header (working_dir, outputfilename, verbose=False)
 Create a C header with the git version. More...
 

Variables

 _GIT_PATH
 Cached location of git.
 

Detailed Description

Package that contains git helper functions.

Functions to locate git and issue git commands

Function Documentation

◆ _call_git()

def burger.git._call_git (   cmd,
  working_dir,
  verbose 
)
private

Call git and return the output.

If an error occured, return None for the string.

Parameters
cmdTuple of the command line to execute
working_dirDirectory to set before executing the command
verboseTrue for verbose output.
Returns
Error code integer, returned string from git.

◆ is_under_git_control()

def burger.git.is_under_git_control (   working_directory)

Test if the directory is under git source control.

First test if git is installed by calling where_is_git(). Then use the git tool to query if the working directory is under git source control.

Parameters
working_directoryDirectory to test.
Returns
True if the directory is under git control, False if not.
See also
where_is_git

◆ make_git_version_header()

def burger.git.make_git_version_header (   working_dir,
  outputfilename,
  verbose = False 
)

Create a C header with the git version.

This function assumes version control is with git!

Get the last change list and tag, and then create a header with this information (Only modify the output file if the contents have changed)

C++ defines are declared for GIT_HASH, GIT_CHANGEDATE, GIT_CHANGETIME, GIT_TAG_VERSION GIT_TAG_VERSION_INFO

Parameters
working_dirstring with the path of the folder to obtain the git version for
outputfilenamestring with the path of the generated header
verbosePrint git commands and other informational messages
Returns
Zero if no error, non-zero on error

◆ where_is_git()

def burger.git.where_is_git (   verbose = False,
  refresh = False,
  path = None 
)

Return the location of the git executable.

Look for an environment variable GIT and determine if the executable resides there, if so, return the string to the path.

PATH is then searched for git, and if it's not found, None is returned.

Parameters
verboseIf True, print a message if git was not found
refreshIf True, reset the cache and force a reload.
pathPath to git to place in the cache
Returns
A path to the git command line executable or None if not found.
See also
where_is_p4
is_under_git_control