ApplicationVersioningSupport

VCSQuery / SVNQuery

ApplicationVersioningSupport.VCSQuery.GetQueryForPath(path, pathToSvnExe=None)[source]

Creates and returns the correctly typed VCSQuery object (e.g. SVNQuery for svn repositories)

Parameters:
  • path – Path to check for versioning system

  • pathToSvnExe – If omitted, it is assumed that svn commandline executable is in the PATH

Returns:

Correctly typed VCSQuery object or None if none is found

ApplicationVersioningSupport.VCSQuery.ExtractPathInfoToFiles(samplePath, targetFileBase=None)[source]

Extracts VCS path info for the given samplePath into files a version string from a version history file and writes it to another files for further processing. See PATH_INFO_FILE_SUFFIXES for the kinds of files created

Parameters:
  • samplePath – Filename of the version history to parse for the current version number

  • targetFileBase – Folder or file to place the result files in, see PATH_INFO_FILE_SUFFIXES for what’s appended for each result. If None, samplePath is used.

Returns:

None

class ApplicationVersioningSupport.VCSQuery.SVNQuery(pathToVCSExe=None)[source]

Bases: VCSQuery

getRevision(path)[source]

Returns the revision of path (i.e. NOT the last changed revision in the working copy).

Parameters:

path – Path to a working copy file or directory

Returns:

Revision of the repository the path is organized in, None if no evaluation was possible

getWorkingCopyRevisionInfo(path)[source]

Returns the revision info for the root of the working copy path is located in (i.e. NOT the revision of path or the last changed revision in the working copy). The result format follows svnversion result format, e.g. if you have a mixed checkout, you will get the minimum and maximum revision number of the working copy, separated by a colon. If your working copy contains modifications, the result suffix will contain an ‘M’.

Parameters:

path – Path to a working copy file or directory

Returns:

Revision info in svnversion format for the working copy the path is located in, None if no evaluation was possible

getRepositoryURL(path)[source]
Returns the repository part of the URL, i.e. for a path https://svn.lan/trunk/dir/file the string https://svn.lan is

returned.

Parameters:

path – Path to a working copy file or directory

Returns:

Repository part of the URL, None if no evaluation was possible

getRelativeURL(path)[source]
Returns the relative part of the URL, i.e. for a path “https://svn.lan/trunk/dir/file” the string “trunk/dir/file”

is returned.

Parameters:

path – Path to a working copy file or directory

Returns:

Relative part of the URL, None if no evaluation was possible

getRelativeBranchURL(path, firstNonBranchSubString='FME')[source]

Returns the ‘branch’ part of the relative part of the URL, i.e. for a path https://svn.lan/trunk/FMEwork/dir/file the string “trunk” is returned.

Parameters:
  • path – Path to a working copy file or directory

  • firstNonBranchSubString – string to search for

Returns:

Relative part of the URL, None if no evaluation was possible

canEvaluatePath(path)[source]

Returns True if the given path can be evaluated using SVN

Parameters:

path – Path to a working copy file or directory

Returns:

True if the given path can be evaluated using SVN

VersionHistoryFileParser

exception ApplicationVersioningSupport.VersionHistoryFileParser.VersionHistoryFileParserError[source]

Bases: Exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception ApplicationVersioningSupport.VersionHistoryFileParser.VersionInfoFileNotFoundException[source]

Bases: VersionHistoryFileParserError

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

ApplicationVersioningSupport.VersionHistoryFileParser.ReadVersionHistoryStringFromFile(versionHistoryFileName)[source]

Reads a version info file and returns its contents as a string

Parameters:

versionHistoryFileName – Path to the version history text file

Raises:

VersionInfoFileNotFoundException if file is not found

Raises:

IOError if reading fails for some reason

Returns:

The contents of the file

ApplicationVersioningSupport.VersionHistoryFileParser.GetCurrentVersionInfoFromFile(inputFilename)[source]

Extracts the current version info from a version history file and returns it

Parameters:

inputFilename – Input version history file, expected to have a “Current Version:” tag.

Returns:

Extracted VersionInfo object

ApplicationVersioningSupport.VersionHistoryFileParser.PrintCurrentVersionStringToStdout(inputFilename)[source]

Extracts a version string from a version history file and prints it to stdout. This is handy in .pro files where the version number should be embedded in binares. Note that this method catches all exceptions and returns its success instead

Parameters:

inputFilename – Filename of the version history to parse for the current version number

Returns:

True on success

ApplicationVersioningSupport.VersionHistoryFileParser.ExtractCurrentVersionStringToFile(inputFilename, outputFilename)[source]

Extracts a version string from a version history file and writes it to another file for further processing. This is handy in installer definitions where the version number shall be read from a file. Note that this method catches all exceptions and returns its success instead

Parameters:
  • inputFilename – Filename of the version history to parse for the current version number

  • outputFilename – Filename for the extracted version string

Returns:

True on success

ApplicationVersioningSupport.VersionHistoryFileParser.ExtractCurrentVersionStringToFiles(versionHistoryFileName)[source]

Extracts a version string from a version history file and writes it to another files for further processing. Creates three files containing complete version string, major and minor part where the file names are derived from input version history file name using dedicated suffixes.

Parameters:

versionHistoryFileName – Filename of the version history to parse for the current version number

Raises:

VersionHistoryFileParserError on any error

VersionHistory

class ApplicationVersioningSupport.VersionHistory.VersionHistory[source]

Bases: object

Information about an application’s version history.

VersionHistoryParser

class ApplicationVersioningSupport.VersionHistoryParser.GetVersionHistoryFromString(*args, **kwargs)[source]

Bases: object

Can parse a version history string and generate a VersionHistory object from it. Looks like a class but can be used like a function.

Parameters:
  • inputString – version history string to parse

  • parsingParameters – define how to parse the file, see ParsingParameters documentation

Raises:

VersionInfoCurrentVersionNotFoundException if the current version could not be found in the string

Returns:

The VersionHistory object read

VersionInfo

class ApplicationVersioningSupport.VersionInfo.VersionInfo(majorVersionString='', minorVersionString='')[source]

Bases: object

Information about a single version, e.g. major and minor version number, possibly a list of changes and known bugs.

setMajorVersionString(majorVersionString)[source]

Sets the major version as string.

setMinorVersionString(minorVersionString)[source]

Sets the minor version as string.

getMajorVersionString()[source]

Returns the major version as string.

getMinorVersionString()[source]

Returns the minor version as string.

getVersionString()[source]

Returns the version as a composed string ‘<major> <minor>’