summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/aperture-photometry/package.py
blob: 82d4af33b06842d10a245dd24c2fa7b5af1efab1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright 2013-2018 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)

from spack import *
import os.path


class AperturePhotometry(Package):
    """Aperture Photometry Tool APT is software for astronomical research"""

    homepage = "http://www.aperturephotometry.org/aptool/"
    url      = "http://www.aperturephotometry.org/aptool/wp-content/plugins/download-monitor/download.php?id=1"

    version('2.7.2', '2beca6aac14c5e0a94d115f81edf0caa9ec83dc9d32893ea00ee376c9360deb0', extension='tar.gz')

    depends_on('java')

    def install(self, spec, prefix):
        mkdirp(prefix.bin)
        jar_file = 'APT.jar'
        install(jar_file, prefix.bin)
        java = join_path(self.spec['java'].prefix, 'bin', 'java')
        script_sh = join_path(os.path.dirname(__file__), "APT.sh")
        script = join_path(prefix.bin, "apt")
        install(script_sh, script)
        set_executable(script)
        kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
        filter_file('^java', java, script, **kwargs)
        filter_file('APT.jar', join_path(prefix.bin, 'APT.jar'),
                    script, **kwargs)