Skip to content

Commit

Permalink
Automated update from ferrocene/ferrocene
Browse files Browse the repository at this point in the history
mirrored-commit: c4af68e62e357b0b33f0fa12802a1207e3291185
  • Loading branch information
Urhengulas committed Jul 23, 2024
1 parent 52d3766 commit 9616c4d
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 50 deletions.
42 changes: 35 additions & 7 deletions exts/ferrocene_domain_cli/domain.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# SPDX-License-Identifier: MIT OR Apache-2.0
# SPDX-FileCopyrightText: The Ferrocene Developers


from dataclasses import dataclass
import re
import string

from docutils import nodes
from docutils.parsers.rst import directives

from sphinx import addnodes
from sphinx.directives import SphinxDirective, ObjectDescription
from sphinx.domains import Domain, ObjType
from sphinx.roles import XRefRole
import re
import sphinx
import string


PROGRAM_STORAGE = "ferrocene_domain_cli:program"
Expand All @@ -18,17 +23,28 @@ class ProgramDirective(SphinxDirective):
has_content = True
required_arguments = 1
final_argument_whitespace = True
option_spec = {"no_traceability_matrix": directives.flag}

def run(self):
# if there already is program data in storage, a ProgramDirective is
# within a ProgramDirective, which isn't supported
if PROGRAM_STORAGE in self.env.temp_data:
warn("cli:program inside cli:program isn't supported", self.get_location())
return []
self.env.temp_data[PROGRAM_STORAGE] = self.arguments[0]

# store arguments, so they can be accessed by child `OptionDirective`s
self.env.temp_data[PROGRAM_STORAGE] = ProgramStorage(
self.arguments[0],
"no_traceability_matrix" in self.options,
)

# parse and process content of `ProgramDirective`` (one or more `OptionDirective`s)
node = nodes.container()
self.state.nested_parse(self.content, self.content_offset, node)

# clear program storage
del self.env.temp_data[PROGRAM_STORAGE]

return [node]


Expand All @@ -43,11 +59,16 @@ def handle_signature(self, sig, signode):
def add_target_and_index(self, name_cls, sig, signode):
if PROGRAM_STORAGE not in self.env.temp_data:
warn("cli:option outside cli:program isn't supported", self.get_location())
program = "PLACEHOLDER"
program_storage = ProgramStorage("PLACEHOLDER", False)
else:
program = self.env.temp_data[PROGRAM_STORAGE]
program_storage: ProgramStorage = self.env.temp_data[PROGRAM_STORAGE]

option = Option(self.env.docname, program, sig)
option = Option(
self.env.docname,
program_storage.program_name,
sig,
program_storage.no_traceability_matrix,
)

signode["ids"].append(option.id())

Expand All @@ -61,10 +82,11 @@ def add_target_and_index(self, name_cls, sig, signode):


class Option:
def __init__(self, document, program, option):
def __init__(self, document, program, option, no_traceability_matrix):
self.document = document
self.program = program
self.option = option
self.no_traceability_matrix = no_traceability_matrix

