Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ jobs:
fetch-depth: 1

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.14'
cache: 'pip'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: Install Python dependencies
Expand Down
6 changes: 3 additions & 3 deletions OUTSIDE_DOCS
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ cozy-konnector-libs https://github.com/konnectors/libs.git packages/cozy-konnect
cozy-scripts https://github.com/cozy/create-cozy-app.git packages/cozy-scripts/docs
cozy-stack https://github.com/cozy/cozy-stack.git docs
cozy-desktop https://github.com/cozy-labs/cozy-desktop.git doc
babel-preset-cozy-app https://github.com/cozy/cozy-libs.git packages/babel-preset-cozy-app
commitlint-config-cozy https://github.com/cozy/cozy-libs.git packages/commitlint-config-cozy
babel-preset-cozy-app https://github.com/cozy/cozy-libs.git config/babel-preset-cozy-app
commitlint-config-cozy https://github.com/cozy/cozy-libs.git config/commitlint-config-cozy
cozy-device-helper https://github.com/cozy/cozy-libs.git packages/cozy-device-helper
eslint-config-cozy-app https://github.com/cozy/cozy-libs.git packages/eslint-config-cozy-app
eslint-config-cozy-app https://github.com/cozy/cozy-libs.git config/eslint-config-cozy-app
cozy-notifications https://github.com/cozy/cozy-libs.git packages/cozy-notifications
cozy-flags https://github.com/cozy/cozy-libs.git packages/cozy-flags
cozy-realtime https://github.com/cozy/cozy-libs.git packages/cozy-realtime
Expand Down
31 changes: 23 additions & 8 deletions generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
import fnmatch
import sh


class PythonTag:
"""Preserves !!python/* YAML tags as opaque pass-through values."""
def __init__(self, tag, value):
self.tag = tag
self.value = value


def simple_glob(directory, glob_pattern):
matches = []
for root, dirnames, filenames in os.walk(directory, followlinks=True):
Expand All @@ -21,15 +29,20 @@ def simple_glob(directory, glob_pattern):
return matches


def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict):
def ordered_load(stream, Loader=yaml.SafeLoader, object_pairs_hook=OrderedDict):
class OrderedLoader(Loader):
pass
def construct_mapping(loader, node):
loader.flatten_mapping(node)
return object_pairs_hook(loader.construct_pairs(node))
def construct_python_tag(loader, tag_suffix, node):
return PythonTag('tag:yaml.org,2002:python/' + tag_suffix, loader.construct_scalar(node))
OrderedLoader.add_constructor(
yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
construct_mapping)
OrderedLoader.add_multi_constructor(
'tag:yaml.org,2002:python/',
construct_python_tag)
return yaml.load(stream, OrderedLoader)


Expand All @@ -40,7 +53,10 @@ def _dict_representer(dumper, data):
return dumper.represent_mapping(
yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
data.items())
def _python_tag_representer(dumper, data):
return dumper.represent_scalar(data.tag, data.value)
OrderedDumper.add_representer(OrderedDict, _dict_representer)
OrderedDumper.add_representer(PythonTag, _python_tag_representer)
return yaml.dump(data, stream, OrderedDumper, **kwds)


Expand Down Expand Up @@ -106,12 +122,11 @@ def parse_external_doc_line(l):
def fetch_external_doc(repository, destination):
sh.rm('-rf', destination)
sh.mkdir('-p', destination)
with sh.pushd(destination):
if osp.exists('.git') and not has_pulled.get(repository):
sh.git('pull')
has_pulled[repository] = True
else:
sh.git('clone', repository, '--depth', '1', '.')
if osp.exists(osp.join(destination, '.git')) and not has_pulled.get(repository):
sh.git('pull', _cwd=destination)
has_pulled[repository] = True
else:
sh.git('clone', repository, '--depth', '1', '.', _cwd=destination)


def fetch_all_external_docs_from_file(filename):
Expand Down Expand Up @@ -212,7 +227,7 @@ def main(argv):
data['extra'] = dict(data['extra'], **outside_docs_entry)

with open('mkdocs.yml', 'w+') as f:
ordered_dump(data, f, indent=2, default_flow_style=False, Dumper=yaml.SafeDumper)
ordered_dump(data, f, indent=2, default_flow_style=False, Dumper=yaml.Dumper)
f.seek(0, 0)
content = f.read()
f.seek(0, 0)
Expand Down
39 changes: 26 additions & 13 deletions mkdocs.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,44 @@ theme:
custom_dir: cozy-theme
name: material
palette:
primary: blue
accent: blue
logo:
icon: cloud
- scheme: default
primary: blue
accent: blue
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
primary: blue
accent: blue
toggle:
icon: material/brightness-4
name: Switch to light mode
icon:
logo: material/cloud
font:
text: Lato
code: Ubuntu Mono
feature:
tabs: true
features:
- navigation.tabs
- navigation.top
- content.code.copy
markdown_extensions:
- admonition
- codehilite
- extra
- pymdownx.highlight
- pymdownx.superfences
- footnotes
- meta
- sane_lists
- smarty
- toc:
permalink: true
- pymdownx.emoji
extra:
search:
tokenizer: "[^a-z\u0430-\u044F\u04510-9\\-\\.]"
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
extra: {}
plugins:
- search
- search:
separator: '[\s\-\.]+'
- exclude-search:
exclude:
- cozy-stack/archives/*
41 changes: 7 additions & 34 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
setuptools
Babel==2.6.0
certifi==2018.8.24
chardet==3.0.4
Click==7.0
colorclass==2.2.0
docopt==0.6.2
idna==2.7
Jinja2==2.10.2
jsx-lexer==0.0.6
livereload==2.5.2
Markdown==3.2.1
markdown-i18n==2.1.2
MarkupSafe==1.1
packaging==20.5
pip-upgrader==1.4.6
Pygments==2.2.0
pyparsing==2.2.2
python-slugify==1.2.6
pytz==2018.5
PyYAML==6.0.1
requests==2.20.0
sh==1.12.14
six==1.16.0
terminaltables==3.1.0
tornado==6.0
transifex-client
tx==0.0.1
Unidecode==1.0.22
urllib3==1.24.2
mkdocs==1.2.3
mkdocs-material==4.4.0
mkdocs-exclude==1.0.2
mkdocs-exclude-search==0.5.4
mkdocs>=1.6,<2
mkdocs-material>=9.5,<10
mkdocs-exclude>=1.0
mkdocs-exclude-search>=0.6
jsx-lexer>=2.0
PyYAML>=6.0
sh>=2.0
Loading