),
    filter_unsupported_extensions=CommandLine.EntryPoint.Parameter(
        "Ignore extensions that aren't supported; by default, unsupported extensions will generate an error"
    ),
    filter_unsupported_attributes=CommandLine.EntryPoint.Parameter(
        "Ignore element attributes that aren't supported; by default, unsupported attributes will generate an error"
    ),
    plugin_arg=CommandLine.EntryPoint.Parameter(
        "Argument passes directly to the plugin"),
    force=CommandLine.EntryPoint.Parameter("Force generation"),
    verbose=CommandLine.EntryPoint.Parameter(
        "Generate verbose output during generation"),
)
@CommandLine.Constraints(
    plugin=_PluginTypeInfo,
    output_name=CommandLine.StringTypeInfo(),
    output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False, ),
    input=CommandLine.FilenameTypeInfo(
        match_any=True,
        arity="+",
    ),
    include=CommandLine.StringTypeInfo(arity="*", ),
    exclude=CommandLine.StringTypeInfo(arity="*", ),
    output_data_filename_prefix=CommandLine.StringTypeInfo(arity="?", ),
    plugin_arg=CommandLine.DictTypeInfo(
        require_exact_match=False,
        arity="*",
    ),
    output_stream=None,
)
def Generate(
Beispiel #2
0
# ----------------------------------------------------------------------

BUILD_FILENAME                              = "Build.py"
BUILD_FILENAME_IGNORE                       = "{}-ignore".format(BUILD_FILENAME)

BUILD_LOG_TEMPLATE                          = "Build.{mode}.log"

COMPLETE_CONFIGURATION_NAME                 = "Complete"

# ----------------------------------------------------------------------
@CommandLine.EntryPoint( mode=CommandLine.EntryPoint.Parameter('Defaults to [ "clean", "build", ]'),
                       )
@CommandLine.Constraints( root_dir=CommandLine.DirectoryTypeInfo(),
                          output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False),
                          mode=CommandLine.StringTypeInfo(arity='*'),
                          output_stream=None,
                        )
def Execute( root_dir,
             output_dir,
             mode=None,
             debug_only=False,
             release_only=False,
             output_stream=sys.stdout,
             verbose=False,
           ):
    """Recursively calls Build files with the desired mode(s)"""

    assert os.path.isdir(root_dir), root_dir
    assert output_dir
    modes = mode or [ "clean", "build", ]; del mode
    ),
    debug=CommandLine.EntryPoint.Parameter(
        "Display context rather than generating output."),
)
@CommandLine.Constraints(
    output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False, ),
    input=CommandLine.FilenameTypeInfo(
        match_any=True,
        arity="+",
    ),
    context=CommandLine.DictTypeInfo(
        require_exact_match=False,
        arity="*",
    ),
    context_code=CommandLine.StringTypeInfo(
        validation_expression="^.+:.+$",
        arity="*",
    ),
    output_stream=None,
)
def Generate(
    output_dir,
    input,
    context=None,
    context_code=None,
    preserve_dir_structure=False,
    ignore_errors=False,
    debug=False,
    force=False,
    output_stream=sys.stdout,
    verbose=False,
):
Beispiel #4
0
                                if PythonActivationActivity.NormalizeScript(script) == PythonActivationActivity.NormalizeScriptResult_Modified:
                                    this_dm.stream.write("    ** The script '{}' was normalized.\n".format(script))

                            move_func(script, scripts_dest_dir)

                    except Exception as ex:
                        this_dm.result = -1
                        this_dm.stream.write("ERROR: {}\n".format(StringHelpers.LeftJustify( str(ex),
                                                                                             len("ERROR: "),
                                                                                           )))

        return dm.result

# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints( lib_name=CommandLine.StringTypeInfo(),
                          pip_arg=CommandLine.StringTypeInfo(arity='*'),
                          output_stream=None,
                        )
