Exemple #1
0
def _generate_env_mach_specific(output_dir, machobj, compiler, mpilib, debug,
                                sysos, unit_testing):
    """
    env_mach_specific generation.
    """
    ems_path = os.path.join(output_dir, "env_mach_specific.xml")
    if os.path.exists(ems_path):
        logger.warning("{} already exists, delete to replace".format(ems_path))
        return
    ems_file = EnvMachSpecific(output_dir, unit_testing=unit_testing)
    ems_file.populate(machobj)
    ems_file.write()
    ems_file.load_env(compiler, debug, mpilib)
    for shell in ('sh', 'csh'):
        ems_file.make_env_mach_specific_file(compiler, debug, mpilib, shell)
        shell_path = os.path.join(output_dir, ".env_mach_specific." + shell)
        with open(shell_path, 'a') as shell_file:
            if shell == 'sh':
                shell_file.write("\nexport COMPILER={}\n".format(compiler))
                shell_file.write("export MPILIB={}\n".format(mpilib))
                shell_file.write("export DEBUG={}\n".format(repr(debug).upper()))
                shell_file.write("export OS={}\n".format(sysos))
            else:
                shell_file.write("\nsetenv COMPILER {}\n".format(compiler))
                shell_file.write("setenv MPILIB {}\n".format(mpilib))
                shell_file.write("setenv DEBUG {}\n".format(repr(debug).upper()))
                shell_file.write("setenv OS {}\n".format(sysos))
Exemple #2
0
def _generate_env_mach_specific(output_dir, machobj, compiler, mpilib, debug,
                                sysos, unit_testing):
    """
    env_mach_specific generation.
    """
    ems_path = os.path.join(output_dir, "env_mach_specific.xml")
    if os.path.exists(ems_path):
        logger.warning("{} already exists, delete to replace".format(ems_path))
        return
    ems_file = EnvMachSpecific(output_dir, unit_testing=unit_testing)
    ems_file.populate(machobj)
    ems_file.write()
    fake_case = FakeCase(compiler, mpilib, debug)
    ems_file.load_env(fake_case)
    for shell in ('sh', 'csh'):
        ems_file.make_env_mach_specific_file(shell, fake_case)
        shell_path = os.path.join(output_dir, ".env_mach_specific." + shell)
        with open(shell_path, 'a') as shell_file:
            if shell == 'sh':
                shell_file.write("\nexport COMPILER={}\n".format(compiler))
                shell_file.write("export MPILIB={}\n".format(mpilib))
                shell_file.write("export DEBUG={}\n".format(
                    repr(debug).upper()))
                shell_file.write("export OS={}\n".format(sysos))
            else:
                shell_file.write("\nsetenv COMPILER {}\n".format(compiler))
                shell_file.write("setenv MPILIB {}\n".format(mpilib))
                shell_file.write("setenv DEBUG {}\n".format(
                    repr(debug).upper()))
                shell_file.write("setenv OS {}\n".format(sysos))
Exemple #3
0
def _generate_env_mach_specific(output_dir, machobj, compiler, mpilib, debug, sysos):
    """
    env_mach_specific generation.
    """
    ems_path = os.path.join(output_dir, "env_mach_specific.xml")
    if os.path.exists(ems_path):
        logger.warn("%s already exists, delete to replace"%ems_path)
        return
    ems_file = EnvMachSpecific(output_dir)
    ems_file.populate(machobj)
    ems_file.write()
    for shell in ('sh', 'csh'):
        ems_file.make_env_mach_specific_file(compiler, debug, mpilib, shell)
        shell_path = os.path.join(output_dir, ".env_mach_specific." + shell)
        with open(shell_path, 'a') as shell_file:
            if shell == 'sh':
                shell_file.write("\nexport COMPILER=%s\n" % compiler)
                shell_file.write("export MPILIB=%s\n" % mpilib)
                shell_file.write("export DEBUG=%s\n" % repr(debug).upper())
                shell_file.write("export OS=%s\n" % sysos)
            else:
                shell_file.write("\nsetenv COMPILER %s\n" % compiler)
                shell_file.write("setenv MPILIB %s\n" % mpilib)
                shell_file.write("setenv DEBUG %s\n" % repr(debug).upper())
                shell_file.write("setenv OS %s\n" % sysos)
Exemple #4
0
def _generate_env_mach_specific(output_dir, machobj, compiler, mpilib, debug,
                                sysos, unit_testing):
    """
    env_mach_specific generation.
    """
    ems_path = os.path.join(output_dir, "env_mach_specific.xml")
    if os.path.exists(ems_path):
        logger.warn("%s already exists, delete to replace" % ems_path)
        return
    ems_file = EnvMachSpecific(output_dir, unit_testing=unit_testing)
    ems_file.populate(machobj)
    ems_file.write()
    for shell in ('sh', 'csh'):
        ems_file.make_env_mach_specific_file(compiler, debug, mpilib, shell)
        shell_path = os.path.join(output_dir, ".env_mach_specific." + shell)
        with open(shell_path, 'a') as shell_file:
            if shell == 'sh':
                shell_file.write("\nexport COMPILER=%s\n" % compiler)
                shell_file.write("export MPILIB=%s\n" % mpilib)
                shell_file.write("export DEBUG=%s\n" % repr(debug).upper())
                shell_file.write("export OS=%s\n" % sysos)
            else:
                shell_file.write("\nsetenv COMPILER %s\n" % compiler)
                shell_file.write("setenv MPILIB %s\n" % mpilib)
                shell_file.write("setenv DEBUG %s\n" % repr(debug).upper())
                shell_file.write("setenv OS %s\n" % sysos)
Exemple #5
0
def generate_env_mach_specific(
    output_dir,
    machobj,
    compiler,
    mpilib,
    debug,
    comp_interface,
    sysos,
    unit_testing,
    threaded,
    noenv=False,
):
    """
    env_mach_specific generation.
    """
    ems_path = os.path.join(output_dir, "env_mach_specific.xml")
    if os.path.exists(ems_path):
        logger.warning("{} already exists, delete to replace".format(ems_path))
        return

    ems_file = EnvMachSpecific(output_dir,
                               unit_testing=unit_testing,
                               standalone_configure=True)
    ems_file.populate(
        machobj,
        attributes={
            "mpilib": mpilib,
            "compiler": compiler,
            "threaded": threaded
        },
    )
    ems_file.write()

    if noenv:
        return

    fake_case = FakeCase(compiler, mpilib, debug, comp_interface)
    ems_file.load_env(fake_case)
    for shell in ("sh", "csh"):
        ems_file.make_env_mach_specific_file(shell,
                                             fake_case,
                                             output_dir=output_dir)
        shell_path = os.path.join(output_dir, ".env_mach_specific." + shell)
        with open(shell_path, "a") as shell_file:
            if shell == "sh":
                shell_file.write("\nexport COMPILER={}\n".format(compiler))
                shell_file.write("export MPILIB={}\n".format(mpilib))
                shell_file.write("export DEBUG={}\n".format(
                    repr(debug).upper()))
                shell_file.write("export OS={}\n".format(sysos))
            else:
                shell_file.write("\nsetenv COMPILER {}\n".format(compiler))
                shell_file.write("setenv MPILIB {}\n".format(mpilib))
                shell_file.write("setenv DEBUG {}\n".format(
                    repr(debug).upper()))
                shell_file.write("setenv OS {}\n".format(sysos))