BASIS  r3148
basisproject Namespace Reference

Classes

class  AccumulatorForNumbersOfChangesAndErrors
class  ConfigAction
class  FullTemplateAction
class  MinimalTemplateAction
class  ModuleTemplateAction
class  OptAction
class  StandardTemplateAction
class  TopLevelTemplateAction

Functions

def add
def add_dependencies
def addordel
def alter
def delete
def get_default_template_options
def get_project_name
def get_standard_template_options
def get_template
def get_template_options
def get_template_version
def remove_directory
def update_template_version

Variables

tuple _EXEC_DIR = basis.exedir()
tuple _EXEC_NAME = basis.exename()
tuple _template = os.path.abspath(os.path.join(_EXEC_DIR, '../share/template'))
tuple acc = AccumulatorForNumbersOfChangesAndErrors()
int ADD = 1
tuple args = parser.parse_args()
 create = True
int DEL = 1
tuple file_path = os.path.join(root, filename)
string help = "Show version information and exit."
int nargs = 0
 ok = True
tuple opts = get_default_template_options(args.root, args.opts, create)
tuple original_template_version = get_template_version(os.path.join(args.root, 'CMakeLists.txt'))
tuple parser
string type = '-1.7'
string version

Function Documentation

def basisproject::add (   path,
  args,
  isdir = False 
)
Add or modify project directory or file.

@param [in] path  The path of the directory or file relative to the
                  template or project root, respectively.
@param [in] args  Namespace with command-line arguments.
@param [in] isdir Whether @p path is a directory that may not have
                  a corresponding template.

@retval -1 on error
@retval  0 if existing file is up to date
@retval  1 if project file has been added/updated
@retval  2 if project file has been updated, but with conflicts

Definition at line 331 of file basisproject.py.

def basisproject::add_dependencies (   txt,
  deps,
  required = True,
  test = False 
)
Add dependencies to basis_project() command in BasisProject.cmake file.

Definition at line 198 of file basisproject.py.

def basisproject::addordel (   op,
  path,
  args,
  isdir = False 
)
Add/update or delete file or directory depending on operation specified.

@param [in] op    Operations. Either one of ADD, None, or DEL.
@param [in] path  File path relative to template or project root, respectively.
@param [in] args  Namespace with command-line arguments.
@param [in] isdir Whether @p path is a directory path that may not have
                  a corresponding template.

@retval -1 on error
@retval  0 if nothing was done
@retval  1 if operation was successful

Definition at line 625 of file basisproject.py.

def basisproject::alter (   filename,
  args,
  backup = True,
  update = False 
)
Alter project file, i.e., substitute placeholders.

@param [in] filename Path of text file to alter.
@param [in] args     Command-line arguments.
@param [in] backup   Whether to backup file before overwriting it.
@param [in] update   Whether template file is generated for the update
                     of an existing project file. In this case, certain
                     modifications should not be applied to avoid conflicts.

@retval -1 on error
@retval  0 if file was not modified
@retval  1 if file has been modified

Definition at line 215 of file basisproject.py.

def basisproject::delete (   path,
  args,
  isdir = False 
)
Delete file or empty directory.

@param [in] path  Path relative to template or project root, respectively.
@param [in] args  Namespace with command-line arguments.
@param [in] isdir Whether @p path is a directory path that may not have
                  a corresponding template.

@retval -1 on error
@retval  0 if file/directory did not exist
@retval  1 if file/directory was removed

Definition at line 518 of file basisproject.py.

def basisproject::get_default_template_options (   root,
  opts,
  create 
)
Select default options.

Definition at line 110 of file basisproject.py.

def basisproject::get_project_name (   cmake_file)
Extract project name from BasisProject.cmake file of existing project.

Definition at line 136 of file basisproject.py.

def basisproject::get_standard_template_options (   opts,
  overwrite = False 
)
Select standard project template.

Definition at line 69 of file basisproject.py.

def basisproject::get_template (   template,
  path 
)

Definition at line 160 of file basisproject.py.

def basisproject::get_template_options (   op = None)

Definition at line 49 of file basisproject.py.

def basisproject::get_template_version (   cmake_file)
Extract template version from root CMakeLists.cmake file of existing project.

Definition at line 146 of file basisproject.py.

def basisproject::remove_directory (   path)

Definition at line 506 of file basisproject.py.

def basisproject::update_template_version (   args)
Update template version in root CMakeLists.txt file of project.

Definition at line 299 of file basisproject.py.


Variable Documentation

tuple basisproject::_EXEC_DIR = basis.exedir()

Definition at line 34 of file basisproject.py.

tuple basisproject::_EXEC_NAME = basis.exename()

Definition at line 35 of file basisproject.py.

tuple basisproject::_template = os.path.abspath(os.path.join(_EXEC_DIR, '../share/template'))

Definition at line 42 of file basisproject.py.

Definition at line 39 of file basisproject.py.

tuple basisproject::args = parser.parse_args()

Definition at line 969 of file basisproject.py.

Definition at line 975 of file basisproject.py.

Definition at line 38 of file basisproject.py.

tuple basisproject::file_path = os.path.join(root, filename)

Definition at line 1060 of file basisproject.py.

string basisproject::help = "Show version information and exit."

Definition at line 719 of file basisproject.py.

Definition at line 852 of file basisproject.py.

Definition at line 673 of file basisproject.py.

tuple basisproject::opts = get_default_template_options(args.root, args.opts, create)

Definition at line 1049 of file basisproject.py.

tuple basisproject::original_template_version = get_template_version(os.path.join(args.root, 'CMakeLists.txt'))

Definition at line 1032 of file basisproject.py.

Initial value:
00001 argparse.ArgumentParser(prog='basisproject', description="""  This command-line tool, also referred to as project tool, can be used to  create a new project from the BASIS project template version 1.7 or to modify a  previously created BASIS project.  Depending on the grade of customization or optional inclusion of template  components, different subsets of the fully featured project template can be  selected. Additional template files and directories can be added to an existing  project at any time. Further, if the --no* options are given explicitly,  project files which were previously copied from the template are deleted.  Files are, however, only deleted if they were not modified by the project  developer since their creation and hence do not contain project related changes.  Similarly are directories deleted by this tool only if empty. The deletion of  modified files can be forced by supplying the --force option.  Besides the name of the new project and a brief description, names of external  packages required or optionally used by this project can be specified. For each  such package, an entry in the list of dependencies given as argument to either  one of the DEPENDS* options of the basis_project() command is added.  An additional feature of this tool is, that it can upgrade an existing project  to a newer project template version, given that the existing directory structure  and file names were preserved. User changes to previously added template files  are preserved and merged with the changes of the template using a so-called  three-way diff similar to the Subversion tool svn. If the automatic file merge  is not successful, a copy of the original project file (*.mine) as well as the  new template file (*.template) are written to the project directory next to the  project file which has been overwritten with the merged content which includes  markers to indicate where the conflicts occurred. The project file has to be  edited manually in this case to resolve any conflicts. Once the conflicts have  been resolved, the *.mine and *.template files must be removed before this  tool can be used for another update of the project files. This can be done  either manually or by running this program with the --cleanup option.""",
00002         formatter_class=argparse.ArgumentDefaultsHelpFormatter)

Definition at line 677 of file basisproject.py.

string basisproject::type = '-1.7'

Definition at line 746 of file basisproject.py.

Initial value:
00001 """%(prog)s (BASIS) r3148
00002 Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.
00003 See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file."""

Definition at line 720 of file basisproject.py.