# 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)

from spack import *


class Syscalc(MakefilePackage):
    """ A tool to derive theoretical systematic uncertainties"""

    homepage = "https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/SysCalc"
    url      = "https://bazaar.launchpad.net/~mgtools/mg5amcnlo/SysCalc/tarball/17"

    version('1.1.7', sha256='ac73df0f9f195eb62601fafc2eede3db17a562750f7971616870d6df4abd1b6c',
            url='https://bazaar.launchpad.net/~mgtools/mg5amcnlo/SysCalc/tarball/17')

    tags = ['hep']

    depends_on('lhapdf@6:')

    def url_for_version(self, version):
        url = self.url.rsplit('/', 1)[0]
        url += '/SysCalc_V{0}.tar.gz'

        url = url.format(version)
        return url

    def install(self, spec, prefix):
        mkdirp(prefix.bin)
        install('sys_calc', prefix.bin)
        install_tree('include', prefix.include)

@@ -651,16 +651,46 @@
 ball/17'
+,%0A            extension='.tgz'
 )%0A%0A    t
@@ -907,16 +907,123 @@
 rn url%0A%0A
+    def build(self, spec, prefix):%0A        with working_dir('mg5amcnlo/SysCalc'):%0A            make('all')%0A%0A
     def 
@@ -1070,32 +1070,83 @@
 irp(prefix.bin)%0A
+        with working_dir('mg5amcnlo/SysCalc'):%0A    
         install(
@@ -1161,32 +1161,36 @@
 c', prefix.bin)%0A
+    
         install_

fix recipe and URL (extension) (#22112)