Entrypoint used to generate the command line application
Bases: object
A linker map (version script) representation
This class is an internal representation of a version script. It is intended to be initialized by calling the method read() and passing the path to a version script file. The parser will parse the file and check the file syntax, creating a list of releases (instances of the Release class), which is stored in releases.
logger: The logger object; can be specified in the constructor filename: Holds the name (path) of the file read lines: A list containing the lines of the file
Returns all global symbols from all releases contained in the Map object
Returns: | A set containing all global symbols in all releases |
---|
Check the map structure.
Reports errors found in the structure of the map in form of warnings.
Construct the dependencies lists
Contruct a list of dependency lists. Each dependency list contain the names of the releases in a dependency path. The heads of the dependencies lists are the releases not refered as a previous release in any release.
Returns: | A list containing the dependencies lists |
---|
Find and return a list of duplicated symbols for each release
If no duplicates are found, return an empty list
Returns: | A list of tuples [(release, [(scope, [duplicates])])] |
---|
Try to guess the latest release
It uses the information found in the releases present in the version script read. It tries to find the latest release using heuristics.
Returns: | A list [release, prefix, suffix, version[CUR, AGE, REV]] |
---|
Use the given information to guess the name for the new release
Parameters: |
|
---|---|
Returns: | The guessed release name (new prefix + new suffix) |
A simple version script parser.
This is the main initializator of the releases list. This simple parser receives the lines of a given version script, check its syntax, and construct the list of releases. Some semantic aspects are checked, like the existence of the * wildcard in global scope and the existence of duplicated release names.
It works by running a finite state machine:
- The parser states. Can be:
- name: The parser is searching for a release name or EOF
- opening: The parser is searching for the release opening {
- element: The parser is searching for an identifier name or }
- element_closer: The parser is searching for : or ;
- previous: The parser is searching for previous release name
- previous_closer: The parser is searching for ;
Parameters: | lines – The lines of a version script file |
---|
Bases: exceptions.Exception
Exception type raised by the map parser
Used mostly to keep track where an error was found in the given file
Bases: object
A internal representation of a release version and its symbols
A release is usually identified by the library name (suffix) and the release version (suffix). A release contains symbols, grouped by their visibility scope (global or local).
In this class the symbols of a release are stored in a list of dictionaries mapping a visibility scope name (e.g. “global”) to a list of the contained symbols:
([{"global": [symbols]}, {"local": [local_symbols]}])
name: The release name previous: The previous release to which this release is dependent symbols: The symbols contained in the release, grouped by the visibility
scope.
Bases: object
A singleton logger for the module
This class is a singleton logger factory. It takes advantage of the uniqueness of class attributes to hold a unique instance of the logger for the module. It logs to the default log output, and prints WARNING and ERROR messages to stderr. It allows the caller to provide a file to receive the log (the messages will be logged by all handlers: to stderr if WARNING or ERROR, to default log, and to the provided file)
Bump a version depending if the ABI was broken or not
If the ABI was broken, CUR is bumped; AGE and REV are set to zero. Otherwise, CUR is kept, AGE is bumped, and REV is set to zero. This also works with versions without the REV component (e.g. [1, 4, None])
Parameters: |
|
---|---|
Returns: | A list in format [CUR, AGE, REV] |
‘check’ subcommand
Check the content of a symbol version script
Parameters: | args – Arguments given in command line parsed by argparse |
---|
Check if output and input are the same file. Create a backup if so.
Parameters: |
|
---|
Receives a list of lines read from the input and returns a list of words
Parameters: | symbols – A list of lines containing symbols |
---|---|
Returns: | A list of the obtained symbols |
Get a parser for the command line arguments
The parser is capable of checking requirements for the arguments and possible incompatible arguments.
Returns: | A parser for command line arguments. (argparse.ArgumentParser) |
---|
Get the release information from the provided arguments
It is possible to set the new release name to be used through the command line arguments.
Parameters: | args – Arguments given in command line parsed by argparse |
---|
Get the information from a release name
The given string is split in a prefix (usually the name of the lib) and a suffix (the version part, e.g. ‘_1_4_7’). A list with the version info converted to ints is also contained in the returned list.
Parameters: | release – A string in format ‘LIBX_1_0_0’ or similar |
---|---|
Returns: | A list in format [release, prefix, suffix, [CUR, AGE, REV]] |
Get the version numbers from a string
Parameters: | version_string – A string composed by numbers separated by non alphanumeric characters (e.g. 0_1_2 or 0.1.2) |
---|---|
Returns: | A list of the numbers in the string |
‘new’ subcommand
Create a new version script file containing the provided symbols.
Parameters: | args – Arguments given in command line parsed by argparse |
---|
Given the new list of symbols, update the map
The symbols provided are considered all the exported symbols in the new version. Such set of symbols is compared to the previous existing symbols. If symbols are added, but nothing removed, it is a compatible change. Otherwise, it is an incompatible change and the SONAME of the library should be bumped.
If –add is provided, the symbols provided are considered new symbols to be added. This is a compatible change.
If –remove is provided, the symbols provided are considered the symbols to be removed. This is an incompatible change and the SONAME of the library should be bumped.
Parameters: | args – Arguments given in command line parsed by argparse |
---|