Burgerlib Python
|
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. | |
Package that contains git helper functions.
Functions to locate git and issue git commands
|
private |
Call git and return the output.
If an error occured, return None for the string.
cmd | Tuple of the command line to execute |
working_dir | Directory to set before executing the command |
verbose | True for verbose output. |
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.
working_directory | Directory to test. |
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
working_dir | string with the path of the folder to obtain the git version for |
outputfilename | string with the path of the generated header |
verbose | Print git commands and other informational messages |
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.
verbose | If True, print a message if git was not found |
refresh | If True, reset the cache and force a reload. |
path | Path to git to place in the cache |