From 6e5ba11f4cb8c3080ed6094bacb768c6d94a828b Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 15:26:12 +0100 Subject: [PATCH 01/10] strip whitespaces, allow empty lines --- .editorconfig | 6 ++++++ .github/workflows/test.yml | 2 +- .vscode/settings.json | 1 - src/bdfparser/bdfparser.py | 8 ++++++-- tests/fonts/unifont-13.0.04-for-test.bdf | 21 +++++++++++++++++++-- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.editorconfig b/.editorconfig index d9de0c9..75bbdcb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,3 +18,9 @@ trim_trailing_whitespace = true [*.{md,mdx}] trim_trailing_whitespace = false + +[*.bdf] +charset = utf-8 +end_of_line = lf +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14bb199..f843dc1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - ubuntu-latest - macos-latest - windows-latest - python: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + python: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13.1"] steps: - uses: actions/checkout@v2 diff --git a/.vscode/settings.json b/.vscode/settings.json index 81002b9..c657146 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,5 @@ { "python.testing.unittestEnabled": false, - "python.testing.nosetestsEnabled": false, "python.testing.pytestEnabled": true, "python.envFile": "${workspaceRoot}/vscode.env" } diff --git a/src/bdfparser/bdfparser.py b/src/bdfparser/bdfparser.py index e325ddc..982e89c 100644 --- a/src/bdfparser/bdfparser.py +++ b/src/bdfparser/bdfparser.py @@ -120,7 +120,9 @@ def __parse_headers(self): while 1: - line = next(self.__f) + line = next(self.__f).strip() + while len(line) == 0: + line = next(self.__f).strip() kvlist = line.split(None, 1) l = len(kvlist) @@ -203,7 +205,9 @@ def __parse_props(self): while 1: - line = next(self.__f) + line = next(self.__f).strip() + while len(line) == 0: + line = next(self.__f).strip() kvlist = line.split(None, 1) l = len(kvlist) diff --git a/tests/fonts/unifont-13.0.04-for-test.bdf b/tests/fonts/unifont-13.0.04-for-test.bdf index 2b59892..5ac13bf 100644 --- a/tests/fonts/unifont-13.0.04-for-test.bdf +++ b/tests/fonts/unifont-13.0.04-for-test.bdf @@ -1,4 +1,7 @@ -STARTFONT 2.1 + + + STARTFONT 2.1 + FONT -gnu-Unifont-Medium-R-Normal-Sans-16-160-75-75-c-80-iso10646-1 SIZE 16 75 75 FONTBOUNDINGBOX 16 16 0 -2 @@ -6,6 +9,8 @@ COMMENT "Generated by fontforge, http://fontforge.sourceforge.net" COMMENT "(C)Copyright" STARTPROPERTIES 24 COPYRIGHT "Copyright (C) 1998-2020 Roman Czyborra, Paul Hardy, Qianqian Fang, Andrew Miller, Johnnie Weaver, David Corbett, Rebecca Bettencourt, et al. License: SIL Open Font License version 1.1 and GPLv2+: GNU GPL version 2 or later with the GNU Font Embedding Exception." + + FONT_VERSION "13.0.04" FONT_TYPE "Bitmap" FOUNDRY "GNU" @@ -30,7 +35,13 @@ FONT_ASCENT 14 FONT_DESCENT 2 DEFAULT_CHAR 65533 ENDPROPERTIES -CHARS 849 + + + + + + + CHARS 849 STARTCHAR U+0001 ENCODING 1 SWIDTH 1000 0 @@ -19558,4 +19569,10 @@ BITMAP 4A 4A ENDCHAR + + + + + ENDFONT + \ No newline at end of file From f20f9d1e2d7689c7050f60f210ab75c25070ad31 Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 15:57:42 +0100 Subject: [PATCH 02/10] update python versions for test --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f843dc1..f6a00da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - ubuntu-latest - macos-latest - windows-latest - python: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13.1"] + python: ["3.5.10", "3.6.15", "3.7.17", "3.8.18", "3.9.21", "3.10.16", "3.11.11", "3.12.8", "3.13.1", "3.14.0-alpha.3"] steps: - uses: actions/checkout@v2 From aa7b0d2bd865f722669d4230c33d6da4bf7241cd Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 16:03:32 +0100 Subject: [PATCH 03/10] update ci actions --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f6a00da..9c18191 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,12 +19,12 @@ jobs: - ubuntu-latest - macos-latest - windows-latest - python: ["3.5.10", "3.6.15", "3.7.17", "3.8.18", "3.9.21", "3.10.16", "3.11.11", "3.12.8", "3.13.1", "3.14.0-alpha.3"] + python: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - name: Install Tox and any other packages @@ -33,7 +33,7 @@ jobs: # Run tox using the version of Python in `PATH` run: tox -e py - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - if: matrix.os == 'ubuntu-latest' && matrix.python == '3.9' + uses: codecov/codecov-action@v3 + if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' with: file: ./coverage.xml From eb9fe9ea312e3e468a9735c15d1543b85655f888 Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 16:08:51 +0100 Subject: [PATCH 04/10] use ubuntu-20.04 --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c18191..8917c51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,8 +16,7 @@ jobs: strategy: matrix: os: - - ubuntu-latest - - macos-latest + - ubuntu-20.04 - windows-latest python: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] @@ -34,6 +33,6 @@ jobs: run: tox -e py - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' + if: matrix.os == 'ubuntu-20.04' && matrix.python == '3.13' with: file: ./coverage.xml From d0f665201cbc42f60808f180bb62e403c027d7ce Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 16:12:11 +0100 Subject: [PATCH 05/10] ci pip without SSL verification --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8917c51..0a0ae62 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} + - name: Upgrade pip (without SSL verification) + run: python -m pip install --upgrade pip --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org - name: Install Tox and any other packages run: pip install tox - name: Run Tox From 412ff5c141d7287709a177a6bfc141a5284e2772 Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 16:15:27 +0100 Subject: [PATCH 06/10] fix PIP_TRUSTED_HOST again --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a0ae62..db761df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,11 +23,11 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - - name: Upgrade pip (without SSL verification) - run: python -m pip install --upgrade pip --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org + env: + PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" - name: Install Tox and any other packages run: pip install tox - name: Run Tox From 6858c345a8045aeab1797cdabb425cf7367e9e5e Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 16:49:38 +0100 Subject: [PATCH 07/10] update ci --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 12 +++++++----- .vscode/settings.json | 5 ----- requirements.txt | 3 +++ tox.ini | 4 ++-- vscode.env | 1 - 6 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 requirements.txt delete mode 100644 vscode.env diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 91100b4..8a66594 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,9 +8,9 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db761df..8fa2024 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,20 +21,22 @@ jobs: python: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} env: PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" - - name: Install Tox and any other packages - run: pip install tox + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt - name: Run Tox # Run tox using the version of Python in `PATH` run: tox -e py - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - if: matrix.os == 'ubuntu-20.04' && matrix.python == '3.13' + uses: codecov/codecov-action@v5 + if: github.event_name == 'push' && matrix.os == 'ubuntu-20.04' && matrix.python == '3.13' with: file: ./coverage.xml diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c657146..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "python.envFile": "${workspaceRoot}/vscode.env" -} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d9947d3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +tox>=4.0.0 +pytest>=7.0.0 +pytest-cov>=4.0.0 diff --git a/tox.ini b/tox.ini index a5eac07..d531c0e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] -envlist = py{35,36,37,38,39} +envlist = py35,py36,py37,py38,py39,py310,py311,py312,py313 minversion = 3.3.0 -isolated_build = true +isolated_build = True [testenv] deps = diff --git a/vscode.env b/vscode.env deleted file mode 100644 index 76297c2..0000000 --- a/vscode.env +++ /dev/null @@ -1 +0,0 @@ -PYTHONPATH=/;src/;${PYTHONPATH} From 2642f01d84f5b2e2a860da641a9e36da936def71 Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 16:55:42 +0100 Subject: [PATCH 08/10] fix tox version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d9947d3..8e09476 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -tox>=4.0.0 +tox>=3.24.0 pytest>=7.0.0 pytest-cov>=4.0.0 From b59acb275d014c6a7dfb8f9e86d1130e754e61e9 Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 16:58:16 +0100 Subject: [PATCH 09/10] fix pytest ver --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8e09476..d2241ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ tox>=3.24.0 -pytest>=7.0.0 -pytest-cov>=4.0.0 +pytest>=4.6.0 +pytest-cov>=2.5.0 From 4613ecd716f55ec368a928834d815c0687d52359 Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Tue, 7 Jan 2025 17:28:38 +0100 Subject: [PATCH 10/10] restore --- .github/workflows/test.yml | 6 ++---- requirements.txt | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 requirements.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8fa2024..029ec9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,10 +28,8 @@ jobs: python-version: ${{ matrix.python }} env: PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + - name: Install Tox and any other packages + run: pip install tox - name: Run Tox # Run tox using the version of Python in `PATH` run: tox -e py diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d2241ee..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -tox>=3.24.0 -pytest>=4.6.0 -pytest-cov>=2.5.0