ElementsKernel package¶
Submodules¶
ElementsKernel.AddCppClass module¶
This script creates a new Elements C++ Class
file: | ElementsKernel/AddCppClass.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
-
ElementsKernel.AddCppClass.
checkClassFileNotExist
(class_name, module_dir, module_name, subdir)[source]¶ Check if the class file does not already exist
-
ElementsKernel.AddCppClass.
createCppClass
(module_dir, module_name, subdir, class_name, elements_dep_list, library_dep_list, opt_visibility, opt_template)[source]¶ Create all necessary files for a cpp class
-
ElementsKernel.AddCppClass.
createDirectories
(module_dir, module_name, subdir, opt_template)[source]¶ Create directories needed for a module and a class
-
ElementsKernel.AddCppClass.
getClassName
(subdir_class)[source]¶ Get the class name and sub directory if any
ElementsKernel.AddCppProgram module¶
This script creates a new Elements C++ Program
file: | ElementsKernel/AddCppProgram.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
-
ElementsKernel.AddCppProgram.
addConfFile
(module_dir, program_name)[source]¶ Create the configuration file by default
-
ElementsKernel.AddCppProgram.
createCppProgram
(module_dir, module_name, program_name, module_dep_list, library_dep_list)[source]¶ Creates all necessary files for a program
-
ElementsKernel.AddCppProgram.
createDirectories
(module_dir)[source]¶ Create directories needed for a program
ElementsKernel.AddModule module¶
This script creates a new Elements module
file: | ElementsKernel/AddModule.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
-
ElementsKernel.AddModule.
checkCmakelistFileExist
(project_directory)[source]¶ Checks if a <CMakeLists.txt> file exists and is really an Elements cmake file
-
ElementsKernel.AddModule.
checkDependencyListValid
(str_list)[source]¶ Check if the dependency name(s) is(are) valid
-
ElementsKernel.AddModule.
createCmakeListFile
(project_dir, module_name, module_dep_list, standalone=False)[source]¶ Create the <CMakeList.txt> file and add dependencies to it
-
ElementsKernel.AddModule.
createModule
(project_dir, module_name, dependency_list, standalone=False, answer_yes=False)[source]¶ Create a module, copy auxiliary files and substitute variables in the CMakefile.txt file
ElementsKernel.AddPythonModule module¶
This script creates a new Elements python module
file: | ElementsKernel/AddPythonModule.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
-
ElementsKernel.AddPythonModule.
createDirectories
(module_dir, module_name)[source]¶ Create directories needed for a python module
-
ElementsKernel.AddPythonModule.
createPythonModule
(module_dir, module_name, python_module_name)[source]¶ Create the python module
ElementsKernel.AddPythonProgram module¶
This script creates a new Elements module
file: | ElementsKernel/AddPythonProgram.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
-
ElementsKernel.AddPythonProgram.
createDirectories
(module_dir, module_name)[source]¶ Create directories needed for a python program
-
ElementsKernel.AddPythonProgram.
createFiles
(module_dir, module_name, program_name)[source]¶ Create files needed for a python program
-
ElementsKernel.AddPythonProgram.
createPythonProgram
(current_dir, module_name, program_name)[source]¶ Create the python program
-
ElementsKernel.AddPythonProgram.
makeChecks
(program_file_path, program_name)[source]¶ Make some checks
ElementsKernel.AddScript module¶
This script creates a new Elements module
file: | ElementsKernel/AddScript.py |
---|---|
author: | Hubert Degaudenzi |
date: | 03/08/17 |
-
ElementsKernel.AddScript.
createDirectories
(module_dir)[source]¶ Create directories needed for a python program
ElementsKernel.Auxiliary module¶
date: | Created on Feb 10 2017 |
---|---|
author: | Hubert Degaudenzi |
-
ElementsKernel.Auxiliary.
configure
(file_name, target_dir, target_name=None, use_stem=False, configuration=None, create_missing_dir=False)[source]¶ Copy/configuration of a file :param file_name: the original file name with or without a stem :param target_dir: the target directory :param target_name: the target name if any :param use_stem: choose if the stem (dirname) of the file_name will be used or only the last component (basename) of the file_name path. :param configuration: dictionary of item to replace in the text :param create_missing_dir: create intermediate directories if they don’t exist :return: the final target path for the copy/configuration.
ElementsKernel.Configuration module¶
date: | Created on Feb 10, 2017 |
---|---|
author: | Hubert Degaudenzi |
ElementsKernel.Constants module¶
Useful/conventional constants.
ElementsKernel.CreateProject module¶
This script will create a new Elements project
file: | ElementsKernel/Project.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
ElementsKernel.Exit module¶
date: | Created on 25 mai 2019 |
---|---|
author: | Hubert Degaudenzi |
ElementsKernel.GetFiles module¶
file: | ElementsKernel/GetElementsFiles.py |
---|---|
date: | Created on: 10/10/17 |
author: | Hubert Degaudenzi |
-
ElementsKernel.GetFiles.
defineSpecificProgramOptions
()[source]¶ @brief Allows to define the (command line and configuration file) options specific to this program
- @details
- See the Elements documentation for more details.
- @return
- An ArgumentParser.
ElementsKernel.Logging module¶
file: | ElementsKernel/Logging.py |
---|---|
date: | Apr 29, 2016 |
author: | Hubert Degaudenzi |
ElementsKernel.NameCheck module¶
This script check a name of a project, module or product agains a given online naming DB. The script return 0 if the entity exists and 1 if it doesn’t
file: | ElementsKernel/NameCheck.py |
---|---|
author: | Hubert Degaudenzi |
date: | 17/01/17 |
ElementsKernel.ParseCmakeLists module¶
- This module parses and updates the <CMakeLists.txt> file. It uses the
- ParseCmakeListsMacros module to parse each cmake macro.
file: | ElementsKernel/ParseCmakeLists.py |
---|---|
author: | Nikolaos Apostolakos, Nicolas Morisset |
date: | 01/07/15 |
ElementsKernel.ParseCmakeListsMacros module¶
- All these classes are for parsing the macros in the CMakeLists.txt file. Each class
- represents a cmake macro.
file: | ElementsKernel/ParseCmakeListsMacros.py |
---|---|
author: | Nicolas Morisset |
date: | 21/07/16 |
-
class
ElementsKernel.ParseCmakeListsMacros.
ElementsAddExecutable
(name, source, link_libraries, include_dirs)[source]¶ Bases:
object
Decode the <elements_add_executable> macro
-
class
ElementsKernel.ParseCmakeListsMacros.
ElementsAddLibrary
(name, source_list, link_libraries, include_dirs, public_headers)[source]¶ Bases:
object
Decode the <elements_add_library> macro
-
class
ElementsKernel.ParseCmakeListsMacros.
ElementsAddPythonExecutable
(name, module_name)[source]¶ Bases:
object
Decode the <elements_add_python_program> macro
-
class
ElementsKernel.ParseCmakeListsMacros.
ElementsAddUnitTest
(class_name, source, link_libraries, include_dir, key_type, exec_name)[source]¶ Bases:
object
Decode the <elements_add_unit_test> macro
-
class
ElementsKernel.ParseCmakeListsMacros.
ElementsDependsOnSubdirs
(subdir_list)[source]¶ Bases:
object
Decode the <elements_depends_on_subdirs> macro
ElementsKernel.Path module¶
date: | Created on Apr 29, 2016 |
---|---|
author: | Hubert Degaudenzi |
-
ElementsKernel.Path.
getAllPathFromLocations
(file_name, locations)[source]¶ Get all the paths to the searched file name from the provided locations.
-
ElementsKernel.Path.
getLocations
(file_type='executable', exist_only=False, with_defaults=True)[source]¶ Get the locations of a type of file – including the default ones
-
ElementsKernel.Path.
getLocationsFromEnv
(path_variable, exist_only=False)[source]¶ Get the list of locations provided by the path environment variable.
-
ElementsKernel.Path.
getPath
(file_name, file_type='executable', raise_exception=True)[source]¶ Get full path to the file name searched in the file-type path
-
ElementsKernel.Path.
getPathFromEnvVariable
(file_name, path_variable)[source]¶ Look for the first path valid in the <path_variable> environment variable where is located the <file_name> file. It returns the filename with the path or an empty string if not found. We assume that the file_name also contains any sub directory under the <path_variable> environment variable entry. :param file_name: file name to look for can be “Some.txt” or “/” path component like “SomeFolder/Some.txt” :param path_variable: name of the environment variable to look into :return: full path to the first match entry.
-
ElementsKernel.Path.
getPathFromLocations
(file_name, locations)[source]¶ Get the path to the searched file name from the provided locations. The first found wins.
-
ElementsKernel.Path.
getTargetPath
(file_name, target_dir, target_name=None, use_stem=False)[source]¶ Compute the target path for a copy/configuration of a file :param file_name: the original file name with or without a stem :param target_dir: the target directory :param target_name: the target name if any :param use_stem: choose if the stem (dirname) of the file_name will be used or only the last component (basename) of the file_name path. :return: the final target path for the copy/configuration.
-
ElementsKernel.Path.
join
(path_list)¶ stupid wrapper to look like the C++ call
-
ElementsKernel.Path.
multiPathAppend
(initial_locations, suffixes)[source]¶ Function to append all the suffixes to all the initial location :param initial_locations: as quoted the initial paths to be appended to :param suffixes: the extensions to be appended.
ElementsKernel.PhysicalConstants module¶
This script is a direct adaptation of CLHEP/Units/PhysicalConstants.h and the following is the originial CLHEP comment:
This file has been provided by Geant4 (simulation toolkit for HEP).
- The basic units are :
- millimeter nanosecond Mega electron Volt positon charge degree Kelvin amount of substance (mole) luminous intensity (candela) radian steradian
Below is a non exhaustive list of Physical CONSTANTS, computed in the Internal HEP System Of Units.
- Most of them are extracted from the Particle Data Book :
Phys. Rev. D volume 50 3-1 (1994) page 1233
…with a meaningful (?) name …
You can add your own constants.
Author: M.Maire
ElementsKernel.Program module¶
Main Program Class Module
-
class
ElementsKernel.Program.
Program
(app_module, parent_project_version=None, parent_project_name=None, parent_project_vcs_version=None, elements_module_name=None, elements_module_version=None, search_dirs=None, original_path='', elements_loglevel=10, use_config_file=True)[source]¶ Bases:
object
Main Program Class
ElementsKernel.Project module¶
This script will create a new Elements project
file: | ElementsKernel/Project.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
-
ElementsKernel.Project.
checkDependencyProjectValid
(str_list)[source]¶ Check if the dependency project name and version list is valid
-
ElementsKernel.Project.
checkProjectExist
(project_dir, no_version_directory, force_erase, answer_yes=False)[source]¶ Look for any version directory in the project directory e.g 1.0,1.2 etc…
-
ElementsKernel.Project.
createProject
(project_dir, proj_name, proj_version, dep_projects, standalone=False, visibility=False)[source]¶ Create the project structure
-
ElementsKernel.Project.
duplicate_elements
(duplicate_list)[source]¶ Look for duplicate element in a list
-
ElementsKernel.Project.
getProjectDirectory
(no_version_directory, destination_path, proj_name, proj_version)[source]¶ Build project directory path
-
ElementsKernel.Project.
getSubstituteConfiguration
(proj_name, proj_version, dep_projects, standalone=False, visibility=False)[source]¶ Format all dependent projects We put by default Elements dependency if no one is given
-
ElementsKernel.Project.
lookForDirectories
(project_dir)[source]¶ Look for any version directory in the project directory e.g HEAD, 1.2.3, 1.0 etc…
ElementsKernel.ProjectCommonRoutines module¶
This module offers some common routines used by the Elements scripts for creating (C++, python) projects, modules, classes etc..
file: | ElementsKernel/ProjectCommonRoutines.py |
---|---|
author: | Nicolas Morisset |
date: | 01/07/15 |
-
ElementsKernel.ProjectCommonRoutines.
addItemToCreationList
(element)[source]¶ Add an element to the global list.
-
ElementsKernel.ProjectCommonRoutines.
checkAuxFileExist
(aux_file_name)[source]¶ Make sure the <aux_file> auxiliary file exists. Return an exception in case of an error. <aux_file_name> is just the name without the path.
-
ElementsKernel.ProjectCommonRoutines.
checkFileNotExist
(path_filename, name)[source]¶ Check if the <path_filename> file does not already exist <path_filename> : path + filename
-
ElementsKernel.ProjectCommonRoutines.
checkNameAndVersionValid
(name, version)[source]¶ Check that the <name> and <version> respect a regex
-
ElementsKernel.ProjectCommonRoutines.
checkNameInEuclidNamingDatabase
(entity_name, entity_type='', answer_yes=False)[source]¶ Check if the entity_name (e.g. project name, module name, class name etc…) already exists in the Euclid Naming Database. This function displays warning messages if the element_name exists already or the database is not available.
-
ElementsKernel.ProjectCommonRoutines.
copyAuxFile
(destination, aux_file_name)[source]¶ Copy the <aux_file_name> file to the <destination> directory. <aux_file_name> is just the name without path
-
ElementsKernel.ProjectCommonRoutines.
createPythonInitFile
(init_path_filename)[source]¶ Create on disk the __init__.py python file
-
ElementsKernel.ProjectCommonRoutines.
deleteFile
(path_filename)[source]¶ Delete the <path_filename> file if it does exist. <path_filename> includes the path and filename.
-
ElementsKernel.ProjectCommonRoutines.
eraseDirectory
(directory)[source]¶ Erase a directory and its contents from disk
-
ElementsKernel.ProjectCommonRoutines.
getAuthor
()[source]¶ Get the contents of the <USER> environment variables
-
ElementsKernel.ProjectCommonRoutines.
getElementsModuleName
(module_directory)[source]¶ Get the module name from the <CMAKE_LISTS_FILE> file
-
ElementsKernel.ProjectCommonRoutines.
makeACopy
(cmakefile)[source]¶ Make a copy(backup) of the <CMakeFileLists.txt> file. The copy is named <CMakeFileLists.txt~>, <cmakefile> includes the path of the file.
-
ElementsKernel.ProjectCommonRoutines.
makeDirectory
(directory_path)[source]¶ Create a directory on disk if any
-
ElementsKernel.ProjectCommonRoutines.
printCreationList
()[source]¶ Print the contents of the file list
ElementsKernel.RemoveCppClass module¶
This script will remove all files related to a C++ class
file: | ElementsKernel/RemoveCppClass.py |
---|---|
author: | Nicolas Morisset |
date: | 02/10/16 |
ElementsKernel.RemoveCppProgram module¶
This script will remove all files related to a C++ program
file: | ElementsKernel/RemoveCppProgram.py |
---|---|
author: | Nicolas Morisset |
date: | 02/10/16 |
ElementsKernel.RemovePythonModule module¶
This script will remove all files related to a python module
file: | ElementsKernel/RemovePythonModule.py |
---|---|
author: | Nicolas Morisset |
date: | 02/10/16 |
ElementsKernel.RemovePythonProgram module¶
This script will remove all files related to a python program
file: | ElementsKernel/RemovePythonProgram.py |
---|---|
author: | Nicolas Morisset |
date: | 02/10/16 |
ElementsKernel.System module¶
This module irons out some of the system dependent constants
file: | ElementsKernel/Project.py |
---|---|
author: | Hubert Degaudenzi |
date: | 28.07.2016 |
ElementsKernel.SystemOfUnits module¶
System of Units Constants
This script is a direct adaptation of CLHEP/Units/SystemOfUnits.h and the following is the original CLHEP comment:
HEP coherent system of Units
This file has been provided to CLHEP by Geant4 (simulation toolkit for HEP).
- The basic units are :
- millimeter (millimeter) nanosecond (nanosecond) Mega electron Volt (MeV) positron charge (eplus) degree Kelvin (kelvin) the amount of substance (mole) luminous intensity (candela) radian (radian) steradian (steradian)
Below is a non exhaustive list of derived and pratical units (i.e. mostly the SI units). You can add your own units.
The SI numerical value of the positron charge is defined here, as it is needed for conversion factor : positron charge = e_SI (coulomb)
- The others physical constants are defined in the header file :
- PhysicalConstants.h
file: | ElementsKernel/SystemOfUnits.py |
---|---|
author: | Wim Lavrijsen (LBNL, WLavrijsen@lbl.gov) |
author: | Hubert Degaudenzi (ISDC – Hubert.Degaudenzi@unige.ch) |
date: | 01/21/04 |
ElementsKernel.Temporary module¶
create temporary structure for remote builds
author: | Hubert Degaudenzi |
---|
-
class
ElementsKernel.Temporary.
Environment
(orig=None, keep_same=False)[source]¶ Bases:
object
Class to changes the environment temporarily.
-
commit
()[source]¶ Forget the old values for the changes done so far (avoids that the changes are rolled-back when the instance goes out of scope).
-
gen_script
(shell_type)[source]¶ Generate a shell script to reproduce the changes in the environment.
-
get
(key, default=None)[source]¶ Implementation of the standard get method of a dictionary: return the value associated to “key” if present, otherwise return the default.
-
items
()[source]¶ Return the list of (name,value) pairs for the defined environment variables. Needed to provide the same interface as os.environ.
-
-
class
ElementsKernel.Temporary.
TempDir
(suffix='', prefix='tmp', base_dir=None, keep_var='KEEPTEMPDIR')[source]¶ Bases:
ElementsKernel.Temporary.TempResource
Class to create a temporary directory.
-
ElementsKernel.Temporary.
TempEnv
¶ alias of
ElementsKernel.Temporary.Environment
-
class
ElementsKernel.Temporary.
TempFile
(keep_var='KEEPTEMPDIR')[source]¶ Bases:
ElementsKernel.Temporary.TempResource
class to create a temporary file
ElementsKernel.Version module¶
Definition of a python package using extend_path to create a namespace
date: | Created on Jan 29, 2015 |
---|---|
author: | Hubert Degaudenzi |
Module contents¶
Definition of a python package using extend_path to create a namespace
Created on Apr 29, 2016
author: | hubert |
---|