def id(self):
option = (
Expand Down Expand Up @@ -149,3 +171,9 @@ def warn(message, location):

def setup(app):
app.add_domain(CliDomain)


@dataclass
class ProgramStorage:
program_name: str
no_traceability_matrix: bool
3 changes: 3 additions & 0 deletions exts/ferrocene_domain_cli/traceability_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def write_traceability_ids(app):

options_by_document = defaultdict(list)
for option in env.get_domain("cli").get_options().values():
if option.no_traceability_matrix:
continue

options_by_document[option.document].append(
{
"id": option.id(),
Expand Down
12 changes: 10 additions & 2 deletions exts/ferrocene_qualification/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# SPDX-License-Identifier: MIT OR Apache-2.0
# SPDX-FileCopyrightText: The Ferrocene Developers

from . import substitutions, document_id, domain, signature_page, target
from . import (
document_id,
domain,
intersphinx_support,
signature_page,
substitutions,
target,
)
import string


Expand All @@ -11,16 +18,17 @@ def setup(app):
domain.setup(app)
signature_page.setup(app)
target.setup(app)
intersphinx_support.setup(app)

app.connect("config-inited", validate_config)
app.add_config_value("ferrocene_id", None, "env", [str])
app.add_config_value("ferrocene_substitutions_path", None, "env", [str])
app.add_config_value("ferrocene_target_names_path", None, "env", [str])
app.add_config_value("ferrocene_signature", None, "env", [str])
app.add_config_value("ferrocene_private_signature_files_dir", None, "env", [str])
app.add_config_value("rustfmt_version", None, "env", [str])
app.add_config_value("ferrocene_version", None, "env", [str])
app.add_config_value("rust_version", None, "env", [str])
app.add_config_value("channel", None, "env", [str])

return {
"version": "0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT OR Apache-2.0
# SPDX-FileCopyrightText: The Ferrocene Developers

# This extension adds some helpers needed to integrate Ferrocene's build system
# This module adds some helpers needed to integrate Ferrocene's build system
# with InterSphinx. More specifically, the extension:
#
# - Defines the "ferrocene-intersphinx" Sphinx builder, which only produces the
Expand All @@ -18,6 +18,7 @@
from sphinx.builders.html import StandaloneHTMLBuilder
import json
import sphinx
import sphinx.ext.intersphinx


class IntersphinxBuilder(Builder):
Expand Down Expand Up @@ -81,13 +82,11 @@ def inject_intersphinx_mappings(app, config):


def setup(app):
# Automatically enable the sphinx.ext.intersphinx extension without
# requiring users to configure it in their conf.py.
sphinx.ext.intersphinx.setup(app)

app.add_builder(IntersphinxBuilder)

app.add_config_value("ferrocene_intersphinx_mappings", None, "env", [str])
app.connect("config-inited", inject_intersphinx_mappings, priority=1)

return {
"version": "0",
"parallel_read_safe": True,
"parallel_write_safe": True,
}
5 changes: 1 addition & 4 deletions exts/ferrocene_qualification/substitutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def apply(self):
# look at sphinx-substitutions.toml for the rest of the substitutions
self.add_substitution("doc_title", self.app.config["html_short_title"])
self.add_substitution("doc_short_title", self.app.config["ferrocene_id"])
self.add_substitution("rustfmt_version", self.app.config["rustfmt_version"])
self.add_substitution(
"ferrocene_version",
self.app.config["ferrocene_version"],
Expand All @@ -39,10 +40,6 @@ def apply(self):
"rust_version",
self.app.config["rust_version"],
)
self.add_substitution(
"channel",
self.app.config["channel"],
)

def add_substitution(self, name, value):
substitution = nodes.substitution_definition()
Expand Down
52 changes: 27 additions & 25 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,33 +122,33 @@ colorama==0.4.6 \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
# via sphinx-autobuild
docutils==0.20.1 \
--hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \
--hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b
docutils==0.21.2 \
--hash=sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f \
--hash=sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2
# via
# myst-parser
# sphinx
exceptiongroup==1.2.0 \
--hash=sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14 \
--hash=sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68
exceptiongroup==1.2.1 \
--hash=sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad \
--hash=sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16
# via anyio
h11==0.14.0 \
--hash=sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d \
--hash=sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761
# via uvicorn
idna==3.6 \
--hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \
--hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
idna==3.7 \
--hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \
--hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0
# via
# anyio
# requests
imagesize==1.4.1 \
--hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \
--hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a
# via sphinx
importlib-metadata==7.1.0 \
--hash=sha256:30962b96c0c223483ed6cc7280e7f0199feb01a0e40cfae4d4450fc6fab1f570 \
--hash=sha256:b78938b926ee8d5f020fc4772d487045805a55ddbad2ecf21c6d60938dc7fcd2
importlib-metadata==8.0.0 \
--hash=sha256:15584cf2b1bf449d98ff8a6ff1abef57bf20f3ac6454f431736cd3e660921b2f \
--hash=sha256:188bd24e4c346d3f0a933f275c2fec67050326a856b9a359881d7c2a697e8812
# via -r requirements.in
jinja2==3.1.3 \
--hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \
Expand Down Expand Up @@ -236,9 +236,9 @@ myst-parser==3.0.1 \
--hash=sha256:6457aaa33a5d474aca678b8ead9b3dc298e89c68e67012e73146ea6fd54babf1 \
--hash=sha256:88f0cb406cb363b077d176b51c476f62d60604d68a8dcdf4832e080441301a87
# via -r requirements.in
packaging==23.2 \
--hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \
--hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7
packaging==24.0 \
--hash=sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5 \
--hash=sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9
# via sphinx
pygments==2.17.2 \
--hash=sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c \
Expand Down Expand Up @@ -315,9 +315,9 @@ snowballstemmer==2.2.0 \
--hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \
--hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a
# via sphinx
sphinx==7.2.6 \
--hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \
--hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5
sphinx==7.4.6 \
--hash=sha256:116918d455c493fff3178edea12b4fe1c1e4894680fd81e7b7431ea21d47ca52 \
--hash=sha256:915760d6188288a1e30c2cd0d9fa31b1b009bc6e6019cc0c32d16c77d20e86d9
# via
# -r requirements.in
# myst-parser
Expand Down Expand Up @@ -357,16 +357,18 @@ starlette==0.37.2 \
tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
# via -r requirements.in
# via
# -r requirements.in
# sphinx
typing-extensions==4.11.0 \
--hash=sha256:83f085bd5ca59c80295fc2a82ab5dac679cbe02b9f33f7d83af68e241bea51b0 \
--hash=sha256:c1f94d72897edaf4ce775bb7558d5b79d8126906a14ea5ed1635921406c0387a
# via
# anyio
# uvicorn
urllib3==2.2.0 \
--hash=sha256:051d961ad0c62a94e50ecf1af379c3aba230c66c710493493560c0c223c49f20 \
--hash=sha256:ce3711610ddce217e6d113a2732fafad960a03fd0318c91faa79481e35c11224
urllib3==2.2.1 \
--hash=sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d \
--hash=sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19
# via requests
uvicorn==0.29.0 \
--hash=sha256:2c2aac7ff4f4365c206fd773a39bf4ebd1047c238f8b8268ad996829323473de \
Expand Down Expand Up @@ -523,7 +525,7 @@ websockets==12.0 \
--hash=sha256:fc4e7fa5414512b481a2483775a8e8be7803a35b30ca805afa4998a84f9fd9e8 \
--hash=sha256:ffefa1374cd508d633646d51a8e9277763a9b78ae71324183693959cf94635a7
# via sphinx-autobuild
zipp==3.17.0 \
--hash=sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31 \
--hash=sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0
zipp==3.18.1 \
--hash=sha256:206f5a15f2af3dbaee80769fb7dc6f249695e940acca08dfb2a4769fe61e538b \
--hash=sha256:2884ed22e7d8961de1c9a05142eb69a247f120291bc0206a00a7642f09b5b715
# via importlib-metadata
10 changes: 5 additions & 5 deletions themes/ferrocene/theme.conf → themes/ferrocene/theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# SPDX-FileCopyrightText: The Ferrocene Developers

[theme]
inherit = basic
stylesheet = ferrocene.css
inherit = "basic"
stylesheets = ["ferrocene.css"]

[options]
license =
commit =
include_in_header =
license = ""
commit = ""
include_in_header = ""

0 comments on commit 9616c4d

Please sign in to comment.