summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Blake <blake14@llnl.gov>2020-08-28 14:22:28 -0700
committerGitHub <noreply@github.com>2020-08-28 16:22:28 -0500
commiteb8ff0bc81a2029ebeaa59ec582f549fee0a738d (patch)
tree8d252562a68029f7953ac9f9b0cb000aa2652191
parentaca370a3a2dc35dc5ccc8410dab3f91743715d14 (diff)
downloadspack-eb8ff0bc81a2029ebeaa59ec582f549fee0a738d.tar.gz
spack-eb8ff0bc81a2029ebeaa59ec582f549fee0a738d.tar.bz2
spack-eb8ff0bc81a2029ebeaa59ec582f549fee0a738d.tar.xz
spack-eb8ff0bc81a2029ebeaa59ec582f549fee0a738d.zip
Adding externals for bison and flex (#18358)
* Adding externals for bison and flex Added because bison actually pulls in a ton of stuff. * Need to escape parentheses. * Need to add re package. * Adding re package.
-rw-r--r--var/spack/repos/builtin/packages/bison/package.py9
-rw-r--r--var/spack/repos/builtin/packages/flex/package.py22
2 files changed, 31 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/bison/package.py b/var/spack/repos/builtin/packages/bison/package.py
index 6fe36efed9..003aff1290 100644
--- a/var/spack/repos/builtin/packages/bison/package.py
+++ b/var/spack/repos/builtin/packages/bison/package.py
@@ -6,6 +6,7 @@
from spack import *
from spack.operating_systems.mac_os import macos_version
import sys
+import re
class Bison(AutotoolsPackage, GNUMirrorPackage):
@@ -16,6 +17,8 @@ class Bison(AutotoolsPackage, GNUMirrorPackage):
homepage = "https://www.gnu.org/software/bison/"
gnu_mirror_path = "bison/bison-3.6.4.tar.gz"
+ executables = ['^bison$']
+
version('3.6.4', sha256='8183de64b5383f3634942c7b151bf2577f74273b2731574cdda8a8f3a0ab13e9')
version('3.6.3', sha256='4b4c4943931e811f1073006ce3d8ee022a02b11b501e9cbf4def3613b24a3e63')
version('3.6.2', sha256='e28ed3aad934de2d1df68be209ac0b454f7b6d3c3d6d01126e5cd2cbadba089a')
@@ -49,3 +52,9 @@ class Bison(AutotoolsPackage, GNUMirrorPackage):
patch('secure_snprintf.patch', level=0, when='@3.0.4')
build_directory = 'spack-build'
+
+ @classmethod
+ def determine_version(cls, exe):
+ output = Executable(exe)('--version', output=str, error=str)
+ match = re.search(r'bison \(GNU Bison\)\s+(\S+)', output)
+ return match.group(1) if match else None
diff --git a/var/spack/repos/builtin/packages/flex/package.py b/var/spack/repos/builtin/packages/flex/package.py
index 83214099f2..0197dab272 100644
--- a/var/spack/repos/builtin/packages/flex/package.py
+++ b/var/spack/repos/builtin/packages/flex/package.py
@@ -5,6 +5,7 @@
from spack import *
import os
+import re
class Flex(AutotoolsPackage):
@@ -13,6 +14,8 @@ class Flex(AutotoolsPackage):
homepage = "https://github.com/westes/flex"
url = "https://github.com/westes/flex/releases/download/v2.6.1/flex-2.6.1.tar.gz"
+ executables = ['^flex$']
+
version('2.6.4', sha256='e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995')
version('2.6.3', sha256='68b2742233e747c462f781462a2a1e299dc6207401dac8f0bbb316f48565c2aa')
# Avoid flex '2.6.2' (major bug)
@@ -43,6 +46,25 @@ class Flex(AutotoolsPackage):
# - https://github.com/westes/flex/issues/241
patch('https://github.com/westes/flex/commit/24fd0551333e7eded87b64dd36062da3df2f6380.patch', sha256='09c22e5c6fef327d3e48eb23f0d610dcd3a35ab9207f12e0f875701c677978d3', when='@2.6.4')
+ @classmethod
+ def determine_version(cls, exe):
+ output = Executable(exe)('--version', output=str, error=str)
+ match = re.search(r'flex\s+(\S+)', output)
+ return match.group(1) if match else None
+
+ @classmethod
+ def determine_variants(cls, exes, version):
+ results = []
+ for exe in exes:
+ variants = ''
+ path = os.path.dirname(exe)
+ if 'lex' in os.listdir(path):
+ variants += "+lex"
+ else:
+ variants += "~lex"
+ results.append(variants)
+ return results
+
@when('@:2.6.0,2.6.4')
def autoreconf(self, spec, prefix):
autogen = Executable('./autogen.sh')