def Install( lib_name,
             pip_arg=None,
             output_stream=sys.stdout,
           ):
    """
    A replacement for pip install. Will ensure that already installed python libraries are not modified in-place,
    but rather considered as new libraries for the currently activated repository.
    """

    pip_args = pip_arg; del pip_arg

    repo_root = os.getenv(RepositoryBootstrapConstants.DE_REPO_ROOT_NAME)
Beispiel #5
0
    re.compile(r"tuple<.+>"),
], )


# ----------------------------------------------------------------------
@CommandLine.EntryPoint(
    include=CommandLine.EntryPoint.Parameter(
        "Regular expression specifying the name of featurizers to include", ),
    exclude=CommandLine.EntryPoint.Parameter(
        "Regular expression specifying the name of featurizers to exclude", ),
)
@CommandLine.Constraints(
    plugin=_PluginTypeInfo,
    input_filename=CommandLine.FilenameTypeInfo(),
    output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False, ),
    include=CommandLine.StringTypeInfo(arity="*", ),
    exclude=CommandLine.StringTypeInfo(arity="*", ),
    output_stream=None,
)
def EntryPoint(
    plugin,
    input_filename,
    output_dir,
    include=None,
    exclude=None,
    output_stream=sys.stdout,
):
    """Generates content based on a configuration file according to the specified plugin"""

    plugin = PLUGINS[plugin]
Beispiel #6
0
_script_fullpath                            = CommonEnvironment.ThisFullpath()
_script_dir, _script_name                   = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------

CONFIGURATIONS                              = ["Debug", "Release"]
JSON_FILENAME                               = "Microsoft MLFeaturizers.FileAttributes.json"

# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints(
    configuration=CommandLine.EnumTypeInfo(CONFIGURATIONS),
    output_dir=CommandLine.DirectoryTypeInfo(
        ensure_exists=False,
    ),
    prerelease_build_name=CommandLine.StringTypeInfo(
        arity="?",
    ),
    cmake_generator=CommandLine.StringTypeInfo(
        arity="?",
    ),
    output_stream=None,
)
def Build(
    configuration,
    output_dir,
    release_build=False,
    prerelease_build_name=None,
    no_build_info=False,
    keep_temp_dir=False,
    cmake_generator=(
        None if os.getenv("DEVELOPMENT_ENVIRONMENT_REPOSITORY_CONFIGURATION") == "universal_linux" or os.getenv("DEVELOPMENT_ENVIRONMENT_CPP_USE_DEFAULT_CMAKE_GENERATOR") else "Ninja"
_script_dir, _script_name = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------

sys.path.insert(0, os.path.join(_script_dir, "GeneratedCode"))
with CallOnExit(lambda: sys.path.pop(0)):
    import HooksImplParser                              # <Unable to import> pylint: disable = E0401

sys.path.insert(0, os.getenv("DEVELOPMENT_ENVIRONMENT_FUNDAMENTAL"))
with CallOnExit(lambda: sys.path.pop(0)):
    from RepositoryBootstrap import Constants
    from RepositoryBootstrap.Impl.ActivationData import ActivationData
    from RepositoryBootstrap.Impl import Utilities

# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints( display_sentinel=CommandLine.StringTypeInfo(),
                          json_filename=CommandLine.FilenameTypeInfo(),
                          result_filename=CommandLine.FilenameTypeInfo(ensure_exists=False),
                          output_stream=None,
                        )
def Commit( display_sentinel,
            json_filename,
            result_filename,
            first=False,
            output_stream=sys.stdout,
          ):
    """Called prior to committing a change locally"""
    return _Impl( display_sentinel,
                  json_filename,
                  result_filename,
                  first,
from CommonEnvironment import FileSystem
from CommonEnvironment import Process
from CommonEnvironment.Shell.All import CurrentShell
from CommonEnvironment.StreamDecorator import StreamDecorator
from CommonEnvironment import TaskPool

# ----------------------------------------------------------------------
_script_fullpath                            = CommonEnvironment.ThisFullpath()
_script_dir, _script_name                   = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------


@CommandLine.EntryPoint
@CommandLine.Constraints(
    generator=CommandLine.StringTypeInfo(
        arity="?",
    ),
    working_dir=CommandLine.DirectoryTypeInfo(
        arity="?",
    ),
    cmake_param=CommandLine.StringTypeInfo(
        arity="*",
    ),
    output_stream=None,
)
def Generate(
    working_dir=os.getcwd(),
    generator=(
        None
        if os.getenv("DEVELOPMENT_ENVIRONMENT_CPP_USE_DEFAULT_CMAKE_GENERATOR")
        else "Ninja"
from CommonEnvironment.CallOnExit import CallOnExit
from CommonEnvironment import CommandLine
from CommonEnvironment import FileSystem
from CommonEnvironment import Process
from CommonEnvironment.Shell.All import CurrentShell

# ----------------------------------------------------------------------
_script_fullpath                            = CommonEnvironment.ThisFullpath()
_script_dir, _script_name                   = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints(
    arg=CommandLine.StringTypeInfo(
        arity="+",
    ),
    output_stream=None,
)
def EntryPoint(
    arg,
    output_stream=sys.stdout,
):
    args = arg
    del arg

    # One of the args will be the filename
    input_filename = None

    for arg in args:
        if arg.startswith("-assume-filename="):
import CommonEnvironment
from CommonEnvironment import CommandLine

from CommonEnvironmentEx.SmtpMailer import SmtpMailer

# ----------------------------------------------------------------------
_script_fullpath = CommonEnvironment.ThisFullpath()
_script_dir, _script_name = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints(
    profile_name=CommandLine.StringTypeInfo(),
    host=CommandLine.StringTypeInfo(),
    username=CommandLine.StringTypeInfo(arity='?'),
    password=CommandLine.StringTypeInfo(arity='?'),
    port=CommandLine.IntTypeInfo(min=1, arity='?'),
    from_name=CommandLine.StringTypeInfo(arity='?'),
    from_email=CommandLine.StringTypeInfo(arity='?'),
    output_stream=None,
)
def Create(
    profile_name,
    host,
    username=None,
    password=None,
    port=26,
    from_name=None,
def CreateCompileMethod(compiler_type):

    # ----------------------------------------------------------------------
    @CommandLine.EntryPoint
    @CommandLine.Constraints(
        input=CommandLine.FilenameTypeInfo(arity='+'),
        output_dir=CommandLine.DirectoryTypeInfo(ensure_exists=False),
        output_name=CommandLine.StringTypeInfo(arity='?'),
        build_type=CommandLine.EnumTypeInfo([
            "console",
            "windows",
        ],
                                            arity='?'),
        manifest_filename=CommandLine.FilenameTypeInfo(arity='?'),
        icon_filename=CommandLine.FilenameTypeInfo(arity='?'),
        path=CommandLine.DirectoryTypeInfo(arity='*'),
        include_module=CommandLine.StringTypeInfo(arity='*'),
        exclude_module=CommandLine.StringTypeInfo(arity='*'),
        package=CommandLine.StringTypeInfo(arity='*'),
        distutil_arg=CommandLine.StringTypeInfo(arity='*'),
        comments=CommandLine.StringTypeInfo(arity='?'),
        company_name=CommandLine.StringTypeInfo(arity='?'),
        file_description=CommandLine.StringTypeInfo(arity='?'),
        internal_name=CommandLine.StringTypeInfo(arity='?'),
        copyright=CommandLine.StringTypeInfo(arity='?'),
        trademark=CommandLine.StringTypeInfo(arity='?'),
        name=CommandLine.StringTypeInfo(arity='?'),
        version=CommandLine.StringTypeInfo(arity='?'),
        output_stream=None,
    )
    def Compile(
        input,
        output_dir,
        output_name=None,
        build_type="console",
        include_tcl=False,
        no_optimize=False,
        no_bundle=False,
        manifest_filename=None,
        icon_filename=None,
        path=None,
        include_module=None,
        exclude_module=None,
        package=None,
        distutil_arg=None,
        comments=None,
        company_name=None,
        file_description=None,
        internal_name=None,
        trademark=None,
        copyright=None,
        name=None,
        version=None,
        preserve_temp_dir=False,
        output_stream=sys.stdout,
        no_verbose=False,
    ):
        """Creates an executable from one or more python files."""

        if build_type == "console":
            build_type = DistutilsCompilerImpl.BuildType_Console
        elif build_type == "windows":
            build_type = DistutilsCompilerImpl.BuildType_Windows
        else:
            assert False, build_type

        return CommandLineCompile(
            compiler_type,
            input,
            output_stream,
            verbose=not no_verbose,

            # Generate compiler options
            output_dir=output_dir,

            # This compiler options
            preserve_temp_dir=preserve_temp_dir,
            build_type=build_type,
            include_tcl=include_tcl,
            no_optimize=no_optimize,
            no_bundle=no_bundle,
            manifest_filename=manifest_filename,
            icon_filename=icon_filename,
            paths=path,
            includes=include_module,
            excludes=exclude_module,
            packages=package,
            distutil_args=distutil_arg,
            output_name=output_name,
            comments=comments,
            company_name=company_name,
            file_description=file_description,
            internal_name=internal_name,
            copyright=copyright,
            trademark=trademark,
            name=name,
            version=version,
        )

    # ----------------------------------------------------------------------

    return Compile
# ----------------------------------------------------------------------

inflect                                     = inflect_mod.engine()

# ----------------------------------------------------------------------
@CommandLine.EntryPoint()
@CommandLine.Constraints(
    bin_dir=CommandLine.DirectoryTypeInfo(
        arity="*",
    ),
    output_dir=CommandLine.DirectoryTypeInfo(
        ensure_exists=False,
        arity="?",
    ),
    output_filename=CommandLine.StringTypeInfo(
        arity="?",
    ),
    type=CommandLine.StringTypeInfo(
        arity="?",
    ),
    output_stream=None,
)
def Lcov(
    bin_dir=None,
    not_llvm=False,
    output_dir=None,
    output_filename="lcov.info",
    type=None,
    output_stream=sys.stdout,
    verbose=False,
):
Beispiel #13
0
# ----------------------------------------------------------------------

DOCKER_USER_NAME = "featurizerslibrarybuild"

IMAGES = [
    os.path.basename(potential_dir) for potential_dir in
    [os.path.join(_script_dir, item) for item in os.listdir(_script_dir)]
    if os.path.isdir(potential_dir)
]


# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints(
    image_name=CommandLine.EnumTypeInfo(IMAGES),
    tag=CommandLine.StringTypeInfo(arity="*", ),
    output_stream=None,
)
def Build(
    image_name,
    tag=None,
    output_stream=sys.stdout,
    verbose=False,
):
    """Creates a docker image"""

    tags = tag
    del tag

    with StreamDecorator(output_stream).DoneManager(
            line_prefix="",
Beispiel #14
0
from CommonEnvironment.StreamDecorator import StreamDecorator

# ----------------------------------------------------------------------
_script_fullpath = os.path.abspath(
    __file__) if "python" in sys.executable.lower() else sys.executable
_script_dir, _script_name = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------

inflect = inflect_mod.engine()


# ----------------------------------------------------------------------
@CommandLine.EntryPoint
@CommandLine.Constraints(
    repo_dir=CommandLine.DirectoryTypeInfo(),
    repo_name=CommandLine.StringTypeInfo(),
    output_stream=None,
)
def EntryPoint(
    repo_dir,
    repo_name,
    output_stream=sys.stdout,
):
    with StreamDecorator(output_stream).DoneManager(
            line_prefix='',
            prefix="\nResults: ",
            suffix='\n',
    ) as dm:
        # Prompt for the files to copy
        support_git = _Prompt("Support Git? ", "yes").lower() in [
            "yes",