Skip to content

Commit c33cf3f

Browse files
authored
Merge pull request #4169 from AbrilRBS/ar/2.19-settings
Automatically get `settings.yml`
1 parent ee7d2b3 commit c33cf3f

File tree

3 files changed

+60
-167
lines changed

3 files changed

+60
-167
lines changed

_ext/conanhomefile.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import os
2+
import subprocess
3+
4+
from docutils import nodes
5+
from docutils.parsers.rst import directives
6+
from sphinx.util.docutils import SphinxDirective
7+
8+
class conanhomefile(nodes.literal_block, nodes.Element):
9+
pass
10+
11+
def visit_conanhomefile_node(self, node):
12+
self.visit_literal_block(node)
13+
14+
def depart_conanhomefile_node(self, node):
15+
self.depart_literal_block(node)
16+
17+
class ConanHomeFileDirective(SphinxDirective):
18+
has_content = True
19+
option_spec = {
20+
'file-path': directives.unchanged_required,
21+
'language': directives.unchanged,
22+
}
23+
24+
def run(self):
25+
output = subprocess.run(["conan", "config", "home"], stdout=subprocess.PIPE,
26+
stderr=subprocess.STDOUT,
27+
text=True, check=True)
28+
home_folder = output.stdout.strip()
29+
30+
file_path = os.path.join(home_folder, self.options['file-path'])
31+
32+
with open(file_path, 'r') as f:
33+
text = f.read()
34+
35+
highlight_language = self.options.get('language', 'text')
36+
37+
new_node = nodes.literal_block(text,
38+
text,
39+
language=highlight_language)
40+
self.state.nested_parse(self.content, self.content_offset, new_node)
41+
return [new_node]
42+
43+
44+
def setup(app):
45+
app.add_node(conanhomefile,
46+
html=(visit_conanhomefile_node, depart_conanhomefile_node),
47+
latex=(visit_conanhomefile_node, depart_conanhomefile_node),
48+
text=(visit_conanhomefile_node, depart_conanhomefile_node))
49+
50+
app.add_directive('conan-home-file', ConanHomeFileDirective)
51+
52+
return {
53+
'version': '0.1',
54+
'parallel_read_safe': True,
55+
'parallel_write_safe': True,
56+
}

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
'sphinxcontrib.jquery',
5353
'sphinxcontrib.youtube',
5454
'autocommand',
55+
'conanhomefile',
5556
]
5657

5758
# autodoc configuration

reference/config_files/settings.rst

Lines changed: 3 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -6,173 +6,9 @@ settings.yml
66
This configuration file is located in the Conan user home, i.e., ``[CONAN_HOME]/settings.yml``.
77
It looks like this:
88

