Skip to content

Commit

Permalink
tempo: add master (spack#44298)
Browse files Browse the repository at this point in the history
* Add new version for master branch

Added new version for master branch.  Also added additional functions to ensure tempo will actually run.  Tempo assumes the stage directory sticks around and references numerous files and directory there.  That has been corrected here only if using the master version.  The LWA-10-2020 version will also have this problem but they may have additional setup in their compute/Spack environment to address this issue already so I did not modify anything when that's the version.  Example of what happens in the LWA-10-17-2020 version regarding missing files is given below

user@cs:~/spack/bin$ tempo
more: cannot open /tempo.hlp: No such file or directory

* Updated to fix format errors

Flake8 check found errors.  Fixed those formatting issues

* Additional format change

Removed redundant setup_dependent_run_environment missed in previous update

* Update url to use https: https is the usual transport and is needed to support checkout behind some firewalls

---------

Co-authored-by: Bernhard Kaindl <[email protected]>
  • Loading branch information
aweaver1fandm and bernhardkaindl authored Oct 15, 2024
1 parent c8f61c8 commit f8381c9
Showing 1 changed file with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions var/spack/repos/builtin/packages/tempo/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@
class Tempo(AutotoolsPackage):
"""Tempo is a program for pulsar timing data analysis."""

homepage = "https://tempo.sourceforge.net/"
git = "git://git.code.sf.net/p/tempo/tempo.git"
# Warning: Tempo references reads files that it's shipped with.
# It's written in Fortran and the fortran code declares strings of a certain length
# for those files. If you haven't modified some of the Spack configurations
# in terms of where the install go, hash length, etc. then it is likely
# that running tempo will fail with an error similar to
#
# more: cannot open /...../gcc-11.3.0/tempo-master-lnizs: No such file or directory
#

homepage = "http://tempo.sourceforge.net/"
git = "https://git.code.sf.net/p/tempo/tempo.git"

version("master", branch="master", preferred=True)
version("develop")
version("LWA-10-17-2020", commit="6bab1083350eca24745eafed79a55156bdd1e7d5")

Expand All @@ -22,5 +32,40 @@ class Tempo(AutotoolsPackage):
depends_on("automake", type="build")
depends_on("libtool", type="build")

def setup_dependent_run_environment(self, spack_env, dependent_spec):
spack_env.set("TEMPO_DIR", self.prefix)
@run_before("configure")
def edit(self):
# By default tempo.cfg.in uses abs_top_srcdir (i.e., the staging/build directory)
# In spack this directory gets deleted by default so make the file use the
# Install prefix directory instead but only for the master version
# So we don't possibly break anything for the LWA version
if "master" in str(self.version):
tempocfg = FileFilter("tempo.cfg.in")
tempocfg.filter(r"(.*)(abs_top_srcdir)(.*)", r"\1prefix\3")

@run_after("install")
def post_install_packages(self):

# Copy some files over needed by TEMPO, again only for the master version
if "master" in str(self.version):
cd(self.stage.source_path)
cp = which("cp")

cp("obsys.dat", join_path(self.prefix, "obsys.dat"))
cp("tempo.hlp", join_path(self.prefix, "tempo.hlp"))
cp("tempo.cfg", join_path(self.prefix, "tempo.cfg"))

cp("-r", "clock", join_path(self.prefix, "clock"))
cp("-r", "ephem", join_path(self.prefix, "ephem"))
cp("-r", "tzpar", join_path(self.prefix, "tzpar"))

def setup_dependent_build_environment(self, env, dependent_spec):
env.set("TEMPO", self.prefix)

def setup_dependent_run_environment(self, env, dependent_spec):
env.set("TEMPO", self.prefix)

# For LWA-10-17-2020 version
env.set("TEMPO_DIR", self.prefix)

def setup_run_environment(self, env):
env.set("TEMPO", self.prefix)

0 comments on commit f8381c9

Please sign in to comment.