- Notifications
You must be signed in to change notification settings - Fork395
Update makefile#26
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
9a68f23
update gitignore
gilgamezh1d7fa53
updated makefile
gilgamezh079e95a
contributing draft
gilgamezh444cc91
update travis command
gilgamezh2a74cca
Merge branch '3.7' into update_makefile
gilgamezh9ed64a6
update to use cpython as a git module
gilgamezhFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
48 changes: 48 additions & 0 deletions.gitignore
This file contains hidden or 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 |
---|---|---|
@@ -1,2 +1,50 @@ | ||
*.mo | ||
/_build/ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
# C extensions | ||
*.so | ||
# Distribution / packaging | ||
venv | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
.mypy_cache/ | ||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
# Ides | ||
.vscode/ | ||
.idea/ |
2 changes: 1 addition & 1 deletion.travis.yml
This file contains hidden or 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 |
---|---|---|
@@ -11,4 +11,4 @@ install: | ||
script: | ||
- powrap --check --quiet **/*.po | ||
- pospell -p dict -l es_ES **/*.po | ||
- makebuild |
38 changes: 38 additions & 0 deletionsCONTRIBUTING.rst
This file contains hidden or 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,38 @@ | ||
Guía para contribuir en la documentación utilizando Github | ||
=========================================================== | ||
Crea un fork y clona el repositorio | ||
----------------------------------- | ||
https://help.github.com/en/github/getting-started-with-github/fork-a-repo | ||
Luego de tener un fork clonalo en tu maquina | ||
.. code-block:: bash | ||
# Git clone your github fork using ssh (replace raulcd): | ||
# Clona el repositorio en tu maquina ejecutando | ||
git@github.com:<TU_USUARIO>/python-docs-es.git | ||
# Ingresá al nuevo directorio con el repo | ||
cd python-docs-es/ | ||
# Agregá el repositorio original como upstream. | ||
git remote add upstream https://github.com/raulcd/python-docs-es.git | ||
Crear un build local | ||
-------------------- | ||
Hay un script para automatizar estos pasos el mismo va a: | ||
- Crear un virtualenv dentro del directorio del repositorio e instalar en el mismo las librearias necesarias | ||
- Clonar el repositorio oficial de cpython para construir ("biuldear") la documentación. | ||
.. code-block:: bash | ||
make build | ||
# luego para poder ver la documentación ejecuta el siguiente comando y podes luego ir a http://localhost:8000 para ver la documentación | ||
# recién construida. | ||
make serve |
282 changes: 201 additions & 81 deletionsMakefile
This file contains hidden or 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 |
---|---|---|
@@ -1,84 +1,204 @@ | ||
# | ||
# Makefile for Spanish Python Documentation | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# | ||
# based on: https://github.com/python/python-docs-pt-br/blob/3.8/Makefile | ||
# | ||
# Configuration | ||
CPYTHON_PATH := cpython #Current commit for this upstream repo is setted by the submodule | ||
BRANCH := 3.7 | ||
LANGUAGE_TEAM := python-docs-es | ||
LANGUAGE := es | ||
# Internal variables | ||
VENV := $(shell realpath ./venv) | ||
PYTHON := $(shell which python3) | ||
WORKDIRS := $(VENV)/workdirs | ||
CPYTHON_WORKDIR := $(WORKDIRS)/cpython | ||
LOCALE_DIR := $(WORKDIRS)/locale | ||
JOBS := auto | ||
SPHINXERRORHANDLING := "-W" | ||
TRANSIFEX_PROJECT := python-newest | ||
POSPELL_TMP_DIR := .pospell | ||
.PHONY: help | ||
help: | ||
@echo "Please use 'make <target>' where <target> is one of:" | ||
@echo " build Build an local version in html, with warnings as errors" | ||
@echo " push Update translations and Transifex config in the repository" | ||
@echo " pull Download translations from Transifex; calls 'venv'" | ||
@echo " tx-config Recreate an up-to-date project .tx/config; calls 'pot'" | ||
@echo " pot Create/Update POT files from source files" | ||
@echo " serve Serve a built documentation on http://localhost:8000" | ||
@echo " spell Check spelling, storing output in $(POSPELL_TMP_DIR)" | ||
@echo "" | ||
# build: build the documentation using the translation files currently available | ||
# at the moment. For most up-to-date docs, run "tx-config" and "pull" | ||
# before this. If passing SPHINXERRORHANDLING='', warnings will not be | ||
# treated as errors, which is good to skip simple Sphinx syntax mistakes. | ||
.PHONY: build | ||
build: setup | ||
$(MAKE) -C $(CPYTHON_WORKDIR)/Doc/ \ | ||
VENVDIR=$(CPYTHON_WORKDIR)/Doc/venv \ | ||
PYTHON=$(PYTHON) \ | ||
SPHINXERRORHANDLING=$(SPHINXERRORHANDLING) \ | ||
SPHINXOPTS='-q --keep-going -j$(JOBS) \ | ||
-D locale_dirs=$(LOCALE_DIR) \ | ||
-D language=$(LANGUAGE) \ | ||
-D gettext_compact=0 \ | ||
-D latex_engine=xelatex \ | ||
-D latex_elements.inputenc= \ | ||
-D latex_elements.fontenc=' \ | ||
html; | ||
@echo "Success! Open file://$(CPYTHON_WORKDIR)/Doc/build/html/index.html, " \ | ||
"or run 'make serve' to see them in http://localhost:8000"; | ||
# push: push new translation files and Transifex config files to repository, | ||
# if any. Do nothing if there is no file changes. If GITHUB_TOKEN is set, | ||
# then assumes we are in GitHub Actions, requiring different push args | ||
.PHONY: push | ||
push: | ||
if ! git status -s | egrep '\.po|\.tx/config'; then \ | ||
echo "Nothing to commit"; \ | ||
exit 0; \ | ||
else \ | ||
git add *.po **/*.po .tx/config; \ | ||
git commit -m 'Update translations from Transifex'; \ | ||
if [ $(GITHUB_TOKEN) != "" ]; then \ | ||
header="$(echo -n token:"$(GITHUB_TOKEN)" | base64)"; \ | ||
git -c http.extraheader="AUTHORIZATION: basic $(header)" push; \ | ||
else \ | ||
git push; \ | ||
fi; \ | ||
fi | ||
# pull: Download translations files from Transifex, and apply line wrapping. | ||
# For downloading new translation files, first run "tx-config" target | ||
# to update the translation file mapping. | ||
.PHONY: pull | ||
pull: venv | ||
$(VENV)/bin/tx pull --force --language=$(LANGUAGE) --parallel | ||
$(VENV)/bin/powrap --quiet *.po **/*.po | ||
# tx-config: After running "pot", create a new Transifex config file by | ||
# reading pot files generated, then tweak this config file to | ||
# LANGUAGE. | ||
.PHONY: tx-config | ||
tx-config: pot | ||
cd $(CPYTHON_WORKDIR)/Doc/locales; \ | ||
rm -rf .tx; \ | ||
$(VENV)/bin/sphinx-intl create-txconfig; \ | ||
$(VENV)/bin/sphinx-intl update-txconfig-resources \ | ||
--transifex-project-name=$(TRANSIFEX_PROJECT) \ | ||
--locale-dir . \ | ||
--pot-dir pot; | ||
cd $(OLDPWD) | ||
mv $(CPYTHON_WORKDIR)/Doc/locales/.tx/config .tx/config | ||
sed -i .tx/config \ | ||
-e '/^source_file/d' \ | ||
-e 's|<lang>/LC_MESSAGES/||' \ | ||
-e "s|^file_filter|trans.$(LANGUAGE)|" | ||
# pot: After running "setup" target, run a cpython Makefile's target | ||
# to generate .pot files under $(CPYTHON_WORKDIR)/Doc/locales/pot | ||
.PHONY: pot | ||
pot: setup | ||
$(MAKE) -C $(CPYTHON_WORKDIR)/Doc/ \ | ||
VENVDIR=$(CPYTHON_WORKDIR)/Doc/venv \ | ||
PYTHON=$(PYTHON) \ | ||
ALLSPHINXOPTS='-E -b gettext \ | ||
-D gettext_compact=0 \ | ||
-d build/.doctrees . \ | ||
locales/pot' \ | ||
build | ||
# setup: After running "venv" target, prepare that virtual environment with | ||
# a local clone of cpython repository and the translation files. | ||
# If the directories exists, only update the cpython repository and | ||
# the translation files copy which could have new/updated files. | ||
.PHONY: setup | ||
setup: venv | ||
# Setup the main clone | ||
git submodule sync | ||
git submodule update --init --force $(CPYTHON_PATH) | ||
# Setup the current work directory | ||
if ! [ -d $(CPYTHON_WORKDIR) ]; then \ | ||
rm -fr $(WORKDIRS); \ | ||
mkdir -p $(WORKDIRS); \ | ||
git clone $(CPYTHON_PATH) $(CPYTHON_WORKDIR); \ | ||
$(MAKE) -C $(CPYTHON_WORKDIR)/Doc \ | ||
VENVDIR=$(CPYTHON_WORKDIR)/Doc/venv \ | ||
PYTHON=$(PYTHON) venv; \ | ||
fi | ||
# Setup translation files | ||
if ! [ -d $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/ ]; then \ | ||
mkdir -p $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/; \ | ||
fi; \ | ||
cp --parents *.po **/*.po $(LOCALE_DIR)/$(LANGUAGE)/LC_MESSAGES/ \ | ||
# venv: create a virtual environment which will be used by almost every | ||
# other target of this script | ||
.PHONY: venv | ||
venv: | ||
if [ ! -d $(VENV) ]; then \ | ||
$(PYTHON) -m venv --prompt $(LANGUAGE_TEAM) $(VENV); \ | ||
fi | ||
$(VENV)/bin/python -m pip install -q -r requirements.txt 2> $(VENV)/pip-install.log | ||
if grep -q 'pip install --upgrade pip' $(VENV)/pip-install.log; then \ | ||
$(VENV)/bin/pip install -q --upgrade pip; \ | ||
fi | ||
# serve: serve the documentation in a simple local web server, using cpython | ||
# Makefile's "serve" target. Run "build" before using this target. | ||
.PHONY: serve | ||
serve: | ||
$(MAKE) -C $(CPYTHON_WORKDIR)/Doc serve | ||
# list files for spellchecking | ||
SRCS := $(wildcard *.po **/*.po) | ||
DESTS = $(addprefix $(POSPELL_TMP_DIR)/out/,$(patsubst %.po,%.txt,$(SRCS))) | ||
# spell: run spell checking tool in all po files listed in SRCS variable, | ||
# storing the output in text files DESTS for proofreading. The | ||
# DESTS target run the spellchecking, while the typos.txt target | ||
# gather all reported issues in one file, sorted without redundancy | ||
.PHONY: spell | ||
spell: venv $(DESTS) $(POSPELL_TMP_DIR)/typos.txt | ||
$(POSPELL_TMP_DIR)/out/%.txt: %.po dict | ||
@echo "Checking $< ..." | ||
@mkdir -p $(@D) | ||
@$(VENV)/bin/pospell -l $(LANGUAGE) -p dict $< > $@ || true | ||
$(POSPELL_TMP_DIR)/typos.txt: | ||
@echo "Gathering all typos in $(POSPELL_TMP_DIR)/typos.txt ..." | ||
@cut -d: -f3- $(DESTS) | sort -u > $@ | ||
# clean: remove all .mo files and the venv directory that may exist and | ||
# could have been created by the actions in other targets of this script | ||
.PHONY: clean | ||
clean: | ||
rm -fr $(VENV) | ||
rm -rf $(POSPELL_TMP_DIR) | ||
find -name '*.mo' -delete |
6 changes: 5 additions & 1 deletionrequirements.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
Sphinx==2.2.0 | ||
blurb | ||
pospell | ||
powrap | ||
python-docs-theme | ||
setuptools | ||
sphinx-intl | ||
transifex-client |
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.