Skip to content

Commit

Permalink
created new access triangle spack directory, SPR brings all files int…
Browse files Browse the repository at this point in the history
…o one directory and clears it after compilation
  • Loading branch information
justinh2002 committed Feb 26, 2025
1 parent d8b5f95 commit 579d144
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 79 deletions.
79 changes: 0 additions & 79 deletions packages/access-triangle-git/package.py

This file was deleted.

86 changes: 86 additions & 0 deletions packages/access-triangle/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2013-2024 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)
# ----------------------------------------------------------------------------
#
# spack install access-triangle-git
#
# You can edit this file again by typing:
#
# spack edit access-triangle-git
#
# ----------------------------------------------------------------------------

from spack.package import *
import glob
import os

Check failure on line 17 in packages/access-triangle/package.py

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (F401)

packages/access-triangle/package.py:17:8: F401 `os` imported but unused


class AccessTriangle(MakefilePackage):
"""Example Spack package for the ISSM Triangle library."""

homepage = "https://github.com/ACCESS-NRI/issm-triangle"
git = 'https://github.com/ACCESS-NRI/issm-triangle.git'

version('main')

# # If on some systems 'gmake' is truly required, keep it. Otherwise, 'make'
# # is often sufficient because Spack sets MAKE appropriately.
depends_on('gmake', type='build')
depends_on('libx11', type='link')

def url_for_version(self, version):
return "https://github.com/ACCESS-NRI/issm-triangle/archive/refs/heads/{0}.tar.gz".format(version)

def edit(self, spec, prefix):
"""
This stage is where you typically patch or customize the makefile.
If the package comes with a pre-written Makefile that needs minimal
changes, you can do them here. Below, we just copy in the 'configs'
so that the build can find them in `self.build_directory`.
"""
src_dir = join_path(self.stage.source_path, "src")
mkdirp(src_dir)

# Copy necessary files to src directory
install('configs/makefile', src_dir)
install('configs/linux/configure.make', src_dir)
install('triangle.c', src_dir)
install('triangle.h', src_dir)

def build(self, spec, prefix):
"""
This is where we actually call `make shared`.
Using MakefilePackage, you *could* rely on build_targets,
but we'll be explicit here so you can see it clearly.
"""
with working_dir(join_path(self.stage.source_path, "src")):
make('shared')

#raise an exception

Check failure on line 61 in packages/access-triangle/package.py

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (E265)

packages/access-triangle/package.py:61:9: E265 Block comment should start with `# `

def install(self, spec, prefix):
"""
Copy the resulting library and headers into the Spack prefix.
"""
src = join_path(self.stage.source_path, "src")

# Create prefix directories
mkdirp(prefix.include)
mkdirp(prefix.lib)

with working_dir(src):
# Make sure we see what's actually there, for debugging:
ls_output = Executable('ls')('-l', '.', output=str, error=str)
print("Files in build directory:\n", ls_output)

install('triangle.h', prefix.include)

for libfile in glob.glob("libtriangle.*"):
install(libfile, prefix.lib)





0 comments on commit 579d144

Please sign in to comment.