Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/_common.py: add a shared Python file to move duplicated code #12755

Merged
merged 36 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a2a4f8b
`scripts/_common.py`: add a shared Python file to move duplicated code
sebastiaanspeck May 7, 2024
2dd28bd
scripts/*: revert sync back to scripts
sebastiaanspeck May 7, 2024
55b5fde
scripts/set-alias-page.py: fix docs
sebastiaanspeck May 7, 2024
be22fa3
scripts/set-alias-page.py: enable print again
sebastiaanspeck May 7, 2024
8da2442
Apply suggestions from code review
sebastiaanspeck May 11, 2024
ce6118f
Apply suggestions from code review
sebastiaanspeck May 11, 2024
ac60832
scripts/*.py: align
sebastiaanspeck May 11, 2024
afeb4c7
scripts/_common.py: provide tests
sebastiaanspeck May 11, 2024
bfe889f
Update _common.py
sebastiaanspeck May 11, 2024
1dc7f58
Update _common.py
sebastiaanspeck May 11, 2024
76560c9
Update _common.py
sebastiaanspeck May 11, 2024
df1979c
Update _common.py
sebastiaanspeck May 11, 2024
a33e68d
Update _common.py
sebastiaanspeck May 11, 2024
100f981
Update set-alias-page.py
sebastiaanspeck May 11, 2024
201041a
Update set-more-info-link.py
sebastiaanspeck May 11, 2024
cd42076
Update set-alias-page.py
sebastiaanspeck May 11, 2024
6c67001
Update _common.py
sebastiaanspeck May 11, 2024
eab71a9
Update _common.py
sebastiaanspeck May 11, 2024
534a556
Update _common.py
sebastiaanspeck May 11, 2024
39b5d52
Update _common.py
sebastiaanspeck May 11, 2024
43f2557
Update _common.py
sebastiaanspeck May 11, 2024
43d1a18
Update _common.py
sebastiaanspeck May 11, 2024
c631bd4
Update _common.py
sebastiaanspeck May 11, 2024
85aad39
Apply suggestions from code review
sebastiaanspeck May 11, 2024
5c115a8
ci: move requirements to a file
sebastiaanspeck May 11, 2024
d52a144
Create test-requirements
sebastiaanspeck May 11, 2024
cb46e8d
Rename test-requirements to test-requirements.txt
sebastiaanspeck May 11, 2024
e578ce2
Move to test.sh
sebastiaanspeck May 12, 2024
c70329d
scripts/_common.py: add more tests and make more robust
sebastiaanspeck May 12, 2024
ba583c4
scripts/set-*.py: refactor even further
sebastiaanspeck May 13, 2024
2e6ff1e
scripts/*.py: add documentation and fix small issues
sebastiaanspeck May 14, 2024
b4eaaef
Update _common.py
sebastiaanspeck May 15, 2024
337b5c4
Merge branch 'main' into common-python-script
sebastiaanspeck May 15, 2024
0801970
Merge branch 'main' into common-python-script
sebastiaanspeck May 15, 2024
fdbd721
Apply suggestions from code review
sebastiaanspeck May 16, 2024
bb58593
cleanup: update scripts README
kbdharun May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: npm ci

- name: Install pip dependencies
run: pip install -r requirements.txt -r scripts/pdf/requirements.txt
run: pip install -r requirements.txt -r scripts/pdf/requirements.txt -r scripts/test-requirements.txt

- name: Test
run: npm test
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ scripts/pdf/tldr-pages.pdf
# Python venv for testing the PDF script
# Create it with: python3 -m venv scripts/pdf/venv/
venv

# Generated pycache
__pycache__
17 changes: 10 additions & 7 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@

The current directory contains useful scripts used/to use with `tldr` pages.

> [!NOTE]
> [Git](https://git-scm.com/) and [Python](https://www.python.org/) must be installed in your system to run/test the scripts locally.

## Summary

This section contains a summary of the scripts available in this directory. For more information about each script, please refer to the header of each script.

- [pdf](pdf/README.md) directory contains the `render.py` and `build-pdf.sh` script and related resources to generate a PDF document of tldr-pages for a specific language or platform (or both).
- [build.sh](build.sh) script builds the ZIP archives of the `pages` directory.
- [build-index.sh](build-index.sh) script builds the index of available pages.
- [check-pr.sh](check-pr.sh) script checks the pages syntax and performs various checks on the PR.
- [check-pr.sh](check-pr.sh) script checks the page's syntax and performs various checks on the PR.
- [deploy.sh](deploy.sh) script deploys the ZIP and PDF archives to the static website repository.
- [send-to-bot.py](send-to-bot.py) is a Python script that send the build or tests output to tldr-bot.
- [send-to-bot.py](send-to-bot.py) is a Python script that sends the build or test output to tldr-bot.
- [set-alias-page.py](set-alias-page.py) is a Python script to generate or update alias pages.
- [set-more-info-link.py](set-more-info-link.py) is a Python script to generate or update more information links across pages.
- [set-page-title.py](set-page-title.py) is a Python script to update the title across pages.
- [test.sh](test.sh) script runs some basic tests on every PR/commit to make sure that the pages are valid and that the code is formatted correctly.
- [test.sh](test.sh) script runs some basic tests on every PR/commit to ensure the pages are valid and the code is formatted correctly.
- [wrong-filename.sh](wrong-filename.sh) script checks the consistency between the filenames and the page title.
- [update-command.py](update-command.py) is a Python script to update the common contents of a command example across all languages.

## Compatibility

The below table shows the compatibility of user-executable scripts with different platforms.
The table below shows the compatibility of user-executable scripts with different platforms:

| Script | Linux | macOS (`osx`) | Windows |
| ------ | ----- | ----- | ------- |
| [render.py](pdf/render.py) | ✅ | ✅ | ✅ |
| [build-pdf.sh](pdf/build-pdf.sh) | ✅ | ✅ | ❌ |
| [build.sh](build.sh) | ✅ | ✅ | ❌ |
| [build-pdf.sh](pdf/build-pdf.sh) | ✅ | ✅ | ❌ (WSL ✅)|
| [build.sh](build.sh) | ✅ | ✅ | ❌ (WSL ✅)|
| [set-alias-pages.py](set-alias-pages.py) | ✅ | ✅ | ✅ |
| [set-more-info-link.py](set-more-info-link.py) | ✅ | ✅ | ✅ |
| [set-page-title.py](set-page-title.py) | ✅ | ✅ | ✅ |
| [wrong-filename.sh](wrong-filename.sh) | ✅ | ❌ | ❌ |
| [wrong-filename.sh](wrong-filename.sh) | ✅ | ❌ | ❌ (WSL ✅)|
| [update-command.py](update-command.py) | ✅ | ✅ | ✅ |