Skip to content

check type of source_tmpl value for extensions, ensure it's a string value (not a list)#3799

Merged
Micket merged 1 commit intoeasybuilders:developfrom
boegel:source_tmpl_type_check
Aug 11, 2021
Merged

check type of source_tmpl value for extensions, ensure it's a string value (not a list)#3799
Micket merged 1 commit intoeasybuilders:developfrom
boegel:source_tmpl_type_check

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Aug 11, 2021

Without the changes in easyblock.py, the added test fails with:

ERROR: test_extension_source_tmpl (__main__.EasyBlockTest)
Test type checking for 'source_tmpl' value of an extension.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Volumes/work/easybuild-framework/test/framework/easyblock.py", line 1075, in test_extension_source_tmpl
    self.assertErrorRegex(EasyBuildError, error_pattern, eb.fetch_step)
  File "/Volumes/work/easybuild-framework/easybuild/base/testing.py", line 155, in assertErrorRegex
    call(*args, **kwargs)
  File "/Volumes/work/easybuild-framework/easybuild/framework/easyblock.py", line 1972, in fetch_step
    self.exts = self.fetch_extension_sources(skip_checksums=skip_checksums)
  File "/Volumes/work/easybuild-framework/easybuild/framework/easyblock.py", line 597, in fetch_extension_sources
    src_path = self.obtain_file(src_fn, extension=True, urls=source_urls,
  File "/Volumes/work/easybuild-framework/easybuild/framework/easyblock.py", line 682, in obtain_file
    if re.match(r"^(https?|ftp)://", filename):
  File "/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/re.py", line 191, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object

----------------------------------------------------------------------
Ran 1 test in 0.187s

FAILED (errors=1)

which reproduces the problem reported in easybuilders/easybuild-easyconfigs#13657

With the changes included in this PR, we get a clean/clear error:

$ eb foo.eb
...
ERROR: Build of /home/example/foo.eb failed (err: "build failed (first 300 chars): source_tmpl value must be a string! (found value of type 'list'): ['isodate-0.6.0-py2.py3-none-any.whl']")

Copy link
Copy Markdown
Contributor

@Micket Micket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Micket Micket merged commit 0d22e25 into easybuilders:develop Aug 11, 2021
@boegel boegel deleted the source_tmpl_type_check branch August 11, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants