Source code for gdeps.keys
#!python3
# Copyright 2007-2017 Gemr. All Rights Reserved.
# Licensed to MIT see LICENSE.txt
__author__ = 'Suryavarman (http://sourceforge.net/u/suryavarman/profile/)'
[docs]class Keys:
""" Contain all the keys can be use in your project.
You can copy the string for more clarity
or to detect the futures changes use GDeps.Keys.ms_XXX
**Example**
>>> params["maker_subir"] = "subdir1/subdir/"
or
>>> params[GDeps.Keys.ms_SubDir] = "subdir1/subdir/"
"""
ms_FolderDir = "folderdir"
""" It can be name : working directory.
The folder where the repository will be clone/checkout.
It's also the project default maker/ide... directory
"""
ms_ConfigFilePath = "config_filepath"
""" The config dir + filename """
ms_CompilerAliasPrefix = "compiler"
r""" In your config file define a compiler with the prefix : «compiler»
and add the alias key word to link with the compiler config
**Example**
>>> [compiler_0]
>>> type=Mingw_32
>>> name=mingw_32
>>>
>>> [compiler_windows]
>>> type=VC120_32
>>> name=vc120_32
>>>
>>> [compilerOldVC]
>>> type=VC90_32
>>> name=vc90_32
>>>
>>> [mingw_32]
>>> dir = C:\TDM-GCC-32\bin
>>>
>>> [vc90_32]
>>> dir = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE
>>>
>>> [vc120_32]
>>> dir = C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
"""
ms_Targets = "targets"
""" List of all the build targets.
By default is GDeps.Target.release_dynamic without any args.
The target args values :
#. inTargetType :
#. inArgs : dictionary
#. inx86Args : dictionary
#. inx64Args : dictionary
#. inCompilersArgs : dictionary
**Example**
>>> targets = []
>>> targets.append( GDeps.TargetArgs( GDeps.Target.release_dynamic, {}, { "-DOGREDEPS_PLATFORM_X64" : "FALSE" }, { "-DOGREDEPS_PLATFORM_X64" : "TRUE" }, {} ) )
>>>
>>> params["targets"] = aTargets
"""
ms_ArchiverAlias = "archiver_alias"
""" Alias to use a file achiver to download and extract an archive.
The possible alias type are:
#. SevenZip
**Example**
*Project file:*
>>> params["archiver_alias"] = "7zip"
*Config file:*
The 7zip Alias
>>> [7zip]
>>> type=SevenZip
>>> name=7zip_dir
*The 7zip directory:*
>>> [7zip_dir]
>>> exepath=C:\\Program Files\\7-Zip\\7z.exe
"""
ms_ArchiveUrl = "archive_url"
""" This is the archive url
**Example**
>>> params["archiver_alias"] = "7zip"
>>> params["archive_url"] = "http://gdeps.org/archives/zip-2.3-3-bin.zip"
"""
ms_ArchiveFolder = "archive_folderdir"
""" To override the default GDeps.Keys.ms_FolderDir extract path.
**Example**
>>> scriptdir = os.path.dirname(os.path.abspath(__file__))
>>>
>>> params["folderdir"] = scriptdir + "\\codeblocks"
>>> params["archiver_alias"] = "7zip"
>>> params["archive_url"] = "http://gdeps.org/archives/zip-2.3-3-bin.zip"
>>> params["archive_folderdir"] = aParams["folderdir"] + "\\src"
"""
ms_RepoAlias = "repo_alias"
r""" Alias to link with a version control system config.
The possible alias type are:
#. Git
#. Mercurial
#. Svn
**Example**
*Project file:*
>>> params["repo_alias"] = "hg"
*Config file:*
The Mercurial Alias
>>> [hg]
>>> type=Mercurial
>>> name=hg_64
*The Mercurial directory:*
>>> [hg_64]
>>> exepath="C:\\Program Files (x86)\\CMake\\bin\\cmake.exe"
"""
ms_RepoUrl = "repo_url"
""" This is the repository url/path
**Example**
>>> params["repo_alias"] = "hg"
>>> params["repo_url"] = "https://bitbucket.org/cabalistic/ogredeps"
"""
ms_RepoCloneArgs = "repo_cloneargs"
""" For some repository use that to add some parameters.
**Example**
1)
>>> gdeps.Keys.ms_RepoAlias: = "git",
>>> gdeps.Keys.ms_RepoUrl: "https://github.com/wxWidgets/wxWidgets.git",
>>> gdeps.Keys.ms_RepoCloneArgs: "--branch WX_3_0_BRANCH",
2)
>>> gdeps.Keys.ms_RepoAlias: "git",
>>> gdeps.Keys.ms_RepoUrl: "https://github.com/boostorg/boost.git",
>>> gdeps.Keys.ms_RepoCloneArgs: "--branch boost-1.64.0",
"""
ms_RepoUpdateArgs = "repo_updateargs"
""" For some repository use that to add some parameters.
**Example**
>>> params["repo_alias"] = "hg"
>>> params["repo_url"] = "ssh://hg@bitbucket.org/cabalistic/ogredeps"
>>> params["repo_updateargs"] = "tip"
"""
ms_RepoList = "repo_list"
""" For some repository use that to add some parameters.
You can mix «repo_alias» and «repo_list».
**Example**
the repository A will be clone to the project «folderdir»
the repository B will be clone to the project «repo_dir» a sub dir of «folderdir»
The cloning order will be :
1) http://git.code.sf.net/p/tinyxml/git
2) repo_a
2) repo_b
>>> params = []
>>> params["folderdir"] = scriptdir + r"\\dummy_example"
>>> params[gdeps.Keys.ms_RepoAlias] = "git"
>>> params[gdeps.Keys.ms_RepoUrl] = "http://git.code.sf.net/p/tinyxml/git"
>>> params[gdeps.Keys.ms_RepoCloneArgs] = 'tinyxml-git'
>>>
>>> repo_a = {}
>>> repo_a["repo_alias"] = "hg"
>>> repo_a["repo_url"] = "ssh://hg@bitbucket.org/cabalistic/ogredeps"
>>> repo_a["repo_updateargs"] = "tip"
>>>
>>> repo_b = {}
>>> repo_b["repo_dir"] = r"\\wxwidgets_2_8"
>>> repo_b["repo_alias"] = "svn"
>>> repo_b["repo_url"] = "http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH/"
>>>
>>> params["repo_list"] = [repo_a, repo_b]
"""
ms_RepoDir = 'repo_dir'
""" Only for the repository define into the repository list.
Please see GDeps.Keys.ms_RepoList.
Define the directory inside the folder dir.
"""
ms_MakerSubDir = "maker_subdir"
""" Specify the makfile directory inside the folder dir.
Usually the associate value it's a string.
"""
ms_MakerArgs = "maker_args"
""" Specify the arguments to the maker.
Usually the associate value it's a dictionary.
"""
ms_MakerSolutionName = "maker_solutionname"
""" Define the solution name for the maker
**Example**
[...]
>>> params["maker_type"] = "Bakefile029"
>>> params["maker_solutionname"] = "makefile"
[...]
"""
ms_MakerType = "maker_type"
""" Some maker doesn't need an application to generate the solution.
To define them you have to use this key.
The possible values are:
#. boost2
#. boostJam
#. Bakefile029
**Example**
>>> params["maker_type"] = "Bakefile029"
"""
ms_MakerAlias = "maker_alias"
r""" To link with a maker define in the config file
The possible alias type are:
#. CMake
**Example**
*Project file:*
>>> params["maker_alias"] = "cmake"
*Config file*:
The cmake Alias:
>>> [cmake]
>>> type=CMake
>>> name=cmake32
*The CMake configuration:*
>>> [cmake32]
>>> exepath="C:\\Program Files (x86)\\CMake\\bin\\cmake.exe"
.. note:
Some maker doesn't need an application to generate the solution.
To define them you have to use gdeps.Keys.ms_MakerType and not gdeps.Keys.ms_MakerAlias
"""
ms_MakerExePath = "maker_exepath"
r""" Define the exepath to execute the maker
.. note: If it's define the override the config file value
**Example**
*Project file:*
>>> params["maker_exepath"] = "C:\\Program Files (x86)\\CMake\\bin\\cmake.exe"
*Config file:*
The cmake Alias:
>>> [cmake]
>>> type=CMake
>>> name=cmake32
*he CMake configuration:*
>>> [cmake32]
>>> exepath="C:\\Program Files (x86)\\CMakexXx\\bin\\cmake.exe"
In this example the cmake exepath value will be :
"C:\\Program Files (x86)\\CMake\\bin\\cmake.exe"
"""
ms_IdeAliasPrefix = "ide"
r""" In your config file define an ide with the prefix "ide"
and add the alias key word to link with the ide config
By default the prefix is ide.
**Example**
>>> [ide_0]
>>> type=CodeBlocks
>>> name=cb_32
>>> compiler_alias_0=compiler_0
>>> # see also ms_CompilerAliasPrefix example
>>>
>>> [ide_1]
>>> type=Visual2008
>>> name=vc2008_32
>>> compiler_alias_0=compilerOldVC
>>> # see also ms_CompilerAliasPrefix example
>>>
>>> [ide_2]
>>> type=Visual2013
>>> name=vc2013_32
>>> compiler_alias_0=compiler_windows
>>> # see also ms_CompilerAliasPrefix example
>>>
>>> [cb_32]
>>> dir = C:\CodeBlocks
>>>
>>> [vc2008_32]
>>> dir = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE
>>>
>>> [vc2013_32]
>>> dir = C:\Program Files (x86)\MSBuild\12.0\Bin
"""
ms_IdeArgs = "ide_args"
""" To pass a dictionary arguments.
.. note:
With codeblocks you can define a global compiler variable with the
prefix #
**Example**
>>> gcvs = {}
>>> gcvs['#wx'] = self.m_wx28
>>> gcvs['#cb_release_type'] = '-O2'
>>> gcvs['#cb'] = aCodeBlocksIDE.m_Dir
>>> gcvs['#boost'] = self.m_boost
[...]
>>> params["ide_args"] = gcvs
"""
ms_IdeAddInclude = 'ide_add_include'
"""
>>> params["ide_add_include"] = [r'X:\\libA\\include', r'X:\\libB\\include']
"""
ms_IdeAlias = "ide_alias"
r""" Use a specific ide to build a workspace/solution/project.
To do that you can create manually a prefab to retrieve the ide section
name.
**Example**
See test_codeblocks.py
>>> aConfigFile = GDeps.ConfigFile( settings.g_CurrendFolder + "\\test_codeblocks.cfg" )
>>> aIdeAlias = GDeps.Alias( aConfigFile, 'codeblocks' )
>>>
>>> aCompilers = {}
>>>
>>> aCodeBlocksIDE = getattr( GDeps, aIdeAlias.m_Type )( aConfigFile, aIdeAlias.m_Name, aCompilers )
>>>
>>> gcvs = {}
>>> gcvs['#wx'] = self.m_wx28
>>> gcvs['#cb_release_type'] = '-O2'
>>> gcvs['#cb'] = aCodeBlocksIDE.m_Dir
>>> gcvs['#boost'] = self.m_boost
>>>
>>> params = {}
>>>
>>> params["config_filepath"] = settings.g_CurrendFolder + "\\test_codeblocks.cfg"
>>>
>>> params["folderdir"] = settings.g_CurrendFolder + "\\codeblocks\\src"
>>>
>>> params["repo_alias"] = "svn"
>>> params["repo_url"] = "svn://svn.code.sf.net/p/codeblocks/code/trunk"
>>> params["ide_alias"] = aIdeAlias.m_SectionName
>>> params["ide_solutionname"] = "CodeBlocks"
>>> params["ide_args"] = gcvs
>>> params["ide_wildcard"] = "workspace"
>>>
>>> project = GDeps.Projects(params)
>>> project.go()
"""
ms_IdeAliasList = "ide_alias_list"
r""" Use a specific list of ide to build a workspace/solution/project.
To do that you can create manually a prefab to retrieve the ides section
name.
**Example**
See test_codeblocks.py
>>> aConfigFile = GDeps.ConfigFile(settings.g_CurrendFolder + "\\test_codeblocks.cfg")
>>>
>>> params = {}
>>>
>>> params["config_filepath"] = settings.g_CurrendFolder + "\\test_codeblocks.cfg"
>>>
>>> params["folderdir"] = settings.g_CurrendFolder + "\\codeblocks\\src"
>>>
>>> params["repo_alias"] = "svn"
>>> params["repo_url"] = "svn://svn.code.sf.net/p/codeblocks/code/trunk"
>>> ide_list = []
>>>
>>> cb_section = 'codeblocks'
>>> if configFile.getSection(cb_section):
>>> aIdeAlias = GDeps.Alias(aConfigFile, cb_section)
>>>
>>> aCompilers = {}
>>>
>>> aCodeBlocksIDE = getattr(GDeps, aIdeAlias.m_Type)(aConfigFile, aIdeAlias.m_Name, aCompilers)
>>>
>>> gcvs = {}
>>> gcvs['#wx'] = self.m_wx28
>>> gcvs['#cb_release_type'] = '-O2'
>>> gcvs['#cb'] = aCodeBlocksIDE.m_Dir
>>> gcvs['#boost'] = self.m_boost
>>>
>>> ide_1 = {}
>>> ide_1["ide_alias"] = aIdeAlias.m_SectionName
>>> ide_1["ide_solutionname"] = "Test"
>>> ide_1["ide_args"] = gcvs
>>> ide_1["ide_wildcard"] = "workspace"
>>>
>>> ide_list.append(ide_1)
>>>
>>> ide_2 = {}
>>> ide_2["ide_alias"] = 'visual2010'
>>> ide_2["ide_solutionname"] = "Test"
>>> ide_2["ide_wildcard"] = "sln"
>>> ide_list.append(ide_2)
>>>
>>> params['ide_alias_list'] = ide_list
>>>
>>> project = GDeps.Projects(params)
>>> project.go()
"""
ms_IdeSolutionSubDir = "ide_solutionsubdir"
r""" Specify the solution directory inside the folder dir.
Usually the associate value it's a string.
The default value is empty.
A possible value is "src". In this case the solution path is in
folderdir + "\\" + "src"
"""
ms_IdeSolutionName = "ide_solutionname"
""" For the ide define the solution name without the wildcard.
**Example:**
:file:`test_codeblocks.py`
>>> params["ide_solutionname"] = "cbil"
>>> params["ide_args"] = aGCVs
>>> params["ide_wildcard"] = "workspace"
"""
ms_IdeWildcard = "ide_wildcard"
""" The wildcard for the ide project
The possible values are:
#. workspace (CB)
#. cbp (CB)
#. sln (VC90 & VC120)
#. vcproj (VC90)
#. vcxproj (VC120)
**Example**
:file:`test_codeblocks.py`
>>> params["ide_wildcard"] = "workspace"
"""
ms_IdeTargetName = "ide_targetname"
""" Sometime you have to override the usual target name
**Example**
Usually the codeblocks solution have the target "all" write in
minuscule. For the Codeblecks project we have to redine it with
a majuscule.
>>> params["ide_targetname"] = "All"
"""
ms_IncludePrefix = "include"
r""" To merge others config with your config file.
@remarks be carefully with the full cycle inclusion. There are no
security for that.
**Example**
Config file:
>>> [tag]
>>> include_directories="..\\directories.cfg"
"""
ms_ExePath = "exepath"
r""" Some object config need to have an executable directory
Be care full (or not some time no!!!) don't write manually the paths
with double backslash \\ but only one backslash \ the python parser add
the double backslash \\
"""
ms_boostUserConfigPath = "boost_user_config_path"
""" Define another path to find the user-config.jam
"""
ms_BakeFile029OutputFolders = "OUTPUT_FOLDERS"
""" See the argument inArgs of constructor GDeps.Bakefile029
**Example**
'OUTPUT_FOLDERS' : aFolderDir + r'\\build\\msw;' + aFolderDir + r'\\lib;'
"""
ms_BakeFile029UseSameOutputFolder = "USE_SAME_OUTPUT_FOLDER"
""" See the argument inArgs of constructor GDeps.Bakefile029
**Example**
'USE_SAME_OUTPUT_FOLDER' : True
"""