summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/gams/package.py
blob: e6025805e5ad2f1f2294693febf9028d9f1f61ab (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
33
34
35
36
37
38
39
# Copyright 2013-2021 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)

import os

from spack import *


class Gams(Package):
    """The General Algebraic Modeling System is a high-level modeling system
    for mathematical optimization. GAMS is designed for modeling and solving
    linear, nonlinear, and mixed-integer optimization problems."""

    homepage = "https://www.gams.com/"
    manual_download = True

    version('27.2', '4f3f3484a4389661e0522a4cfe0289fd', expand=False)

    def url_for_version(self, version):
        return "file://{0}/linux_x64_64_sfx.exe".format(os.getcwd())

    def setup_run_environment(self, env):
        env.prepend_path("PATH", join_path(
            self.prefix, 'gams{0}_linux_x64_64_sfx'.format(self.version)))

    def install(self, spec, prefix):
        os.chmod(join_path(self.stage.source_path,
                           "linux_x64_64_sfx.exe"), 0o755)
        os.system("./linux_x64_64_sfx.exe")
        install_tree(join_path(self.stage.source_path,
                               'gams{0}_linux_x64_64_sfx'
                               .format(self.version)),
                     join_path(self.prefix, 'gams{0}_linux_x64_64_sfx'
                               .format(self.version)))
        install('{0}/gamslice.txt'.format(os.getcwd()),
                join_path(self.prefix, 'gams{0}_linux_x64_64_sfx'
                          .format(self.version), 'gamslice.txt'))