Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/astral/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ def install(self, spec, prefix):
set_executable(script)

java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("astral.jar", join_path(prefix.tools, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file("astral.jar", join_path(prefix.tools, jar_file), script)

def setup_run_environment(self, env: EnvironmentModifications) -> None:
env.set("ASTRAL_HOME", self.prefix.tools)
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/beagle/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the
# jar file.
java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("beagle.jar", join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file("beagle.jar", join_path(prefix.bin, jar_file), script)
8 changes: 3 additions & 5 deletions repos/spack_repo/builtin/packages/bowtie2/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,17 @@ class Bowtie2(MakefilePackage):
conflicts("@2.4.1", when="target=aarch64:")

def edit(self, spec, prefix):
kwargs = {"ignore_absent": True, "backup": False, "string": False}

match = "^#!/usr/bin/env perl"
perl = spec["perl"].command
substitute = "#!{perl}".format(perl=perl)
files = ["bowtie2"]
filter_file(match, substitute, *files, **kwargs)
filter_file(match, substitute, *files, ignore_absent=True)

match = "^#!/usr/bin/env python.*"
python = spec["python"].command
substitute = "#!{python}".format(python=python)
files = ["bowtie2-build", "bowtie2-inspect"]
filter_file(match, substitute, *files, **kwargs)
filter_file(match, substitute, *files, ignore_absent=True)

if self.spec.satisfies("@2.4.0:2.4.2 target=aarch64:") or self.spec.satisfies(
"@2.4.0:2.4.2 target=ppc64le:"
Expand All @@ -72,7 +70,7 @@ def edit(self, spec, prefix):
simdepath = spec["simde"].prefix.include
substitute = "-I{simdepath}".format(simdepath=simdepath)
files = ["Makefile"]
filter_file(match, substitute, *files, **kwargs)
filter_file(match, substitute, *files, ignore_absent=True)

@property
def build_targets(self):
Expand Down
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/bref3/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the
# jar file.
java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("bref.jar", join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file("bref.jar", join_path(prefix.bin, jar_file), script)
10 changes: 4 additions & 6 deletions repos/spack_repo/builtin/packages/bzip2/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ def patch(self):
v = self.spec.version
v1, v2, v3 = (v.up_to(i) for i in (1, 2, 3))

kwargs = {"ignore_absent": False, "backup": False, "string": True}

mf = FileFilter("Makefile-libbz2_so")
mf.filter(
"$(CC) -shared -Wl,-soname -Wl,libbz2.so.{0} -o libbz2.so.{1} $(OBJS)".format(
Expand All @@ -109,21 +107,21 @@ def patch(self):
"$(CC) -dynamiclib -Wl,-install_name -Wl,@rpath/libbz2.{0}.dylib "
"-current_version {1} -compatibility_version {2} -o libbz2.{3}.dylib $(OBJS)"
).format(v1, v2, v3, v3),
**kwargs,
string=True,
)

mf.filter(
"$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.{0}".format(v3),
"$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.{0}.dylib".format(v3),
**kwargs,
string=True,
)
mf.filter(
"rm -f libbz2.so.{0}".format(v2), "rm -f libbz2.{0}.dylib".format(v2), **kwargs
"rm -f libbz2.so.{0}".format(v2), "rm -f libbz2.{0}.dylib".format(v2), string=True
)
mf.filter(
"ln -s libbz2.so.{0} libbz2.so.{1}".format(v3, v2),
"ln -s libbz2.{0}.dylib libbz2.{1}.dylib".format(v3, v2),
**kwargs,
string=True,
)

def install(self, spec, prefix):
Expand Down
26 changes: 20 additions & 6 deletions repos/spack_repo/builtin/packages/cantera/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ def filter_compilers(self):
If this isn't done, they'll have CC, CXX, F77, and FC set to Spack's
generic cc, c++, f77, and f90. We want them to be bound to whatever
compiler they were built with."""

kwargs = {"ignore_absent": True, "backup": False, "string": True}
dirname = os.path.join(self.prefix, "share/cantera/samples")

cc_files = [
Expand All @@ -384,20 +382,36 @@ def filter_compilers(self):

for filename in cc_files:
filter_file(
os.environ["CC"], self.compiler.cc, os.path.join(dirname, filename), **kwargs
os.environ["CC"],
self.compiler.cc,
os.path.join(dirname, filename),
ignore_absent=True,
string=True,
)

for filename in cxx_files:
filter_file(
os.environ["CXX"], self.compiler.cxx, os.path.join(dirname, filename), **kwargs
os.environ["CXX"],
self.compiler.cxx,
os.path.join(dirname, filename),
ignore_absent=True,
string=True,
)

for filename in f77_files:
filter_file(
os.environ["F77"], self.compiler.f77, os.path.join(dirname, filename), **kwargs
os.environ["F77"],
self.compiler.f77,
os.path.join(dirname, filename),
ignore_absent=True,
string=True,
)

for filename in fc_files:
filter_file(
os.environ["FC"], self.compiler.fc, os.path.join(dirname, filename), **kwargs
os.environ["FC"],
self.compiler.fc,
os.path.join(dirname, filename),
ignore_absent=True,
string=True,
)
3 changes: 1 addition & 2 deletions repos/spack_repo/builtin/packages/cctools/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def patch(self):
before = "#if defined(__linux__) && defined(SYS_memfd_create)"
after = "#if defined(__linux__) && defined(SYS_memfd_create) && defined(__NR_memfd_create)"
f = "dttools/src/memfdexe.c"
kwargs = {"ignore_absent": False, "backup": True, "string": True}
filter_file(before, after, f, **kwargs)
filter_file(before, after, f, backup=True, string=True)
if self.spec.satisfies("%fj"):
makefiles = ["chirp/src/Makefile", "grow/src/Makefile"]
for m in makefiles:
Expand Down
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/chexmix/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ def install(self, spec, prefix):
set_executable(script)
# set the helper script to explicitly point to java and the .jar file
java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("chexmix.jar", join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file("chexmix.jar", join_path(prefix.bin, jar_file), script)
3 changes: 1 addition & 2 deletions repos/spack_repo/builtin/packages/corenlp/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the
# jar file.
java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("^java", java, script)

def setup_run_environment(self, env: EnvironmentModifications) -> None:
class_paths = []
Expand Down
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/cromwell/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the
# jar file.
java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("cromwell.jar", join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file("cromwell.jar", join_path(prefix.bin, jar_file), script)
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/cromwell_womtool/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the
# jar file.
java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("womtool.jar", join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file("womtool.jar", join_path(prefix.bin, jar_file), script)
3 changes: 1 addition & 2 deletions repos/spack_repo/builtin/packages/daligner/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class Daligner(MakefilePackage):

def edit(self, spec, prefix):
makefile = FileFilter("Makefile")
kwargs = {"ignore_absent": False, "backup": False, "string": True}
makefile.filter("cp $(ALL) ~/bin", "cp $(ALL) {0}".format(prefix.bin), **kwargs)
makefile.filter("cp $(ALL) ~/bin", "cp $(ALL) {0}".format(prefix.bin), string=True)
# He changed the Makefile in commit dae119.
# You'll need this instead if/when he cuts a new release
# or if you try to build from the tip of master.
Expand Down
12 changes: 5 additions & 7 deletions repos/spack_repo/builtin/packages/eccodes/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,18 @@ def patch(self):
]
)

kwargs = {"string": False, "backup": False, "ignore_absent": True}

# Return the kind and not the size:
filter_file(
r"(^\s*kind_of_double\s*=\s*)(\d{1,2})(\s*$)",
"\\1kind(real\\2)\\3",
"fortran/grib_types.f90",
**kwargs,
ignore_absent=True,
)
filter_file(
r"(^\s*kind_of_\w+\s*=\s*)(\d{1,2})(\s*$)",
"\\1kind(x\\2)\\3",
"fortran/grib_types.f90",
**kwargs,
ignore_absent=True,
)

# Replace integer kinds:
Expand All @@ -249,7 +247,7 @@ def patch(self):
r"(^\s*integer\((?:kind=)?){0}(\).*)".format(size),
"\\1selected_int_kind({0})\\2".format(r),
*patch_kind_files,
**kwargs,
ignore_absent=True,
)

# Replace real kinds:
Expand All @@ -258,15 +256,15 @@ def patch(self):
r"(^\s*real\((?:kind=)?){0}(\).*)".format(size),
"\\1selected_real_kind({0}, {1})\\2".format(p, r),
*patch_kind_files,
**kwargs,
ignore_absent=True,
)

# Enable getarg and exit subroutines:
filter_file(
r"(^\s*program\s+\w+)(\s*$)",
"\\1; use f90_unix_env; use f90_unix_proc\\2",
*patch_unix_ext_files,
**kwargs,
ignore_absent=True,
)

@property
Expand Down
8 changes: 2 additions & 6 deletions repos/spack_repo/builtin/packages/gatk/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,9 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the
# jar file.
java = join_path(self.spec["java"].prefix, "bin", "java")
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("^java", java, script)
filter_file(
"GenomeAnalysisTK.jar",
join_path(prefix.bin, "GenomeAnalysisTK.jar"),
script,
**kwargs,
"GenomeAnalysisTK.jar", join_path(prefix.bin, "GenomeAnalysisTK.jar"), script
)

def setup_run_environment(self, env: EnvironmentModifications) -> None:
Expand Down
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/genomefinisher/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the jar file
# jar file.
java = spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file(jar_file, join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file(jar_file, join_path(prefix.bin, jar_file), script)
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/haploview/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ def install(self, spec, prefix):
set_executable(script)

java = self.spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file("haploview.jar", join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file("haploview.jar", join_path(prefix.bin, jar_file), script)
5 changes: 2 additions & 3 deletions repos/spack_repo/builtin/packages/igvtools/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ def install(self, spec, prefix):
# Munge the helper script to explicitly point to java and the
# jar file.
java = spec["java"].prefix.bin.java
kwargs = {"ignore_absent": False, "backup": False, "string": False}
filter_file("^java", java, script, **kwargs)
filter_file(jar_file, join_path(prefix.bin, jar_file), script, **kwargs)
filter_file("^java", java, script)
filter_file(jar_file, join_path(prefix.bin, jar_file), script)
8 changes: 3 additions & 5 deletions repos/spack_repo/builtin/packages/libxstream/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ class Libxstream(Package):
depends_on("gmake", type="build")

def patch(self):
kwargs = {"ignore_absent": False, "backup": True, "string": True}
makefile = FileFilter("Makefile.inc")

makefile.filter("CC =", "CC ?=", **kwargs)
makefile.filter("CXX =", "CXX ?=", **kwargs)
makefile.filter("FC =", "FC ?=", **kwargs)
makefile.filter("CC =", "CC ?=", backup=True, string=True)
makefile.filter("CXX =", "CXX ?=", backup=True, string=True)
makefile.filter("FC =", "FC ?=", backup=True, string=True)

def install(self, spec, prefix):
make()
Expand Down
3 changes: 1 addition & 2 deletions repos/spack_repo/builtin/packages/mono/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def patch(self):
before = 'return "/usr/share";'
after = 'return "{0}";'.format(self.prefix.share)
f = "mcs/class/corlib/System/Environment.cs"
kwargs = {"ignore_absent": False, "backup": True, "string": True}
filter_file(before, after, f, **kwargs)
filter_file(before, after, f, backup=True, string=True)

def configure_args(self):
args = []
Expand Down
5 changes: 3 additions & 2 deletions repos/spack_repo/builtin/packages/multitail/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def edit(self, spec, prefix):

# Copy the conf file directly into place (don't worry about
# overwriting an existing file...)
kwargs = {"ignore_absent": False, "backup": False, "string": True}
makefile.filter(
r"cp multitail.conf $(CONFIG_FILE).new", "cp multitail.conf $(CONFIG_FILE)", **kwargs
r"cp multitail.conf $(CONFIG_FILE).new",
"cp multitail.conf $(CONFIG_FILE)",
string=True,
)
3 changes: 1 addition & 2 deletions repos/spack_repo/builtin/packages/mummer/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def patch(self):
"""Fix mummerplot's use of defined on hashes (deprecated
since perl@5.10, made illegal in perl@5.20."""

kwargs = {"string": True}
filter_file("defined (%", "(%", "scripts/mummerplot.pl", **kwargs)
filter_file("defined (%", "(%", "scripts/mummerplot.pl", string=True)

def install(self, spec, prefix):
if self.run_tests:
Expand Down
3 changes: 1 addition & 2 deletions repos/spack_repo/builtin/packages/parallel/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ def filter_sbang(self):
can fix up the path to the perl binary.
"""
perl = self.spec["perl"].command
kwargs = {"ignore_absent": False, "backup": False, "string": False}

with working_dir("src"):
match = "^#!/usr/bin/env perl|^#!/usr/bin/perl.*"
substitute = f"#!{perl}"
files = ["parallel", "niceload", "parcat", "sql"]
filter_file(match, substitute, *files, **kwargs)
filter_file(match, substitute, *files)
# Since scripts are run during installation, we need to add sbang
for file in files:
filter_shebang(file)
9 changes: 4 additions & 5 deletions repos/spack_repo/builtin/packages/perl/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ def filter_config_dot_pm(self):
"""
if sys.platform == "win32":
return
kwargs = {"ignore_absent": True, "backup": False, "string": False}

# Find the actual path to the installed Config.pm file.
config_dot_pm = self.command(
Expand All @@ -369,7 +368,7 @@ def filter_config_dot_pm(self):
with self.make_briefly_writable(config_dot_pm):
match = "cc *=>.*"
substitute = "cc => '{cc}',".format(cc=c_compiler)
filter_file(match, substitute, config_dot_pm, **kwargs)
filter_file(match, substitute, config_dot_pm, ignore_absent=True)

# And the path Config_heavy.pl
d = os.path.dirname(config_dot_pm)
Expand All @@ -378,15 +377,15 @@ def filter_config_dot_pm(self):
with self.make_briefly_writable(config_heavy):
match = "^cc=.*"
substitute = "cc='{cc}'".format(cc=c_compiler)
filter_file(match, substitute, config_heavy, **kwargs)
filter_file(match, substitute, config_heavy, ignore_absent=True)

match = "^ld=.*"
substitute = "ld='{ld}'".format(ld=c_compiler)
filter_file(match, substitute, config_heavy, **kwargs)
filter_file(match, substitute, config_heavy, ignore_absent=True)

match = "^ccflags='"
substitute = "ccflags='%s " % " ".join(self.spec.compiler_flags["cflags"])
filter_file(match, substitute, config_heavy, **kwargs)
filter_file(match, substitute, config_heavy, ignore_absent=True)

@contextmanager
def make_briefly_writable(self, path):
Expand Down
Loading
Loading