Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
7
Merge Requests
7
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.buildout
Commits
6c715477
Commit
6c715477
authored
Nov 25, 2021
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: bad error if extends-cache with ${section:variable}
Solution: add explicit error message
parent
2480e5b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
news/585.feature
news/585.feature
+1
-0
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+8
-1
src/zc/buildout/tests/extends-cache.txt
src/zc/buildout/tests/extends-cache.txt
+22
-0
No files found.
news/585.feature
0 → 100644
View file @
6c715477
Proper error message if extends-cache tries to expand ${section
:
variable}
src/zc/buildout/buildout.py
View file @
6c715477
...
...
@@ -1786,6 +1786,7 @@ def _default_globals():
return
globals_defs
variable_template_split
=
re
.
compile
(
'([$]{[^}]*})'
).
split
def
_open
(
base
,
filename
,
seen
,
download_options
,
...
...
@@ -1799,8 +1800,14 @@ def _open(
raw_download_options
=
_unannotate_section
(
download_options
)
newest
=
bool_option
(
raw_download_options
,
'newest'
,
'false'
)
fallback
=
newest
and
not
(
filename
in
downloaded
)
extends_cache
=
raw_download_options
.
get
(
'extends-cache'
)
if
extends_cache
and
variable_template_split
(
extends_cache
)[
1
::
2
]:
raise
ValueError
(
"extends-cache '%s' may not contain ${section:variable} to expand."
%
extends_cache
)
download
=
zc
.
buildout
.
download
.
Download
(
raw_download_options
,
cache
=
raw_download_options
.
get
(
'extends-cache'
)
,
raw_download_options
,
cache
=
extends_cache
,
fallback
=
fallback
,
hash_name
=
True
)
is_temp
=
False
downloaded_filename
=
None
...
...
src/zc/buildout/tests/extends-cache.txt
View file @
6c715477
...
...
@@ -550,6 +550,28 @@ file: http://localhost/faulty.cfg (downloaded as ...), line: 1
'This is definitively not\n'
Failing if extends-cache contains ${section:variable}
-----------------------------------------------------
Because extends-cache is used to download extends, it may not contain ${section:variable}
as the state of all variables cannot be computed before all extends have been loaded.
>>> write(server_data, 'proper.cfg', """\
... [buildout]
... dummy = fjhfj
... """)
>>> write('buildout.cfg', """\
... [buildout]
... extends = %sproper.cfg
... extends-cache = ${buildout:dummy}
... """ % server_url)
>>> print_(system(buildout))
While:
Initializing.
... ValueError: extends-cache '${buildout:dummy}' may not contain ${section:variable} to expand.
Clean up
--------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment