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
6
Merge Requests
6
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
e3c63a02
Commit
e3c63a02
authored
Nov 05, 2022
by
Maurits van Rees
Committed by
Godefroid Chapelle
Nov 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for PEP 508 markers.
parent
43a54e75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
src/zc/buildout/tests/configparser.test
src/zc/buildout/tests/configparser.test
+70
-0
No files found.
src/zc/buildout/tests/configparser.test
View file @
e3c63a02
...
...
@@ -326,3 +326,73 @@ Preprocessing of implication and unicode cuteness::
>>>
pprint
(
parse
(
text
))
{
'foo'
:
{
'<part-dependencies>'
:
'part1 part2'
}}
A
recent
addition
is
support
for
PEP
508
markers
::
[
section
]
# These are the values when no other section overrides them.
a
=
1
b
=
1
[
section
:
python_version
<
"2.6"
]
a
=
26
[
section
:
python_version
<
"4.0"
]
b
=
40
..
->
text
>>>
pprint
(
parse
(
text
))
{
'section'
:
{
'a'
:
'1'
,
'b'
:
'40'
}}
You
can
use
the
platform. This is hard to test because the tests run on various platforms.
But an unknown platform should never match::
[section]
# These are the values when no other section overrides them.
a = 1
[section: platform_system == "msdos"]
a = 2
.. -> text
>>> pprint(parse(text))
{'section': {'a': '1'}}
You can make combinations::
[section]
# These are the values when no other section overrides them.
a = 1
b = 1
[section: python_version >= "2.0" and platform_system != "msdos"]
a = 2
[section: python_version >= "2.0" or platform_system == "msdos"]
b = 3
.. -> text
>>> pprint(parse(text))
{'section': {'a': '2', 'b': '3'}}
The old and new style conditional expressions can be used in the same file::
[section]
# These are the values when no other section overrides them.
a = 1
b = 1
[section: python_version >= "2.0"]
a = 4
[section:linux or windows or cygwin or macosx or solaris or posix or True]
b = 5
.. -> text
>>> pprint(parse(text, zc.buildout.buildout._default_globals))
{'section': {'a': '4', 'b': '5'}}
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