99 строки
4.0 KiB
Python
99 строки
4.0 KiB
Python
# ----------------------------------------------------------------------
|
|
# |
|
|
# | Activate_custom.py
|
|
# |
|
|
# | David Brownell <db@DavidBrownell.com>
|
|
# | 2018-05-07 08:59:57
|
|
# |
|
|
# ----------------------------------------------------------------------
|
|
# |
|
|
# | Copyright David Brownell 2018-19.
|
|
# | Distributed under the Boost Software License, Version 1.0.
|
|
# | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
# |
|
|
# ----------------------------------------------------------------------
|
|
"""Performs repository-specific activation activities."""
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.getenv("DEVELOPMENT_ENVIRONMENT_FUNDAMENTAL"))
|
|
from RepositoryBootstrap.SetupAndActivate import CommonEnvironment, CurrentShell
|
|
|
|
del sys.path[0]
|
|
|
|
# ----------------------------------------------------------------------
|
|
_script_fullpath = CommonEnvironment.ThisFullpath()
|
|
_script_dir, _script_name = os.path.split(_script_fullpath)
|
|
# ----------------------------------------------------------------------
|
|
|
|
# <Class '<name>' has no '<attr>' member> pylint: disable = E1101
|
|
# <Unrearchable code> pylint: disable = W0101
|
|
# <Unused argument> pylint: disable = W0613
|
|
|
|
# ----------------------------------------------------------------------
|
|
def GetCustomActions(
|
|
output_stream,
|
|
configuration,
|
|
version_specs,
|
|
generated_dir,
|
|
debug,
|
|
verbose,
|
|
fast,
|
|
repositories,
|
|
is_mixin_repo,
|
|
):
|
|
"""
|
|
Returns an action or list of actions that should be invoked as part of the activation process.
|
|
|
|
Actions are generic command line statements defined in
|
|
<Common_Environment>/Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/Shell/Commands/__init__.py
|
|
that are converted into statements appropriate for the current scripting language (in most
|
|
cases, this is Bash on Linux systems and Batch or PowerShell on Windows systems.
|
|
"""
|
|
|
|
return []
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
|
def GetCustomScriptExtractors():
|
|
"""
|
|
Returns information that can be used to enumerate, extract, and generate documentation
|
|
for scripts stored in the Scripts directory in this repository and all repositories
|
|
that depend upon it.
|
|
|
|
****************************************************
|
|
Note that it is very rare to have the need to implement
|
|
this method. In most cases, it is safe to delete it.
|
|
****************************************************
|
|
|
|
There concepts are used with custom script extractors:
|
|
|
|
- DirGenerator: Method to enumerate sub-directories when searching for scripts in a
|
|
repository's Scripts directory.
|
|
|
|
def Func(directory, version_sepcs) -> [ (subdir, should_recurse), ... ]
|
|
[ subdir, ... ]
|
|
(subdir, should_recurse)
|
|
subdir
|
|
|
|
- CreateCommands: Method that creates the shell commands to invoke a script.
|
|
|
|
def Func(script_filename) -> [ command, ...]
|
|
command
|
|
None # Indicates not supported
|
|
|
|
- CreateDocumentation: Method that extracts documentation from a script.
|
|
|
|
def Func(script_filename) -> documentation string
|
|
|
|
- ScriptNameDecorator: Returns a new name for the script.
|
|
|
|
def Func(script_filename) -> name string
|
|
|
|
See <Common_Environment>/Activate_custom.py for an example of how script extractors
|
|
are used to process Python and PowerShell scripts.
|
|
"""
|
|
|
|
return
|