From 0ff6a1bd1ca018d15529bd38f79810ad0d915e14 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 13 Dec 2022 13:55:32 +0100 Subject: spack/package.py: improve editor support for some +/- static props (#34319) --- lib/spack/spack/build_environment.py | 21 +-------------------- lib/spack/spack/package.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 788f896a86..d609fd1aa7 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -37,14 +37,12 @@ import io import multiprocessing import os import re -import shutil import sys import traceback import types from typing import List, Tuple import llnl.util.tty as tty -from llnl.util.filesystem import install, install_tree, mkdirp from llnl.util.lang import dedupe from llnl.util.symlink import symlink from llnl.util.tty.color import cescape, colorize @@ -52,6 +50,7 @@ from llnl.util.tty.log import MultiProcessFd import spack.build_systems.cmake import spack.build_systems.meson +import spack.build_systems.python import spack.builder import spack.config import spack.install_test @@ -586,9 +585,6 @@ def set_module_variables_for_package(pkg): m.gmake = MakeExecutable("gmake", jobs) m.ninja = MakeExecutable("ninja", jobs, supports_jobserver=False) - # easy shortcut to os.environ - m.env = os.environ - # Find the configure script in the archive path # Don't use which for this; we want to find it in the current dir. m.configure = Executable("./configure") @@ -608,21 +604,6 @@ def set_module_variables_for_package(pkg): m.spack_f77 = os.path.join(link_dir, pkg.compiler.link_paths["f77"]) m.spack_fc = os.path.join(link_dir, pkg.compiler.link_paths["fc"]) - # Emulate some shell commands for convenience - m.pwd = os.getcwd - m.cd = os.chdir - m.mkdir = os.mkdir - m.makedirs = os.makedirs - m.remove = os.remove - m.removedirs = os.removedirs - m.symlink = symlink - - m.mkdirp = mkdirp - m.install = install - m.install_tree = install_tree - m.rmtree = shutil.rmtree - m.move = shutil.move - # Useful directories within the prefix are encapsulated in # a Prefix object. m.prefix = pkg.prefix diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 46c9da4844..c41d77d895 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -8,13 +8,25 @@ Everything in this module is automatically imported into Spack package files. """ +from os import chdir, environ, getcwd, makedirs, mkdir, remove, removedirs +from shutil import move, rmtree + +# Emulate some shell commands for convenience +env = environ +cd = chdir +pwd = getcwd + # import most common types used in packages from typing import Dict, List, Optional import llnl.util.filesystem from llnl.util.filesystem import * +from llnl.util.symlink import symlink import spack.util.executable + +# These props will be overridden when the build env is set up. +from spack.build_environment import MakeExecutable from spack.build_systems.aspell_dict import AspellDictPackage from spack.build_systems.autotools import AutotoolsPackage from spack.build_systems.bundle import BundlePackage @@ -83,3 +95,10 @@ from spack.variant import ( disjoint_sets, ) from spack.version import Version, ver + +# These are just here for editor support; they will be replaced when the build env +# is set up. +make = MakeExecutable("make", jobs=1) +gmake = MakeExecutable("gmake", jobs=1) +ninja = MakeExecutable("ninja", jobs=1) +configure = Executable(join_path(".", "configure")) -- cgit v1.2.3-70-g09d2