Example #1
0
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

"""Defines paths that are part of Spack's directory structure.

Do not import other ``spack`` modules here. This module is used
throughout Spack and should bring in a minimal number of external
dependencies.
"""
import os
from llnl.util.filesystem import ancestor

#: This file lives in $prefix/lib/spack/spack/__file__
prefix = ancestor(__file__, 4)

#: synonym for prefix
spack_root = prefix

#: bin directory in the spack prefix
bin_path = os.path.join(prefix, "bin")

#: The spack script itself
spack_script = os.path.join(bin_path, "spack")

#: The sbang script in the spack installation
sbang_script = os.path.join(bin_path, "sbang")

# spack directory hierarchy
lib_path              = os.path.join(prefix, "lib", "spack")
Example #2
0
# the Free Software Foundation) version 2.1 dated February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import llnl.util.tty as tty
from llnl.util.lang import *
from llnl.util.filesystem import ancestor

commands = sorted(list_modules(ancestor(__file__)))
SETUP_PARSER = "setup_parser"
DESCRIPTION  = "description"

def get_cmd_function_name(name):
    return name.replace("-", "_")


def get_module(name):
    """Imports the module for a particular command name and returns it."""
    module_name = "%s.%s" % (__name__, name)
    module = __import__(
        module_name, fromlist=[name, SETUP_PARSER, DESCRIPTION], level=0)

    attr_setdefault(module, SETUP_PARSER, lambda *args: None) # null-op
    attr_setdefault(module, DESCRIPTION, "")
Example #3
0
# the Free Software Foundation) version 2.1 dated February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import llnl.util.tty as tty
from llnl.util.lang import *
from llnl.util.filesystem import ancestor

commands = sorted(list_modules(ancestor(__file__)))
SETUP_PARSER = "setup_parser"
DESCRIPTION = "description"


def get_cmd_function_name(name):
    return name.replace("-", "_")


def get_module(name):
    """Imports the module for a particular command name and returns it."""
    module_name = "%s.%s" % (__name__, name)
    module = __import__(module_name,
                        fromlist=[name, SETUP_PARSER, DESCRIPTION],
                        level=0)
Example #4
0
File: paths.py Project: LLNL/spack
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

"""Defines paths that are part of Spack's directory structure.

Do not import other ``spack`` modules here. This module is used
throughout Spack and should bring in a minimal number of external
dependencies.
"""
import os
from llnl.util.filesystem import ancestor


#: This file lives in $prefix/lib/spack/spack/__file__
prefix = ancestor(__file__, 4)

#: synonym for prefix
spack_root = prefix

#: bin directory in the spack prefix
bin_path = os.path.join(prefix, "bin")

#: The spack script itself
spack_script = os.path.join(bin_path, "spack")

# spack directory hierarchy
lib_path              = os.path.join(prefix, "lib", "spack")
external_path         = os.path.join(lib_path, "external")
build_env_path        = os.path.join(lib_path, "env")
module_path           = os.path.join(lib_path, "spack")
Example #5
0
# -*- coding: utf-8 -*-
"""\
Exawind paths
"""

import os
from llnl.util.filesystem import ancestor
import jinja2

_exw_bld_dir = ancestor(__file__, 3)
_templates_env = jinja2.Environment(
    loader=jinja2.PackageLoader('exwbld', 'templates'))


def exawind_dir():
    """Absolute path to exawind directory"""
    return os.getenv('EXAWIND_PROJECT_DIR', os.path.dirname(_exw_bld_dir))


def exawind_builder_dir():
    """Absolute path to exawind-builder dir"""
    return os.getenv('EXAWIND_SRCDIR', _exw_bld_dir)


def exawind_scripts_dir():
    """Path to exawind/scripts"""
    return os.path.join(exawind_dir(), "scripts")


def exawind_install_dir():
    """Path to exawind/install"""