-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
chore: change scripts to makefile #821
Draft
rockleona
wants to merge
2
commits into
python:3.12
Choose a base branch
from
rockleona:chore/makefile-update
base: 3.12
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
polib==1.1.1 | ||
googletrans==3.1.0a0 | ||
translate-toolkit==3.8.1 | ||
requests==2.31.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py | |
LANGUAGE := zh_TW | ||
LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES | ||
VENV := ~/.venvs/python-docs-i18n/ | ||
VENV_FOR_SCRIPT := ~/.venvs/python-docs-zhtw-script/ | ||
PYTHON := $(shell which python3) | ||
MODE := autobuild-dev-html | ||
BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD)) | ||
|
@@ -75,6 +76,49 @@ $(VENV)/bin/sphinx-lint: $(VENV)/bin/activate | |
$(VENV)/bin/blurb: $(VENV)/bin/activate | ||
. $(VENV)/bin/activate; python3 -m pip install blurb | ||
|
||
$(VENV_FOR_SCRIPT)/bin/activate: | ||
mkdir -p $(VENV_FOR_SCRIPT) | ||
$(PYTHON) -m venv $(VENV_FOR_SCRIPT) | ||
. $(VENV_FOR_SCRIPT)/bin/activate; python3 -m pip install -r .scripts/requirements.txt | ||
|
||
.PHONY: summarize_progress | ||
summarize_progress: $(VENV_FOR_SCRIPT)/bin/activate | ||
cd .scripts && \ | ||
. $(VENV_FOR_SCRIPT)/bin/activate; \ | ||
python3 summarize_progress/main.py | ||
|
||
.PHONY: google_translate | ||
google_translate: $(VENV_FOR_SCRIPT)/bin/activate | ||
|
||
@$(eval _target=$(filter-out $@, $(MAKECMDGOALS))) | ||
@if [ -z $(_target) ]; then \ | ||
echo "Please provide a file argument."; \ | ||
exit 1; \ | ||
fi | ||
|
||
|
||
@if [ "$(suffix $(_target))" != ".po" ]; then \ | ||
echo "Incorrect file extension. Only '.po' files are allowed."; \ | ||
exit 1; \ | ||
else \ | ||
_target=$(addsuffix ,po,$(_target)); \ | ||
fi | ||
|
||
@if [ ! -f "$(_target)" ]; then \ | ||
echo "File '$(filter-out $@, $(_target))' does not exist."; \ | ||
exit 1; \ | ||
fi | ||
|
||
@$(eval _tmp_po_file=tmp.po) | ||
@$(eval _file_path=$(addprefix ../, $(_target))) | ||
|
||
cd .scripts && \ | ||
. $(VENV_FOR_SCRIPT)/bin/activate; \ | ||
python3 google_translate/main.py $(_file_path) > $(_tmp_po_file) ; \ | ||
pomerge -t $(_file_path) -i $(_tmp_po_file) -o $(_file_path) ; \ | ||
# rm $(_tmp_po_file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 被我註解起來的這一行會有下列錯誤
完全不知道錯誤在哪裡@@,再麻煩好心人協助 |
||
exit 0 | ||
|
||
|
||
.PHONY: upgrade_venv | ||
upgrade_venv: $(VENV)/bin/activate ## Upgrade the venv that compiles the doc | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原本有 pyproject.toml,不延用 poetry 嗎?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我想說跟 makefile 完美結合的話,應該是改成 venv + pip 做管理;
但對,沿用的話會簡單很多(嗎?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
poetry 也有能力去建立與管理 virtual environment
python package tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
沿用不一定比較好寫,畢竟現在比較像是 follow makefile 現有的寫法,所以不太會有 survey 的成分。
只是我就沒有覺得哪個跟 makefile 會比較能夠
完美結合
。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原來根本的原因是因為我不熟QQ,我來研究一下怎麼做