From 038f6ffae2002156e8af8f5e8435a88a43d4d6da Mon Sep 17 00:00:00 2001 From: egeakman Date: Fri, 10 Feb 2023 02:57:51 +0300 Subject: [PATCH 01/44] Remove line-length from checks, new pre-commit checks instead --- .github/workflows/build.yml | 16 +++---- .github/workflows/gh-pages.yml | 15 +++--- .github/workflows/update_doc.yml | 76 +++++++++++++++---------------- .github/workflows/wrap_branch.yml | 11 ++--- .pre-commit-config.yaml | 38 ++++++++++++++-- 5 files changed, 90 insertions(+), 66 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91fb2468c..23ce64b06 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,24 +1,22 @@ name: Tests - on: workflow_dispatch: push: branches: - - '**' + - "**" pull_request: branches: - - '**' + - "**" jobs: checks: + # Using matrix-tool strategy in case we want to add more tools in the future strategy: matrix: tool: - name: sphinx-lint package: sphinx-lint - command: 'sphinx-lint --enable default-role --ignore .git' - - name: Line length - command: 'awk ''{if (length($0) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}'' $CHANGED_PO_FILES' + command: "sphinx-lint --enable default-role --ignore .git" name: ${{ matrix.tool.name }} (${{ matrix.tool.package }}) runs-on: ubuntu-latest @@ -30,7 +28,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: "3.11" - name: Install ${{ matrix.tool.package }} run: | if [ -n "${{ matrix.tool.apt_dependencies }}" ]; then @@ -57,14 +55,14 @@ jobs: fi sphinx: - name: 'Generate docs (sphinx)' + name: "Generate docs (sphinx)" runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: "3.11" - name: Prepare environment run: | pwd diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index c12e0ff23..8d02dd5c2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,9 +1,8 @@ name: Build and Deploy to GitHub Pages - on: push: branches: - - '3.11' + - "3.11" jobs: sphinx-lint: @@ -15,14 +14,14 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: "3.11" - name: Install sphinx-lint run: python -m pip install --upgrade sphinx-lint - name: Run sphinx-lint - run: 'sphinx-lint --enable default-role --ignore .git' + run: "sphinx-lint --enable default-role --ignore .git" deploy: - name: 'Generate docs and deploy to GitHub Pages' + name: "Generate docs and deploy to GitHub Pages" runs-on: ubuntu-latest needs: sphinx-lint timeout-minutes: 30 @@ -30,7 +29,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: "3.11" - name: Prepare environment run: | git clone https://github.com/python/cpython.git venv/cpython/ @@ -45,5 +44,5 @@ jobs: publish_dir: ./venv/cpython/Doc/build/html publish_branch: gh-pages allow_empty_commit: true - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' \ No newline at end of file + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" diff --git a/.github/workflows/update_doc.yml b/.github/workflows/update_doc.yml index f9a0bfb63..9387c8d87 100644 --- a/.github/workflows/update_doc.yml +++ b/.github/workflows/update_doc.yml @@ -2,47 +2,47 @@ name: Update Doc on: workflow_dispatch: schedule: - - cron: '0 0 1 * *' + - cron: "0 0 1 * *" jobs: create_pr: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Clone CPython Repo - run: git clone https://github.com/python/cpython venv/cpython - - - name: Set Up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Install dependencies - run: pip install -r requirements.txt && sudo apt install gettext -y - - - name: Run merge.py - run: python merge.py ${GITHUB_REF##*/} - - - name: Commit changes - run: | - git config --local user.email "python.docs.tr@gmail.com" - git config --local user.name "python-docs-turkish" - git commit -m "Get changes from CPython Doc for ${{ github.ref_name }}" - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4.2.3 - with: - token: ${{ secrets.BOT_PAT }} - commit-message: Get changes from CPython Doc for ${{ github.ref_name }} - author: python-docs-turkish - committer: python-docs-turkish - branch: translation-update-${{ github.ref_name }} - delete-branch: true - title: Translation Update ${{ github.ref_name }} - body: There are some changes, don't forget to translate them! - labels: update - reviewers: | - egeakman - ardasak + - uses: actions/checkout@v3 + + - name: Clone CPython Repo + run: git clone https://github.com/python/cpython venv/cpython + + - name: Set Up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install dependencies + run: pip install -r requirements.txt && sudo apt install gettext -y + + - name: Run merge.py + run: python merge.py ${GITHUB_REF##*/} + + - name: Commit changes + run: | + git config --local user.email "python.docs.tr@gmail.com" + git config --local user.name "python-docs-turkish" + git commit -m "Get changes from CPython Doc for ${{ github.ref_name }}" + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4.2.3 + with: + token: ${{ secrets.BOT_PAT }} + commit-message: Get changes from CPython Doc for ${{ github.ref_name }} + author: python-docs-turkish + committer: python-docs-turkish + branch: translation-update-${{ github.ref_name }} + delete-branch: true + title: Translation Update ${{ github.ref_name }} + body: There are some changes, don't forget to translate them! + labels: update + reviewers: | + egeakman + ardasak diff --git a/.github/workflows/wrap_branch.yml b/.github/workflows/wrap_branch.yml index a7c99c7e5..6c59f9b46 100644 --- a/.github/workflows/wrap_branch.yml +++ b/.github/workflows/wrap_branch.yml @@ -1,11 +1,10 @@ name: "Wrap All" - on: workflow_dispatch: schedule: - - cron: '0 0 15 * *' + - cron: "0 0 15 * *" -jobs: +jobs: wrap: runs-on: ubuntu-latest steps: @@ -34,13 +33,13 @@ jobs: uses: peter-evans/create-pull-request@v4.2.3 with: token: ${{ secrets.BOT_PAT }} - commit-message: 'Wrap all files on: ${{ github.ref_name }}' + commit-message: "Wrap all files on: ${{ github.ref_name }}" branch: ${{ github.ref_name }}-wrapped delete-branch: true committer: python-docs-turkish author: python-docs-turkish - title: 'Wrap branch: ${{ github.ref_name }}' - body: 'Wrapped all files on branch: ${{ github.ref_name }}.' + title: "Wrap branch: ${{ github.ref_name }}" + body: "Wrapped all files on branch: ${{ github.ref_name }}." labels: wrap reviewers: | egeakman diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 74928844a..617092081 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,37 @@ repos: -- repo: local + - repo: local hooks: - - id: lint - name: Run sphinx linting + - id: lint + name: Run sphinx-lint on .po files entry: sphinx-lint language: python - additional_dependencies: ['sphinx-lint==0.6.7'] - files: \.po$ \ No newline at end of file + additional_dependencies: ["sphinx-lint"] + files: \.po$ + + - id: wrap + name: Run powrap on .po files + entry: powrap + language: python + additional_dependencies: ["powrap"] + files: \.po$ + + - repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + name: Run black on Python files + args: ["--line-length=140", "--target-version=py311"] + files: \.py$ + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.7.1 + hooks: + - id: prettier + name: Run prettier on .yml and .yaml files + types: [yaml] From a1cbac2348fbc0c45cc09f69241ed6b4217073f1 Mon Sep 17 00:00:00 2001 From: egeakman Date: Fri, 10 Feb 2023 05:07:06 +0300 Subject: [PATCH 02/44] Cross platform gettext installation, some wiki --- .pre-commit-config.yaml | 6 +++++ .pre-commit-scripts/install_gettext.py | 29 ++++++++++++++++++++++++ README.md | 3 ++- wiki/gettext.md | 31 ++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-scripts/install_gettext.py create mode 100644 wiki/gettext.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 617092081..a4518fb6b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,12 @@ repos: - repo: local hooks: + - id: gettext + name: Install gettext + entry: python .pre-commit-scripts/install_gettext.py + language: system + verbose: true + - id: lint name: Run sphinx-lint on .po files entry: sphinx-lint diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py new file mode 100644 index 000000000..505ef0ce4 --- /dev/null +++ b/.pre-commit-scripts/install_gettext.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +import sys +import shutil +import subprocess + + +def main(): + if sys.platform == "win32": + try: + cmd = "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex;scoop install gettext" + return subprocess.run(cmd, shell=True, check=True, executable=shutil.which("powershell")) + exit(0) + except Exception: + print( + NotImplementedError( + "WARNING: Use scoop to install gettext on Windows!!! Otherwise powrap will fail.\nRefer to \ +https://github.com/python/python-docs-tr/blob/HEAD/wiki/gettext.md for instructions." + ) + ) + exit(0) + elif sys.platform in ["linux", "linux2"]: + cmd = "sudo apt --upgrade && sudo apt install -y gettext" + else: # macOS + cmd = "brew update && brew install gettext" + return subprocess.run(cmd, shell=True, check=True) + + +if __name__ == "__main__": + exit(main()) diff --git a/README.md b/README.md index b2ceef71d..e5bbdfe0d 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,14 @@ Bu proje gönüllü çevirmenler ve python-docs-tr ekibi iş birliğinde sürdü - Yüklü bir [Git](https://git-scm.com/) istemcisi - ``.po`` dosyalarını düzenlemek için [poedit](https://poedit.net/) gibi bir program - Yüklü bir Python ve ``pip`` versiyonu (en son stabil olan versiyon önerilir) +- ``gettext`` araçları ([yükleme adımları](https://github.com/python/python-docs-tr/blob/HEAD/wiki/gettext.md)) ### Adımlar #### Rezervasyon Çeviri yapmak istediğiniz bir dosyaya rezervasyon oluşturmak için şu adımları izleyin: - + 1. `Issues > New Issue > Get started` düğmelerini takip ederek rezervasyon formunu açın. 2. foo/bar.po taslağını, çalışmak istediğiniz dosyanın yolu ile değiştirin. - Örnegin, "library/functions.po üzerinde çalışmak istiyorum". diff --git a/wiki/gettext.md b/wiki/gettext.md new file mode 100644 index 000000000..727b72dfe --- /dev/null +++ b/wiki/gettext.md @@ -0,0 +1,31 @@ +# Gettext Araçları + +Bu belgede, ``gettext`` araçlarının nasıl kurulacağı açıklanmaktadır. + +## Windows + +Scoop, GNU araçlarını Windows'ta kullanmaya yarayan bir paket yöneticisidir. Scoop'u kullanarak ``gettext`` araçlarını yükleyebilirsiniz. Aşağıdaki komutları PowerShell'de çalıştırmanız gerekmektedir: + + ```powershell + Set-ExecutionPolicy RemoteSigned -Scope CurrentUser + irm get.scoop.sh | iex + scoop install gettext + ``` + +## Linux + +``apt`` paket yöneticisi kullanıyorsanız, gettext araçlarını şu komutla yükleyebilirsiniz: + + ```bash + sudo apt update + sudo apt install gettext + ``` + +## macOS + +``brew`` paket yöneticisi kullanıyorsanız, gettext araçlarını şu komutla yükleyebilirsiniz: + + ```zsh + brew update + brew install gettext + ``` From f0136d715ad06f146e9dd41f072dc3e91c054915 Mon Sep 17 00:00:00 2001 From: egeakman Date: Fri, 10 Feb 2023 05:10:40 +0300 Subject: [PATCH 03/44] revert pre-commit ci's commit From f44091fb4bf0109ff4a280afd262cc9d45a44884 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 01:28:35 +0300 Subject: [PATCH 04/44] try pre-commit on multiple platforms --- .github/workflows/pre-commit-ci.yml | 26 ++++++++++++++++++++++++++ .pre-commit-scripts/install_gettext.py | 1 - 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pre-commit-ci.yml diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml new file mode 100644 index 000000000..928cc59f3 --- /dev/null +++ b/.github/workflows/pre-commit-ci.yml @@ -0,0 +1,26 @@ +name: pre-commit-ci +on: + workflow_dispatch: + push: + branches: + - "**" + pull_request: + branches: + - "**" + +jobs: + pre-commit: + name: "Pre-commit checks" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Run pre-commit + uses: pre-commit-ci/lite-action@v1.0.1 + if: always() diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 505ef0ce4..8c38af47e 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -9,7 +9,6 @@ def main(): try: cmd = "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex;scoop install gettext" return subprocess.run(cmd, shell=True, check=True, executable=shutil.which("powershell")) - exit(0) except Exception: print( NotImplementedError( From e64d07a4ab712ff4df2206da1ee712bb742be86d Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 01:34:10 +0300 Subject: [PATCH 05/44] try pre-commit on multiple platforms --- .pre-commit-scripts/install_gettext.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 8c38af47e..9cf101eb9 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -8,6 +8,7 @@ def main(): if sys.platform == "win32": try: cmd = "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex;scoop install gettext" + print("test") return subprocess.run(cmd, shell=True, check=True, executable=shutil.which("powershell")) except Exception: print( @@ -18,8 +19,10 @@ def main(): ) exit(0) elif sys.platform in ["linux", "linux2"]: + print("test2") cmd = "sudo apt --upgrade && sudo apt install -y gettext" else: # macOS + print("test3") cmd = "brew update && brew install gettext" return subprocess.run(cmd, shell=True, check=True) From 1eafaafebb7f754d88ea7391ca0f8cc9ac9c9977 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 01:37:32 +0300 Subject: [PATCH 06/44] try pre-commit on multiple platforms --- .github/workflows/pre-commit-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 928cc59f3..0913751b1 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -22,5 +22,8 @@ jobs: python-version: "3.11" - name: Run pre-commit + uses: pre-commit/action@v3.0.0 + + - name: Run pre-commit-ci uses: pre-commit-ci/lite-action@v1.0.1 if: always() From 80c4cc7bae0cb57d808ade5996e77c8d52ad5220 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 01:55:00 +0300 Subject: [PATCH 07/44] try pre-commit on multiple platforms --- .pre-commit-scripts/install_gettext.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 9cf101eb9..187329b01 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import shlex import shutil import subprocess @@ -7,8 +8,9 @@ def main(): if sys.platform == "win32": try: - cmd = "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex;scoop install gettext" - print("test") + cmd = shlex.split( + "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex;scoop install gettext", posix=False + ) return subprocess.run(cmd, shell=True, check=True, executable=shutil.which("powershell")) except Exception: print( @@ -19,11 +21,9 @@ def main(): ) exit(0) elif sys.platform in ["linux", "linux2"]: - print("test2") - cmd = "sudo apt --upgrade && sudo apt install -y gettext" + cmd = shlex.split("sudo apt --upgrade && sudo apt install -y gettext", posix=True) else: # macOS - print("test3") - cmd = "brew update && brew install gettext" + cmd = shlex.split("brew update && brew install gettext", posix=True) return subprocess.run(cmd, shell=True, check=True) From 49e0c504f88e811f5358701bf8e44282487e68d1 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 02:10:06 +0300 Subject: [PATCH 08/44] try pre-commit on multiple platforms --- .pre-commit-scripts/install_gettext.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 187329b01..9e780ea46 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -21,10 +21,10 @@ def main(): ) exit(0) elif sys.platform in ["linux", "linux2"]: - cmd = shlex.split("sudo apt --upgrade && sudo apt install -y gettext", posix=True) + cmd = shlex.split("sudo apt --update && sudo apt install -y gettext", posix=True) else: # macOS cmd = shlex.split("brew update && brew install gettext", posix=True) - return subprocess.run(cmd, shell=True, check=True) + return subprocess.run(cmd, shell=False, check=True) if __name__ == "__main__": From b20ee6985b4b3d069189eb6224b70475c855bfbb Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 02:11:56 +0300 Subject: [PATCH 09/44] =?UTF-8?q?uyku=20=C3=B6nemli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-scripts/install_gettext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 9e780ea46..dacec4695 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -21,7 +21,7 @@ def main(): ) exit(0) elif sys.platform in ["linux", "linux2"]: - cmd = shlex.split("sudo apt --update && sudo apt install -y gettext", posix=True) + cmd = shlex.split("sudo apt update && sudo apt install -y gettext", posix=True) else: # macOS cmd = shlex.split("brew update && brew install gettext", posix=True) return subprocess.run(cmd, shell=False, check=True) From ed3390be8d3225b9c667faeb2aadf8c8b134e667 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 02:18:33 +0300 Subject: [PATCH 10/44] try pre-commit on multiple platforms --- .pre-commit-scripts/install_gettext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index dacec4695..ef3284af8 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -24,7 +24,7 @@ def main(): cmd = shlex.split("sudo apt update && sudo apt install -y gettext", posix=True) else: # macOS cmd = shlex.split("brew update && brew install gettext", posix=True) - return subprocess.run(cmd, shell=False, check=True) + return subprocess.run(cmd, shell=True, check=True) if __name__ == "__main__": From 4133dfc4b652d012003311e6de0f393696de88d5 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 02:22:32 +0300 Subject: [PATCH 11/44] try pre-commit on multiple platforms --- .pre-commit-scripts/install_gettext.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index ef3284af8..53ab145a0 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -21,9 +21,9 @@ def main(): ) exit(0) elif sys.platform in ["linux", "linux2"]: - cmd = shlex.split("sudo apt update && sudo apt install -y gettext", posix=True) + cmd = "sudo apt update && sudo apt install -y gettext" else: # macOS - cmd = shlex.split("brew update && brew install gettext", posix=True) + cmd = "brew update && brew install gettext" return subprocess.run(cmd, shell=True, check=True) From 744a4a2d67ff0e072e2eda3bdb86441c0bb458a0 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 02:33:48 +0300 Subject: [PATCH 12/44] try pre-commit on multiple platforms --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4518fb6b..ff03aa32e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: wrap name: Run powrap on .po files - entry: powrap + entry: powrap -m language: python additional_dependencies: ["powrap"] files: \.po$ From cd9b83f2aa6e9d90c588444721544e2d2847104e Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 02:47:31 +0300 Subject: [PATCH 13/44] try pre-commit on multiple platforms --- .pre-commit-scripts/install_gettext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 53ab145a0..a5f39df08 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -28,4 +28,4 @@ def main(): if __name__ == "__main__": - exit(main()) + exit(main().returncode) From cd3c3985f5fbcdfce53066c680d96b1b401c38d3 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 03:20:40 +0300 Subject: [PATCH 14/44] let's try this --- .pre-commit-scripts/install_gettext.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index a5f39df08..02450b9bc 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -7,25 +7,19 @@ def main(): if sys.platform == "win32": - try: - cmd = shlex.split( - "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex;scoop install gettext", posix=False - ) - return subprocess.run(cmd, shell=True, check=True, executable=shutil.which("powershell")) - except Exception: - print( - NotImplementedError( - "WARNING: Use scoop to install gettext on Windows!!! Otherwise powrap will fail.\nRefer to \ -https://github.com/python/python-docs-tr/blob/HEAD/wiki/gettext.md for instructions." - ) - ) - exit(0) + executable = shutil.which("powershell.exe") + cmd = shlex.split("Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex", posix=False) + p_scoop = subprocess.run(cmd, shell=True, executable=executable) + p_install = subprocess.run(shlex.split("scoop install gettext", posix=False), shell=True, executable=executable) + + return p_scoop.returncode or p_install.returncode + elif sys.platform in ["linux", "linux2"]: cmd = "sudo apt update && sudo apt install -y gettext" else: # macOS cmd = "brew update && brew install gettext" - return subprocess.run(cmd, shell=True, check=True) + return subprocess.run(cmd, shell=True).returncode if __name__ == "__main__": - exit(main().returncode) + exit(main()) From d63633c72ae9a5ddaa94d0fe9ee20f43eb193322 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 03:24:53 +0300 Subject: [PATCH 15/44] try pre-commit on multiple platforms --- .pre-commit-config.yaml | 2 +- .pre-commit-scripts/install_gettext.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff03aa32e..a4518fb6b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: wrap name: Run powrap on .po files - entry: powrap -m + entry: powrap language: python additional_dependencies: ["powrap"] files: \.po$ diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 02450b9bc..5394e6b04 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -15,9 +15,9 @@ def main(): return p_scoop.returncode or p_install.returncode elif sys.platform in ["linux", "linux2"]: - cmd = "sudo apt update && sudo apt install -y gettext" + cmd = "sudo apt update; sudo apt install -y gettext" else: # macOS - cmd = "brew update && brew install gettext" + cmd = "brew update; brew install gettext" return subprocess.run(cmd, shell=True).returncode From 1aaec6b66e23884198a3e92c41e9d4878afc1d18 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 03:31:56 +0300 Subject: [PATCH 16/44] update --- .github/workflows/pre-commit-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 0913751b1..24c139bc5 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -11,10 +11,7 @@ on: jobs: pre-commit: name: "Pre-commit checks" - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: windows-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 2e5ed72fa949e5876c0d77711eaa62bf56d4910d Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 03:35:37 +0300 Subject: [PATCH 17/44] macos --- .github/workflows/pre-commit-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 24c139bc5..0ae6cb5ab 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -11,7 +11,7 @@ on: jobs: pre-commit: name: "Pre-commit checks" - runs-on: windows-latest + runs-on: macos-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From e92562e152ba32fc7224fd42a5655fb2d7ef32ff Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 03:42:15 +0300 Subject: [PATCH 18/44] trigger --- .pre-commit-scripts/install_gettext.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 5394e6b04..242585147 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -22,4 +22,5 @@ def main(): if __name__ == "__main__": + print(".") exit(main()) From 800879dd33b983abb310e283522fd10c68de9eda Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 04:15:26 +0300 Subject: [PATCH 19/44] force From 0c2409dbeff75572e2f3218ca6273ea44fc6461f Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 04:22:09 +0300 Subject: [PATCH 20/44] switch to ubuntu --- .github/workflows/pre-commit-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 0ae6cb5ab..459d916d4 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -11,7 +11,7 @@ on: jobs: pre-commit: name: "Pre-commit checks" - runs-on: macos-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From b4bbd5b0d7ab71061465483ec052ca3c7255e034 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 04:40:57 +0300 Subject: [PATCH 21/44] this seems better --- .github/workflows/pre-commit-ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 459d916d4..d9ab778ef 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -15,11 +15,22 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 + id: setup_python with: python-version: "3.11" + cache: pip + + - name: Install pre-commit + run: pip install --upgrade pre-commit + + - name: Cache pre-commit tools + uses: actions/cache@v3 + with: + key: pre-commit-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('.pre-commit-config.yaml') }} + path: ~/.cache/pre-commit - name: Run pre-commit - uses: pre-commit/action@v3.0.0 + run: pre-commit run - name: Run pre-commit-ci uses: pre-commit-ci/lite-action@v1.0.1 From 6b4f7527dbd67c7c054bd61c227d0e773572455b Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 04:43:21 +0300 Subject: [PATCH 22/44] update --- .github/workflows/pre-commit-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index d9ab778ef..9cb934aac 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -30,7 +30,7 @@ jobs: path: ~/.cache/pre-commit - name: Run pre-commit - run: pre-commit run + run: pre-commit run --all-files - name: Run pre-commit-ci uses: pre-commit-ci/lite-action@v1.0.1 From 08b99e092f1266d44fa783ab961871b22c0af3d5 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 04:45:24 +0300 Subject: [PATCH 23/44] update --- .github/workflows/pre-commit-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 9cb934aac..1522d98e1 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -30,7 +30,7 @@ jobs: path: ~/.cache/pre-commit - name: Run pre-commit - run: pre-commit run --all-files + run: pre-commit run --all-files --show-diff-on-failure - name: Run pre-commit-ci uses: pre-commit-ci/lite-action@v1.0.1 From 989bebde3cb286893add4118f3cd7eb7858ab399 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 05:39:00 +0300 Subject: [PATCH 24/44] How did I miss that --- .github/workflows/pre-commit-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 1522d98e1..399a754e7 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -32,6 +32,6 @@ jobs: - name: Run pre-commit run: pre-commit run --all-files --show-diff-on-failure - - name: Run pre-commit-ci + - name: Run pre-commit-ci-lite uses: pre-commit-ci/lite-action@v1.0.1 if: always() From ba0ea411f8fefaf8ef9b1867fcff5d3572133e85 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sat, 11 Feb 2023 02:41:38 +0000 Subject: [PATCH 25/44] [pre-commit.ci lite] apply automatic fixes --- .gitattributes | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 279e21a17..788f0b385 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ *.po diff=podiff -*.pot diff=podiff \ No newline at end of file +*.pot diff=podiff diff --git a/Makefile b/Makefile index 61162d2ab..294a8c680 100644 --- a/Makefile +++ b/Makefile @@ -169,4 +169,4 @@ clean: rm -rf $(POSPELL_TMP_DIR) locales/$(LANGUAGE)/LC_MESSAGES/ find -name '*.mo' -delete @echo "Cleaning build directory" - $(MAKE) -C venv/cpython/Doc/ clean \ No newline at end of file + $(MAKE) -C venv/cpython/Doc/ clean From 5542660b3d5c8be966abf5e248fda4563834f4f2 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 09:45:43 +0300 Subject: [PATCH 26/44] style-print notice --- .pre-commit-config.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4518fb6b..a6f679c63 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,14 @@ repos: + - repo: local + hooks: + - id: style-print + name: style-print + entry: "style-print 'This is highly experimental, please report any issues: https://github.com/python/python-docs-tr/issues' 'rUBI{y}'" + language: python + additional_dependencies: ["style-print"] + pass_filenames: false + verbose: true + - repo: local hooks: - id: gettext From 0361365633d2b4d763377f66959e7913f8e484a6 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 09:48:37 +0300 Subject: [PATCH 27/44] test on different OSs --- .github/workflows/pre-commit-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 399a754e7..f3d50ce28 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -11,7 +11,10 @@ on: jobs: pre-commit: name: "Pre-commit checks" - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 0e72cd6a10c30a76e7bbcd4d3eb279a5b39d2934 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sat, 11 Feb 2023 10:03:36 +0300 Subject: [PATCH 28/44] Everything looks fine, let's test it. --- .github/workflows/gh-pages.yml | 8 ++++---- .github/workflows/pre-commit-ci.yml | 5 +---- .readthedocs.yaml | 2 ++ about.po | 3 +-- scripts/progress.py | 2 +- tutorial/appendix.po | 3 +-- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 8d02dd5c2..dad845719 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -9,15 +9,15 @@ jobs: name: Check docs (sphinx-lint) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v4 with: python-version: "3.11" - - name: Install sphinx-lint + - name: Install sphinx-lint run: python -m pip install --upgrade sphinx-lint - - name: Run sphinx-lint + - name: Run sphinx-lint run: "sphinx-lint --enable default-role --ignore .git" deploy: diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index f3d50ce28..399a754e7 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -11,10 +11,7 @@ on: jobs: pre-commit: name: "Pre-commit checks" - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 56b476a8f..d7cad7fad 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -15,3 +15,5 @@ build: - make - mkdir -p _readthedocs/html/ - cp -r venv/cpython/Doc/build/html/* _readthedocs/html/ + + diff --git a/about.po b/about.po index 953cd8db1..82d075f0b 100644 --- a/about.po +++ b/about.po @@ -39,8 +39,7 @@ msgid "" msgstr "" "Dokümantasyonun ve araç zincirinin geliştirilmesi, tıpkı Python'un kendisi " "gibi tamamen gönüllü bir çabadır. Katkıda bulunmak istiyorsanız, nasıl " -"yapacağınıza ilişkin bilgi için lütfen :ref:`reporting-bugs` sayfasına göz " -"atın. Yeni gönüllülere her zaman açığız!" +"yapacağınıza ilişkin bilgi için lütfen :ref:`reporting-bugs` sayfasına göz atın. Yeni gönüllülere her zaman açığız!" #: about.rst:20 msgid "Many thanks go to:" diff --git a/scripts/progress.py b/scripts/progress.py index 966aa877b..1be1cbd6c 100644 --- a/scripts/progress.py +++ b/scripts/progress.py @@ -81,7 +81,7 @@ def main(): print(f"Weighted progress: {weighted_progress}%\n") if args.completed: - print("Completed files:") + print('Completed files:') completed_files = [file for file in files if file[1] > min(args.threshold, 100)] for file, percentage in completed_files: print(f"{file}: {percentage}%") diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 00cb92d96..64af3110c 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -49,8 +49,7 @@ msgstr "" "değildir.) Bazı hatalar koşulsuz olarak ölümcüldür ve sıfır olmayan bir " "çıkış koduyla çıkışa neden olur; bu, iç tutarsızlıklar ve belleğin " "tükendiğine ilişkin bazı durumlar için geçerlidir. Tüm hata iletileri " -"standart hata akışına yazılır; yürütülen komutlardan normal çıktı standart " -"çıktıya yazılır." +"standart hata akışına yazılır; yürütülen komutlardan normal çıktı standart çıktıya yazılır." #: tutorial/appendix.rst:28 msgid "" From 6cb21216d7d355eeece4693cd26071e3e25c2dec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sat, 11 Feb 2023 07:04:52 +0000 Subject: [PATCH 29/44] [pre-commit.ci lite] apply automatic fixes --- .github/workflows/gh-pages.yml | 8 ++++---- .readthedocs.yaml | 2 -- about.po | 3 ++- scripts/progress.py | 2 +- tutorial/appendix.po | 3 ++- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index dad845719..8d02dd5c2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -9,15 +9,15 @@ jobs: name: Check docs (sphinx-lint) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v4 with: python-version: "3.11" - - name: Install sphinx-lint + - name: Install sphinx-lint run: python -m pip install --upgrade sphinx-lint - - name: Run sphinx-lint + - name: Run sphinx-lint run: "sphinx-lint --enable default-role --ignore .git" deploy: diff --git a/.readthedocs.yaml b/.readthedocs.yaml index d7cad7fad..56b476a8f 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -15,5 +15,3 @@ build: - make - mkdir -p _readthedocs/html/ - cp -r venv/cpython/Doc/build/html/* _readthedocs/html/ - - diff --git a/about.po b/about.po index 82d075f0b..953cd8db1 100644 --- a/about.po +++ b/about.po @@ -39,7 +39,8 @@ msgid "" msgstr "" "Dokümantasyonun ve araç zincirinin geliştirilmesi, tıpkı Python'un kendisi " "gibi tamamen gönüllü bir çabadır. Katkıda bulunmak istiyorsanız, nasıl " -"yapacağınıza ilişkin bilgi için lütfen :ref:`reporting-bugs` sayfasına göz atın. Yeni gönüllülere her zaman açığız!" +"yapacağınıza ilişkin bilgi için lütfen :ref:`reporting-bugs` sayfasına göz " +"atın. Yeni gönüllülere her zaman açığız!" #: about.rst:20 msgid "Many thanks go to:" diff --git a/scripts/progress.py b/scripts/progress.py index 1be1cbd6c..966aa877b 100644 --- a/scripts/progress.py +++ b/scripts/progress.py @@ -81,7 +81,7 @@ def main(): print(f"Weighted progress: {weighted_progress}%\n") if args.completed: - print('Completed files:') + print("Completed files:") completed_files = [file for file in files if file[1] > min(args.threshold, 100)] for file, percentage in completed_files: print(f"{file}: {percentage}%") diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 64af3110c..00cb92d96 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -49,7 +49,8 @@ msgstr "" "değildir.) Bazı hatalar koşulsuz olarak ölümcüldür ve sıfır olmayan bir " "çıkış koduyla çıkışa neden olur; bu, iç tutarsızlıklar ve belleğin " "tükendiğine ilişkin bazı durumlar için geçerlidir. Tüm hata iletileri " -"standart hata akışına yazılır; yürütülen komutlardan normal çıktı standart çıktıya yazılır." +"standart hata akışına yazılır; yürütülen komutlardan normal çıktı standart " +"çıktıya yazılır." #: tutorial/appendix.rst:28 msgid "" From b551bbc44dc25f7845f1df4e17792c4ef9582716 Mon Sep 17 00:00:00 2001 From: Ege Akman Date: Sat, 11 Feb 2023 10:09:32 +0300 Subject: [PATCH 30/44] Update gettext.md --- wiki/gettext.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/wiki/gettext.md b/wiki/gettext.md index 727b72dfe..9acafde4a 100644 --- a/wiki/gettext.md +++ b/wiki/gettext.md @@ -6,26 +6,26 @@ Bu belgede, ``gettext`` araçlarının nasıl kurulacağı açıklanmaktadır. Scoop, GNU araçlarını Windows'ta kullanmaya yarayan bir paket yöneticisidir. Scoop'u kullanarak ``gettext`` araçlarını yükleyebilirsiniz. Aşağıdaki komutları PowerShell'de çalıştırmanız gerekmektedir: - ```powershell - Set-ExecutionPolicy RemoteSigned -Scope CurrentUser - irm get.scoop.sh | iex - scoop install gettext - ``` +```powershell +Set-ExecutionPolicy RemoteSigned -Scope CurrentUser +irm get.scoop.sh | iex +scoop install gettext +``` ## Linux ``apt`` paket yöneticisi kullanıyorsanız, gettext araçlarını şu komutla yükleyebilirsiniz: - ```bash - sudo apt update - sudo apt install gettext - ``` +```bash +sudo apt update +sudo apt install gettext +``` ## macOS ``brew`` paket yöneticisi kullanıyorsanız, gettext araçlarını şu komutla yükleyebilirsiniz: - ```zsh - brew update - brew install gettext - ``` +```zsh +brew update +brew install gettext +``` From 2b2d37e0e8a94519b4f833229bdd4b2a4081edc0 Mon Sep 17 00:00:00 2001 From: Ege Akman Date: Sat, 11 Feb 2023 10:12:47 +0300 Subject: [PATCH 31/44] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5bbdfe0d..9b4b3791e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Bu proje gönüllü çevirmenler ve python-docs-tr ekibi iş birliğinde sürdü - Yüklü bir [Git](https://git-scm.com/) istemcisi - ``.po`` dosyalarını düzenlemek için [poedit](https://poedit.net/) gibi bir program - Yüklü bir Python ve ``pip`` versiyonu (en son stabil olan versiyon önerilir) -- ``gettext`` araçları ([yükleme adımları](https://github.com/python/python-docs-tr/blob/HEAD/wiki/gettext.md)) +- ``gettext`` araçları ([yükleme adımları](wiki/gettext.md)) ### Adımlar From 69f875623434888f827152d066bd30ce89d6a7d3 Mon Sep 17 00:00:00 2001 From: egeakman Date: Fri, 17 Feb 2023 17:04:31 +0300 Subject: [PATCH 32/44] update --- .pre-commit-config.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a6f679c63..187c05496 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,10 @@ repos: additional_dependencies: ["sphinx-lint"] files: \.po$ - - id: wrap - name: Run powrap on .po files - entry: powrap - language: python - additional_dependencies: ["powrap"] - files: \.po$ + - repo: https://github.com/AFPy/powrap + rev: v1.0.0 + hooks: + - id: powrap - repo: https://github.com/psf/black rev: 23.1.0 From 31c6bebad48954c32180e641f849ac5a4f6b6180 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 17 Feb 2023 14:06:01 +0000 Subject: [PATCH 33/44] [pre-commit.ci lite] apply automatic fixes --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 187c05496..5c93572c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - repo: https://github.com/AFPy/powrap rev: v1.0.0 hooks: - - id: powrap + - id: powrap - repo: https://github.com/psf/black rev: 23.1.0 From 50dde37edc4d5ad17fbe7f229ae1511f8cff202c Mon Sep 17 00:00:00 2001 From: egeakman Date: Sun, 19 Feb 2023 18:11:12 +0300 Subject: [PATCH 34/44] Let's see how this'll do --- .github/workflows/pre-commit-ci.yml | 2 +- .pre-commit-scripts/install_gettext.py | 33 +++++++++++++++++++++----- requirements.txt | 1 + 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 399a754e7..92afc305a 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -11,7 +11,7 @@ on: jobs: pre-commit: name: "Pre-commit checks" - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 242585147..5ea32c6de 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -1,18 +1,39 @@ #!/usr/bin/env python3 +import os import sys import shlex import shutil +import requests import subprocess +from zipfile import ZipFile def main(): if sys.platform == "win32": - executable = shutil.which("powershell.exe") - cmd = shlex.split("Set-ExecutionPolicy RemoteSigned -Scope CurrentUser;irm get.scoop.sh | iex", posix=False) - p_scoop = subprocess.run(cmd, shell=True, executable=executable) - p_install = subprocess.run(shlex.split("scoop install gettext", posix=False), shell=True, executable=executable) + powershell = shutil.which("powershell.exe") + gettext_url = "https://github.com/vslavik/gettext-tools-windows/releases/download/v0.21.1/gettext-tools-windows-0.21.1.zip" + gettext_path = os.path.join(os.environ["LOCALAPPDATA"], "Programs", "gettext-tools") + gettext_zip = os.path.join(gettext_path, "gettext-tools.zip") + + try: + subprocess.run(shlex.split(f"mkdir -p {gettext_path}", posix=False), shell=True, executable=powershell) + + response = requests.get(gettext_url) + with open(gettext_zip, "wb") as f: + f.write(response.content) + + with ZipFile(gettext_zip, "r") as zip: + zip.extractall(gettext_path) + + os.remove(gettext_zip) + os.environ["PATH"] += os.pathsep + os.path.join(gettext_path, "bin") - return p_scoop.returncode or p_install.returncode + except Exception as e: + print(e) + return 1 + + else: + return 0 elif sys.platform in ["linux", "linux2"]: cmd = "sudo apt update; sudo apt install -y gettext" @@ -22,5 +43,5 @@ def main(): if __name__ == "__main__": - print(".") + print("Installing gettext...") exit(main()) diff --git a/requirements.txt b/requirements.txt index e56fc0015..61370b741 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ tqdm pre-commit polib deep_translator +requests From a51316e0cb25b0e9dbf0678ab1c053627195a3f1 Mon Sep 17 00:00:00 2001 From: egeakman Date: Sun, 19 Feb 2023 20:25:07 +0300 Subject: [PATCH 35/44] update --- .pre-commit-config.yaml | 5 +++- .pre-commit-scripts/install_gettext.py | 37 ++++++++++++++++---------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c93572c2..b5c6a9d99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ repos: - repo: local hooks: - id: style-print - name: style-print + name: "" entry: "style-print 'This is highly experimental, please report any issues: https://github.com/python/python-docs-tr/issues' 'rUBI{y}'" language: python additional_dependencies: ["style-print"] @@ -16,6 +16,7 @@ repos: entry: python .pre-commit-scripts/install_gettext.py language: system verbose: true + pass_filenames: false - id: lint name: Run sphinx-lint on .po files @@ -28,6 +29,8 @@ repos: rev: v1.0.0 hooks: - id: powrap + name: Run powrap on .po files + pass_filenames: false - repo: https://github.com/psf/black rev: 23.1.0 diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py index 5ea32c6de..b7803cc67 100644 --- a/.pre-commit-scripts/install_gettext.py +++ b/.pre-commit-scripts/install_gettext.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import os import sys -import shlex import shutil import requests import subprocess @@ -14,24 +13,34 @@ def main(): gettext_url = "https://github.com/vslavik/gettext-tools-windows/releases/download/v0.21.1/gettext-tools-windows-0.21.1.zip" gettext_path = os.path.join(os.environ["LOCALAPPDATA"], "Programs", "gettext-tools") gettext_zip = os.path.join(gettext_path, "gettext-tools.zip") - + try: - subprocess.run(shlex.split(f"mkdir -p {gettext_path}", posix=False), shell=True, executable=powershell) - - response = requests.get(gettext_url) - with open(gettext_zip, "wb") as f: - f.write(response.content) - - with ZipFile(gettext_zip, "r") as zip: - zip.extractall(gettext_path) - - os.remove(gettext_zip) - os.environ["PATH"] += os.pathsep + os.path.join(gettext_path, "bin") + None if os.path.exists(gettext_path) else os.mkdir(gettext_path) + + if not os.path.exists(os.path.join(gettext_path, "bin")): + response = requests.get(gettext_url) + with open(gettext_zip, "wb") as f: + f.write(response.content) + + with ZipFile(gettext_zip, "r") as zip: + zip.extractall(gettext_path) + + os.remove(gettext_zip) if os.path.exists(gettext_zip) else None + + p = subprocess.run("$profile.CurrentUserCurrentHost", shell=True, executable=powershell, capture_output=True, text=True) + with open(p.stdout.strip("\n"), "a+") as f: + command = f"$Env:PATH += '{os.pathsep + os.path.join(gettext_path, 'bin')}'" + f.seek(0) + if command not in f.readlines(): + print("Adding gettext to PATH...") + f.write(f"\n{command}") + else: + print("gettext is already in PATH") except Exception as e: print(e) return 1 - + else: return 0 From 9ce2eea626b429680b72feb4e2fb24e9b04f25ce Mon Sep 17 00:00:00 2001 From: egeakman Date: Sun, 19 Feb 2023 21:08:50 +0300 Subject: [PATCH 36/44] test --- .github/workflows/pre-commit-ci.yml | 2 +- .pre-commit-config.yaml | 6 +++--- about.po | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 92afc305a..a150cb919 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -30,7 +30,7 @@ jobs: path: ~/.cache/pre-commit - name: Run pre-commit - run: pre-commit run --all-files --show-diff-on-failure + run: pre-commit run --show-diff-on-failure - name: Run pre-commit-ci-lite uses: pre-commit-ci/lite-action@v1.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5c6a9d99..30bf5706c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,12 +25,12 @@ repos: additional_dependencies: ["sphinx-lint"] files: \.po$ - - repo: https://github.com/AFPy/powrap - rev: v1.0.0 + - repo: https://github.com/egeakman/powrap + rev: v1.0.1 hooks: - id: powrap name: Run powrap on .po files - pass_filenames: false + files: \.po$ - repo: https://github.com/psf/black rev: 23.1.0 diff --git a/about.po b/about.po index 953cd8db1..edc38d881 100644 --- a/about.po +++ b/about.po @@ -27,8 +27,7 @@ msgid "" "a document processor specifically written for the Python documentation." msgstr "" "Bu dokümanlar, Python dokümanları için özel olarak yazılmış bir doküman " -"işlemcisi olan `Sphinx`_ tarafından `reStructuredText`_ kaynaklarından " -"oluşturulur." +"işlemcisi olan `Sphinx`_ tarafından `reStructuredText`_ kaynaklarından oluşturulur." #: about.rst:15 msgid "" From 4a01035eba3ec63b5a3a007e2a44913733bed65a Mon Sep 17 00:00:00 2001 From: egeakman Date: Tue, 21 Feb 2023 12:57:50 +0300 Subject: [PATCH 37/44] revert to 9ce2eea626b429680b72feb4e2fb24e9b04f25ce and make changes --- .github/workflows/msys.yaml | 38 +++++++++++++++++ .github/workflows/pre-commit-ci.yml | 64 ++++++++++++++--------------- 2 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/msys.yaml diff --git a/.github/workflows/msys.yaml b/.github/workflows/msys.yaml new file mode 100644 index 000000000..74f7dbbb2 --- /dev/null +++ b/.github/workflows/msys.yaml @@ -0,0 +1,38 @@ +name: MSYS +on: + workflow_dispatch: + push: + branches: + - "line-length" + +jobs: + msys2-msys: + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v3 + - uses: msys2/setup-msys2@v2 + with: + msystem: MSYS + update: true + install: git gettext + + - name: Run msgcat + run: | + msgcat --version + msgcat -o library/stdtypes.po library/stdtypes.po + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4.2.3 + with: + token: ${{ secrets.BOT_PAT }} + commit-message: "Wrap all files on: ${{ github.ref_name }}" + branch: ${{ github.ref_name }}-wrapped + delete-branch: true + committer: python-docs-turkish + author: python-docs-turkish + title: "Wrap branch: ${{ github.ref_name }}" + body: "Wrapped all files on branch: ${{ github.ref_name }}." + labels: wrap diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index a150cb919..f48bc8893 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -1,37 +1,37 @@ -name: pre-commit-ci -on: - workflow_dispatch: - push: - branches: - - "**" - pull_request: - branches: - - "**" +# name: pre-commit-ci +# on: +# workflow_dispatch: +# push: +# branches: +# - "**" +# pull_request: +# branches: +# - "**" -jobs: - pre-commit: - name: "Pre-commit checks" - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - id: setup_python - with: - python-version: "3.11" - cache: pip +# jobs: +# pre-commit: +# name: "Pre-commit checks" +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-python@v4 +# id: setup_python +# with: +# python-version: "3.11" +# cache: pip - - name: Install pre-commit - run: pip install --upgrade pre-commit +# - name: Install pre-commit +# run: pip install --upgrade -r requirements.txt - - name: Cache pre-commit tools - uses: actions/cache@v3 - with: - key: pre-commit-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('.pre-commit-config.yaml') }} - path: ~/.cache/pre-commit +# - name: Cache pre-commit tools +# uses: actions/cache@v3 +# with: +# key: pre-commit-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('.pre-commit-config.yaml') }} +# path: ~/.cache/pre-commit - - name: Run pre-commit - run: pre-commit run --show-diff-on-failure +# - name: Run pre-commit +# run: pre-commit run --all-files --show-diff-on-failure - - name: Run pre-commit-ci-lite - uses: pre-commit-ci/lite-action@v1.0.1 - if: always() +# - name: Run pre-commit-ci-lite +# uses: pre-commit-ci/lite-action@v1.0.1 +# if: always() From f7d22a435a0e43923d773138c6c1d61efcb64c80 Mon Sep 17 00:00:00 2001 From: egeakman Date: Wed, 22 Feb 2023 10:28:45 +0300 Subject: [PATCH 38/44] test --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitattributes b/.gitattributes index 788f0b385..e4542b025 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,4 @@ *.po diff=podiff +*.po text eol=lf *.pot diff=podiff +*.pot text eol=lf From 59d46d25887320308716ae950b0e79bbdeec0c19 Mon Sep 17 00:00:00 2001 From: egeakman Date: Wed, 22 Feb 2023 10:43:44 +0300 Subject: [PATCH 39/44] test --- .github/workflows/msys.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/msys.yaml b/.github/workflows/msys.yaml index 74f7dbbb2..743d16172 100644 --- a/.github/workflows/msys.yaml +++ b/.github/workflows/msys.yaml @@ -22,7 +22,7 @@ jobs: - name: Run msgcat run: | msgcat --version - msgcat -o library/stdtypes.po library/stdtypes.po + msgcat -o library/stdtypes.po library/stdtypes.po -w 79 - name: Create Pull Request uses: peter-evans/create-pull-request@v4.2.3 From 52c8bf37bc716d7e78782cda416e7ccd7c43cdb6 Mon Sep 17 00:00:00 2001 From: egeakman Date: Wed, 22 Feb 2023 12:18:54 +0300 Subject: [PATCH 40/44] Will be good to go after tests --- .github/workflows/msys.yaml | 38 ----------------- .github/workflows/pre-commit-ci.yml | 66 +++++++++++++++-------------- .pre-commit-config.yaml | 2 +- about.po | 3 +- merge.py | 4 +- 5 files changed, 37 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/msys.yaml diff --git a/.github/workflows/msys.yaml b/.github/workflows/msys.yaml deleted file mode 100644 index 743d16172..000000000 --- a/.github/workflows/msys.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: MSYS -on: - workflow_dispatch: - push: - branches: - - "line-length" - -jobs: - msys2-msys: - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - steps: - - uses: actions/checkout@v3 - - uses: msys2/setup-msys2@v2 - with: - msystem: MSYS - update: true - install: git gettext - - - name: Run msgcat - run: | - msgcat --version - msgcat -o library/stdtypes.po library/stdtypes.po -w 79 - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4.2.3 - with: - token: ${{ secrets.BOT_PAT }} - commit-message: "Wrap all files on: ${{ github.ref_name }}" - branch: ${{ github.ref_name }}-wrapped - delete-branch: true - committer: python-docs-turkish - author: python-docs-turkish - title: "Wrap branch: ${{ github.ref_name }}" - body: "Wrapped all files on branch: ${{ github.ref_name }}." - labels: wrap diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index f48bc8893..f86f1548a 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -1,37 +1,39 @@ -# name: pre-commit-ci -# on: -# workflow_dispatch: -# push: -# branches: -# - "**" -# pull_request: -# branches: -# - "**" +name: pre-commit-ci +on: + workflow_dispatch: + push: + branches: + - "**" + pull_request: + branches: + - "**" -# jobs: -# pre-commit: -# name: "Pre-commit checks" -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: actions/setup-python@v4 -# id: setup_python -# with: -# python-version: "3.11" -# cache: pip +jobs: + pre-commit: + name: "Pre-commit checks" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + id: setup_python + with: + python-version: "3.11" + cache: pip -# - name: Install pre-commit -# run: pip install --upgrade -r requirements.txt + - name: Install pre-commit + run: pip install --upgrade -r requirements.txt -# - name: Cache pre-commit tools -# uses: actions/cache@v3 -# with: -# key: pre-commit-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('.pre-commit-config.yaml') }} -# path: ~/.cache/pre-commit + - name: Cache pre-commit tools + uses: actions/cache@v3 + with: + key: pre-commit-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('.pre-commit-config.yaml') }} + path: ~/.cache/pre-commit -# - name: Run pre-commit -# run: pre-commit run --all-files --show-diff-on-failure + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure -# - name: Run pre-commit-ci-lite -# uses: pre-commit-ci/lite-action@v1.0.1 -# if: always() + - name: Run pre-commit-ci-lite + uses: pre-commit-ci/lite-action@v1.0.1 + if: always() + + \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30bf5706c..f14767a66 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: hooks: - id: style-print name: "" - entry: "style-print 'This is highly experimental, please report any issues: https://github.com/python/python-docs-tr/issues' 'rUBI{y}'" + entry: "style-print 'This is highly experimental, please report any issues at: https://github.com/python/python-docs-tr/issues' 'rUBI{y}'" language: python additional_dependencies: ["style-print"] pass_filenames: false diff --git a/about.po b/about.po index edc38d881..053e3d972 100644 --- a/about.po +++ b/about.po @@ -26,8 +26,7 @@ msgid "" "These documents are generated from `reStructuredText`_ sources by `Sphinx`_, " "a document processor specifically written for the Python documentation." msgstr "" -"Bu dokümanlar, Python dokümanları için özel olarak yazılmış bir doküman " -"işlemcisi olan `Sphinx`_ tarafından `reStructuredText`_ kaynaklarından oluşturulur." +"Bu dokümanlar, Python dokümanları için özel olarak yazılmış bir doküman işlemcisi olan `Sphinx`_ tarafından `reStructuredText`_ kaynaklarından oluşturulur." #: about.rst:15 msgid "" diff --git a/merge.py b/merge.py index 3e15dacd1..b34569ee2 100644 --- a/merge.py +++ b/merge.py @@ -20,9 +20,7 @@ def run(*args: str | Path, **kwargs) -> subprocess.CompletedProcess: encoding="UTF-8". """ return subprocess.run(list(args), encoding="UTF-8", check=True, **kwargs) - - -def parse_args(): +def parse_args(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "--cpython_repo", From 8470e94c30a135b46e088512fe72d0f355b6d65b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Wed, 22 Feb 2023 09:20:49 +0000 Subject: [PATCH 41/44] [pre-commit.ci lite] apply automatic fixes --- .github/workflows/pre-commit-ci.yml | 2 -- about.po | 4 +++- merge.py | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index f86f1548a..f88ef237d 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -35,5 +35,3 @@ jobs: - name: Run pre-commit-ci-lite uses: pre-commit-ci/lite-action@v1.0.1 if: always() - - \ No newline at end of file diff --git a/about.po b/about.po index 053e3d972..953cd8db1 100644 --- a/about.po +++ b/about.po @@ -26,7 +26,9 @@ msgid "" "These documents are generated from `reStructuredText`_ sources by `Sphinx`_, " "a document processor specifically written for the Python documentation." msgstr "" -"Bu dokümanlar, Python dokümanları için özel olarak yazılmış bir doküman işlemcisi olan `Sphinx`_ tarafından `reStructuredText`_ kaynaklarından oluşturulur." +"Bu dokümanlar, Python dokümanları için özel olarak yazılmış bir doküman " +"işlemcisi olan `Sphinx`_ tarafından `reStructuredText`_ kaynaklarından " +"oluşturulur." #: about.rst:15 msgid "" diff --git a/merge.py b/merge.py index b34569ee2..3e15dacd1 100644 --- a/merge.py +++ b/merge.py @@ -20,7 +20,9 @@ def run(*args: str | Path, **kwargs) -> subprocess.CompletedProcess: encoding="UTF-8". """ return subprocess.run(list(args), encoding="UTF-8", check=True, **kwargs) -def parse_args(): + + +def parse_args(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "--cpython_repo", From 272c5778bde933d2daa547c2eb095539a0cd85ff Mon Sep 17 00:00:00 2001 From: egeakman Date: Wed, 22 Feb 2023 16:46:50 +0300 Subject: [PATCH 42/44] ok --- .pre-commit-config.yaml | 12 +++++++++--- .pre-commit-scripts/run_powrap.py | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-scripts/run_powrap.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f14767a66..5c50d4a2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,13 +25,19 @@ repos: additional_dependencies: ["sphinx-lint"] files: \.po$ - - repo: https://github.com/egeakman/powrap - rev: v1.0.1 - hooks: - id: powrap name: Run powrap on .po files + entry: python .pre-commit-scripts/run_powrap.py + language: system files: \.po$ + # - repo: https://github.com/egeakman/powrap + # rev: v1.0.2 + # hooks: + # - id: powrap + # name: Run powrap on .po files + # files: \.po$ + - repo: https://github.com/psf/black rev: 23.1.0 hooks: diff --git a/.pre-commit-scripts/run_powrap.py b/.pre-commit-scripts/run_powrap.py new file mode 100644 index 000000000..b746f2551 --- /dev/null +++ b/.pre-commit-scripts/run_powrap.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import sys +import shutil +import shlex +import subprocess + + +def main(): + if sys.platform == "win32": + powershell = shutil.which("powershell.exe") + install = subprocess.run( + shlex.split("pip install git+https://github.com/egeakman/powrap.git@v1.0.2", posix=False), shell=True, executable=powershell + ) + run = subprocess.run(shlex.split(f"powrap {sys.argv[1]} --quiet", posix=False), shell=True, executable=powershell) + + else: + install = subprocess.run(shlex.split("pip install git+https://github.com/egeakman/powrap.git@v1.0.2", posix=True)) + run = subprocess.run(shlex.split(f"powrap {sys.argv[1]} --quiet", posix=True)) + + return any([install.returncode, run.returncode]) + + +if __name__ == "__main__": + exit(main()) From 6bb9143908bd3d4cfd2fd5bc800d061928ce87a3 Mon Sep 17 00:00:00 2001 From: Ege Akman Date: Wed, 1 Mar 2023 12:24:39 +0300 Subject: [PATCH 43/44] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 9b4b3791e..3de94e85a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ Bu proje gönüllü çevirmenler ve python-docs-tr ekibi iş birliğinde sürdü - Yüklü bir [Git](https://git-scm.com/) istemcisi - ``.po`` dosyalarını düzenlemek için [poedit](https://poedit.net/) gibi bir program - Yüklü bir Python ve ``pip`` versiyonu (en son stabil olan versiyon önerilir) -- ``gettext`` araçları ([yükleme adımları](wiki/gettext.md)) ### Adımlar From 30ddb757f0edc684a45d6908a138af7573568071 Mon Sep 17 00:00:00 2001 From: egeakman Date: Wed, 1 Mar 2023 12:38:05 +0300 Subject: [PATCH 44/44] remove powrap from pre-commit since it is very problematic --- .pre-commit-config.yaml | 28 +++---------- .pre-commit-scripts/install_gettext.py | 56 -------------------------- .pre-commit-scripts/run_powrap.py | 24 ----------- merge.py | 3 +- requirements.txt | 1 - scripts/format_check.py | 6 +-- scripts/translate.py | 5 ++- 7 files changed, 14 insertions(+), 109 deletions(-) delete mode 100644 .pre-commit-scripts/install_gettext.py delete mode 100644 .pre-commit-scripts/run_powrap.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c50d4a2a..236103264 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,21 +3,12 @@ repos: hooks: - id: style-print name: "" - entry: "style-print 'This is highly experimental, please report any issues at: https://github.com/python/python-docs-tr/issues' 'rUBI{y}'" + entry: "style-print 'Please report any issues at: https://github.com/python/python-docs-tr/issues' 'rUBI{y}'" language: python additional_dependencies: ["style-print"] pass_filenames: false verbose: true - - repo: local - hooks: - - id: gettext - name: Install gettext - entry: python .pre-commit-scripts/install_gettext.py - language: system - verbose: true - pass_filenames: false - - id: lint name: Run sphinx-lint on .po files entry: sphinx-lint @@ -25,18 +16,11 @@ repos: additional_dependencies: ["sphinx-lint"] files: \.po$ - - id: powrap - name: Run powrap on .po files - entry: python .pre-commit-scripts/run_powrap.py - language: system - files: \.po$ - - # - repo: https://github.com/egeakman/powrap - # rev: v1.0.2 - # hooks: - # - id: powrap - # name: Run powrap on .po files - # files: \.po$ + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + name: isort (python) - repo: https://github.com/psf/black rev: 23.1.0 diff --git a/.pre-commit-scripts/install_gettext.py b/.pre-commit-scripts/install_gettext.py deleted file mode 100644 index b7803cc67..000000000 --- a/.pre-commit-scripts/install_gettext.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python3 -import os -import sys -import shutil -import requests -import subprocess -from zipfile import ZipFile - - -def main(): - if sys.platform == "win32": - powershell = shutil.which("powershell.exe") - gettext_url = "https://github.com/vslavik/gettext-tools-windows/releases/download/v0.21.1/gettext-tools-windows-0.21.1.zip" - gettext_path = os.path.join(os.environ["LOCALAPPDATA"], "Programs", "gettext-tools") - gettext_zip = os.path.join(gettext_path, "gettext-tools.zip") - - try: - None if os.path.exists(gettext_path) else os.mkdir(gettext_path) - - if not os.path.exists(os.path.join(gettext_path, "bin")): - response = requests.get(gettext_url) - with open(gettext_zip, "wb") as f: - f.write(response.content) - - with ZipFile(gettext_zip, "r") as zip: - zip.extractall(gettext_path) - - os.remove(gettext_zip) if os.path.exists(gettext_zip) else None - - p = subprocess.run("$profile.CurrentUserCurrentHost", shell=True, executable=powershell, capture_output=True, text=True) - with open(p.stdout.strip("\n"), "a+") as f: - command = f"$Env:PATH += '{os.pathsep + os.path.join(gettext_path, 'bin')}'" - f.seek(0) - if command not in f.readlines(): - print("Adding gettext to PATH...") - f.write(f"\n{command}") - else: - print("gettext is already in PATH") - - except Exception as e: - print(e) - return 1 - - else: - return 0 - - elif sys.platform in ["linux", "linux2"]: - cmd = "sudo apt update; sudo apt install -y gettext" - else: # macOS - cmd = "brew update; brew install gettext" - return subprocess.run(cmd, shell=True).returncode - - -if __name__ == "__main__": - print("Installing gettext...") - exit(main()) diff --git a/.pre-commit-scripts/run_powrap.py b/.pre-commit-scripts/run_powrap.py deleted file mode 100644 index b746f2551..000000000 --- a/.pre-commit-scripts/run_powrap.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python3 -import sys -import shutil -import shlex -import subprocess - - -def main(): - if sys.platform == "win32": - powershell = shutil.which("powershell.exe") - install = subprocess.run( - shlex.split("pip install git+https://github.com/egeakman/powrap.git@v1.0.2", posix=False), shell=True, executable=powershell - ) - run = subprocess.run(shlex.split(f"powrap {sys.argv[1]} --quiet", posix=False), shell=True, executable=powershell) - - else: - install = subprocess.run(shlex.split("pip install git+https://github.com/egeakman/powrap.git@v1.0.2", posix=True)) - run = subprocess.run(shlex.split(f"powrap {sys.argv[1]} --quiet", posix=True)) - - return any([install.returncode, run.returncode]) - - -if __name__ == "__main__": - exit(main()) diff --git a/merge.py b/merge.py index 3e15dacd1..7db4c0b76 100644 --- a/merge.py +++ b/merge.py @@ -6,12 +6,13 @@ This script is run automatically by the GitHub Actions workflow every first day of the month. """ +import argparse import re import shutil -import argparse import subprocess from pathlib import Path from subprocess import PIPE + from tqdm import tqdm diff --git a/requirements.txt b/requirements.txt index 61370b741..e56fc0015 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,3 @@ tqdm pre-commit polib deep_translator -requests diff --git a/scripts/format_check.py b/scripts/format_check.py index fd012978d..3f4957749 100644 --- a/scripts/format_check.py +++ b/scripts/format_check.py @@ -1,11 +1,11 @@ -import collections -import os import argparse +import collections import contextlib import glob -import polib +import os from pprint import pprint +import polib parser = argparse.ArgumentParser() parser.add_argument("subject", nargs="?", default=None, help="Subject to check (file or directory)") diff --git a/scripts/translate.py b/scripts/translate.py index 9b6f61393..77a94543f 100644 --- a/scripts/translate.py +++ b/scripts/translate.py @@ -1,10 +1,11 @@ import os import re import sys +from argparse import ArgumentParser +from typing import Dict, Tuple + import polib from deep_translator import DeeplTranslator, GoogleTranslator -from typing import Dict, Tuple -from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument("filename", help="File to translate")