9-
.. code-block:: yaml
10-
11-
# This file was generated by Conan. Remove this comment if you edit this file or Conan
12-
# will destroy your changes.
13-
os:
14-
Windows:
15-
subsystem: [null, cygwin, msys, msys2, wsl]
16-
WindowsStore:
17-
version: ["8.1", "10.0"]
18-
WindowsCE:
19-
platform: [ANY]
20-
version: ["5.0", "6.0", "7.0", "8.0"]
21-
Linux:
22-
iOS:
23-
version: &ios_version
24-
["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "8.4", "9.0", "9.1", "9.2", "9.3",
25-
"10.0", "10.1", "10.2", "10.3",
26-
"11.0", "11.1", "11.2", "11.3", "11.4",
27-
"12.0", "12.1", "12.2", "12.3", "12.4", "12.5",
28-
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
29-
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
30-
"15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "15.7", "15.8",
31-
"16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6", "16.7",
32-
"17.0", "17.1", "17.2", "17.3", "17.4", "17.5", "17.6", "17.8",
33-
"18.0", "18.1", "18.2", "18.3", "18.4"]
34-
sdk: ["iphoneos", "iphonesimulator"]
35-
sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
36-
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
37-
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4",
38-
"15.5", "16.0", "16.1", "16.2", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5",
39-
"18.0", "18.1", "18.2", "18.4"]
40-
watchOS:
41-
version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", "6.3",
42-
"7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6",
43-
"8.0", "8.1", "8.3", "8.4", "8.5", "8.6", "8.7",
44-
"9.0","9.1", "9.2", "9.3", "9.4", "9.5", "9.6",
45-
"10.0", "10.1", "10.2", "10.3", "10.4", "10.5", "10.6",
46-
"11.0", "11.1", "11.2", "11.3", "11.4"]
47-
sdk: ["watchos", "watchsimulator"]
48-
sdk_version: [null, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
49-
"7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.0.1", "8.3", "8.5", "9.0", "9.1",
50-
"9.4", "10.0", "10.1", "10.2", "10.4", "10.5",
51-
"11.0", "11.1", "11.2", "11.4"]
52-
tvOS:
53-
version: ["11.0", "11.1", "11.2", "11.3", "11.4",
54-
"12.0", "12.1", "12.2", "12.3", "12.4",
55-
"13.0", "13.2", "13.3", "13.4",
56-
"14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7",
57-
"15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6",
58-
"16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6",
59-
"17.0", "17.1", "17.2", "17.3", "17.4", "17.5", "17.6",
60-
"18.0", "18.1", "18.2", "18.3", "18.4"]
61-
sdk: ["appletvos", "appletvsimulator"]
62-
sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
63-
"13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "15.0",
64-
"15.2", "15.4", "15.5", "16.0", "16.1", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5",
65-
"18.0", "18.1", "18.2", "18.4"]
66-
visionOS:
67-
version: ["1.0", "1.1", "1.2", "1.3", "2.0", "2.1", "2.2", "2.3", "2.4"]
68-
sdk: ["xros", "xrsimulator"]
69-
sdk_version: [null, "1.0", "1.1", "1.2", "1.3", "2.0", "2.1", "2.2", "2.4"]
70-
Macos:
71-
version: [null, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15",
72-
"11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "11.6", "11.7",
73-
"12.0", "12.1", "12.2", "12.3", "12.4", "12.5", "12.6", "12.7",
74-
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
75-
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7",
76-
"15.0", "15.1", "15.2", "15.3", "15.4"]
77-
sdk_version: [null, "10.13", "10.14", "10.15", "11.0", "11.1", "11.2", "11.3", "12.0", "12.1",
78-
"12.3", "12.4", "13.0", "13.1", "13.3", "14.0", "14.2", "14.4", "14.5",
79-
"15.0", "15.1", "15.2", "15.4"]
80-
subsystem:
81-
null:
82-
catalyst:
83-
ios_version: *ios_version
84-
Android:
85-
api_level: [ANY]
86-
ndk_version: [null, ANY]
87-
FreeBSD:
88-
SunOS:
89-
AIX:
90-
Arduino:
91-
board: [ANY]
92-
Emscripten:
93-
Neutrino:
94-
version: ["6.4", "6.5", "6.6", "7.0", "7.1"]
95-
baremetal:
96-
VxWorks:
97-
version: ["7"]
98-
arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64,
99-
armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, arm64ec,
100-
sparc, sparcv9,
101-
mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le,
102-
e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7,
103-
riscv64, riscv32,
104-
xtensalx6, xtensalx106, xtensalx7,
105-
tc131, tc16, tc161, tc162, tc18]
106-
compiler:
107-
sun-cc:
108-
version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"]
109-
threads: [null, posix]
110-
libcxx: [libCstd, libstdcxx, libstlport, libstdc++]
111-
gcc:
112-
version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9",
113-
"5", "5.1", "5.2", "5.3", "5.4", "5.5",
114-
"6", "6.1", "6.2", "6.3", "6.4", "6.5",
115-
"7", "7.1", "7.2", "7.3", "7.4", "7.5",
116-
"8", "8.1", "8.2", "8.3", "8.4", "8.5",
117-
"9", "9.1", "9.2", "9.3", "9.4", "9.5",
118-
"10", "10.1", "10.2", "10.3", "10.4", "10.5",
119-
"11", "11.1", "11.2", "11.3", "11.4", "11.5",
120-
"12", "12.1", "12.2", "12.3", "12.4",
121-
"13", "13.1", "13.2", "13.3", "13.4",
122-
"14", "14.1", "14.2", "14.3",
123-
"15", "15.1"]
124-
libcxx: [libstdc++, libstdc++11]
125-
threads: [null, posix, win32, mcf] # Windows MinGW
126-
exception: [null, dwarf2, sjlj, seh] # Windows MinGW
127-
cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23, 26, gnu26]
128-
cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23]
129-
msvc:
130-
version: [170, 180, 190, 191, 192, 193, 194]
131-
update: [null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
132-
runtime: [static, dynamic]
133-
runtime_type: [Debug, Release]
134-
cppstd: [null, 14, 17, 20, 23]
135-
toolset: [null, v110_xp, v120_xp, v140_xp, v141_xp]
136-
cstd: [null, 11, 17]
137-
clang:
138-
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
139-
"5.0", "6.0", "7.0", "7.1",
140-
"8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
141-
"18", "19", "20"]
142-
libcxx: [null, libstdc++, libstdc++11, libc++, c++_shared, c++_static]
143-
cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23, 26, gnu26]
144-
runtime: [null, static, dynamic]
145-
runtime_type: [null, Debug, Release]
146-
runtime_version: [null, v140, v141, v142, v143, v144]
147-
cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23]
148-
apple-clang:
149-
version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1",
150-
"10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0", "15", "15.0",
151-
"16", "16.0", "17", "17.0"]
152-
libcxx: [libstdc++, libc++]
153-
cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23, 26, gnu26]
154-
cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23]
155-
intel-cc:
156-
version: ["2021.1", "2021.2", "2021.3", "2021.4", "2022.1", "2022.2",
157-
"2022.3", "2023.0", "2023.1", "2023.2", "2024.0", "2024.1",
158-
"2025.0", "2025.1"]
159-
update: [null, ANY]
160-
mode: ["icx", "classic", "dpcpp"]
161-
libcxx: [null, libstdc++, libstdc++11, libc++]
162-
cppstd: [null, 98, gnu98, "03", gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
163-
runtime: [null, static, dynamic]
164-
runtime_type: [null, Debug, Release]
165-
qcc:
166-
version: ["4.4", "5.4", "8.3"]
167-
libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne]
168-
cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17]
169-
mcst-lcc:
170-
version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"]
171-
libcxx: [libstdc++, libstdc++11]
172-
cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
173-
174-
build_type: [null, Debug, Release, RelWithDebInfo, MinSizeRel]
175-
9+
.. conan-home-file::
10+
:file-path: settings.yml
11+
:language: yaml
17612

17713
As you can see, the possible values of ``settings`` are defined in the same file. This is done to ensure matching naming and
17814
spelling as well as defining a common settings model among users and the OSS community. Some general information about settings:

0 commit comments

Comments
 (0)