diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1af3a9cc..effe9037 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,7 +13,7 @@ repos:
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- exclude: cibuildwheel/resources/pinned_docker_images.cfg
+ exclude: (cibuildwheel/resources/pinned_docker_images.cfg)|(.svg$)
- id: mixed-line-ending
- id: trailing-whitespace
diff --git a/README.md b/README.md
index 5bf61880..fcf76d11 100644
--- a/README.md
+++ b/README.md
@@ -201,29 +201,29 @@ Here are some repos that use cibuildwheel.
[xmlstarlet]: https://github.com/dimitern/xmlstarlet
[pybind11 scikit_build_example]: https://github.com/pybind/scikit_build_example
-[appveyor icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/appveyor.svg
-[github icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/github.svg
-[azurepipelines icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/azurepipelines.svg
-[circleci icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/circleci.svg
-[gitlab icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/gitlab.svg
-[travisci icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/travisci.svg
-[windows icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/windows.svg
-[apple icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/apple.svg
-[linux icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/linux.svg
+[appveyor icon]: docs/data/readme_icons/appveyor.svg
+[github icon]: docs/data/readme_icons/github.svg
+[azurepipelines icon]: docs/data/readme_icons/azurepipelines.svg
+[circleci icon]: docs/data/readme_icons/circleci.svg
+[gitlab icon]: docs/data/readme_icons/gitlab.svg
+[travisci icon]: docs/data/readme_icons/travisci.svg
+[windows icon]: docs/data/readme_icons/windows.svg
+[apple icon]: docs/data/readme_icons/apple.svg
+[linux icon]: docs/data/readme_icons/linux.svg
-
+
-
+
-
-
-
+
+
+
-
+
@@ -232,7 +232,7 @@ Here are some repos that use cibuildwheel.
-
+
@@ -240,7 +240,7 @@ Here are some repos that use cibuildwheel.
-
+
diff --git a/bin/projects.py b/bin/projects.py
index e478c6ae..d64977d1 100755
--- a/bin/projects.py
+++ b/bin/projects.py
@@ -5,7 +5,7 @@ Convert a yaml project list into a nice table.
Suggested usage:
- ./bin/projects.py bin/projects.yml --online --auth $GITHUB_API_TOKEN --readme README.md
+ ./bin/projects.py docs/data/projects.yml --online --auth $GITHUB_API_TOKEN --readme README.md
git diff
"""
@@ -18,6 +18,9 @@ from typing import Dict, Any, List, Optional, TextIO
import click
import yaml
from github import Github
+import urllib.request
+import xml.dom.minidom
+from pathlib import Path
ICONS = (
@@ -110,12 +113,38 @@ class Project:
return f""
+def fetch_icon(icon_name: str) -> None:
+ url = f'https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/{icon_name}.svg'
+ with urllib.request.urlopen(url) as f:
+ original_svg_data = f.read()
+
+ document = xml.dom.minidom.parseString(original_svg_data)
+ svgElement = document.documentElement
+ assert svgElement.nodeName == 'svg'
+ svgElement.setAttribute('width', '16px')
+ svgElement.setAttribute('fill', '#606060')
+
+ icon_path = path_for_icon(icon_name)
+ icon_path.parent.mkdir(parents=True, exist_ok=True)
+
+ with open(path_for_icon(icon_name), 'w') as f:
+ f.write(svgElement.toxml())
+
+
+def path_for_icon(icon_name: str) -> Path:
+ return Path('.') / 'docs' / 'data' / 'readme_icons' / f'{icon_name}.svg'
+
+
def str_projects(
config: List[Dict[str, Any]], *, online: bool = True, auth: Optional[str] = None
) -> str:
io = StringIO()
print = functools.partial(builtins.print, file=io)
+ if online:
+ for icon in ICONS:
+ fetch_icon(icon)
+
github = Github(auth) if online else None
projects = sorted((Project(item, github) for item in config), reverse=online)
@@ -130,9 +159,7 @@ def str_projects(
print()
for icon in ICONS:
- print(
- f"[{icon} icon]: https://cdn.jsdelivr.net/npm/simple-icons@v4/icons/{icon}.svg"
- )
+ print(f"[{icon} icon]: {path_for_icon(icon).as_posix()}")
print()
for project in projects:
diff --git a/docs/data/readme_icons/apple.svg b/docs/data/readme_icons/apple.svg
new file mode 100644
index 00000000..f8780367
--- /dev/null
+++ b/docs/data/readme_icons/apple.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/appveyor.svg b/docs/data/readme_icons/appveyor.svg
new file mode 100644
index 00000000..6fa0bac2
--- /dev/null
+++ b/docs/data/readme_icons/appveyor.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/azurepipelines.svg b/docs/data/readme_icons/azurepipelines.svg
new file mode 100644
index 00000000..e307977c
--- /dev/null
+++ b/docs/data/readme_icons/azurepipelines.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/circleci.svg b/docs/data/readme_icons/circleci.svg
new file mode 100644
index 00000000..2945b71c
--- /dev/null
+++ b/docs/data/readme_icons/circleci.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/github.svg b/docs/data/readme_icons/github.svg
new file mode 100644
index 00000000..08c1abee
--- /dev/null
+++ b/docs/data/readme_icons/github.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/gitlab.svg b/docs/data/readme_icons/gitlab.svg
new file mode 100644
index 00000000..51222122
--- /dev/null
+++ b/docs/data/readme_icons/gitlab.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/linux.svg b/docs/data/readme_icons/linux.svg
new file mode 100644
index 00000000..355dfd3d
--- /dev/null
+++ b/docs/data/readme_icons/linux.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/travisci.svg b/docs/data/readme_icons/travisci.svg
new file mode 100644
index 00000000..3efbee2a
--- /dev/null
+++ b/docs/data/readme_icons/travisci.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/data/readme_icons/windows.svg b/docs/data/readme_icons/windows.svg
new file mode 100644
index 00000000..0e103619
--- /dev/null
+++ b/docs/data/readme_icons/windows.svg
@@ -0,0 +1 @@
+
\ No newline at end of file