diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97234056..d0d613ac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -25,7 +25,6 @@ jobs: - name: Install Dependency and Configure if: runner.os == 'macOS' run: | - brew install cairo echo "LD_LIBRARY_PATH=$HOME/pangoprefix/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV echo "PKG_CONFIG_PATH=$HOME/pangoprefix/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV - name: Set ENV @@ -43,22 +42,14 @@ jobs: if: steps.cache-pango.outputs.cache-hit != 'true' run: | source packing/build_pango_tests.sh - - name: Install python dependencies run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt + - name: Build Project + run: python setup.py build_ext -i - name: Run Tests - run: | - python setup.py build_ext -i - python setup.py sdist - pip install . - pytest - - name: Coverage - run: | - coverage report - coverage html - coverage xml + run: pytest -s - uses: codecov/codecov-action@v3 with: file: ./.coverage/coverage.xml diff --git a/packing/build_pango_tests.sh b/packing/build_pango_tests.sh index 96fc4e38..a4298543 100644 --- a/packing/build_pango_tests.sh +++ b/packing/build_pango_tests.sh @@ -2,11 +2,7 @@ # build and install pango set -e -PANGO_VERSION=1.50.11 -GLIB_VERSION=2.74.0 -FRIBIDI_VERSION=1.0.10 -CAIRO_VERSION=1.17.6 -HARFBUZZ_VERSION=5.3.1 +PANGO_VERSION=1.54.0 FILE_PATH=$PWD PREFIX="$HOME/pangoprefix" @@ -18,14 +14,7 @@ mkdir pango cd pango echo "::group::Downloading Files" -python -m pip install requests python $FILE_PATH/packing/download_and_extract.py "http://download.gnome.org/sources/pango/${PANGO_VERSION%.*}/pango-${PANGO_VERSION}.tar.xz" pango -python $FILE_PATH/packing/download_and_extract.py "http://download.gnome.org/sources/glib/${GLIB_VERSION%.*}/glib-${GLIB_VERSION}.tar.xz" glib -python $FILE_PATH/packing/download_and_extract.py "https://github.com/fribidi/fribidi/releases/download/v${FRIBIDI_VERSION}/fribidi-${FRIBIDI_VERSION}.tar.xz" fribidi -python $FILE_PATH/packing/download_and_extract.py "https://gitlab.freedesktop.org/cairo/cairo/-/archive/${CAIRO_VERSION}/cairo-${CAIRO_VERSION}.tar.gz" cairo -python $FILE_PATH/packing/download_and_extract.py "https://github.com/harfbuzz/harfbuzz/releases/download/${HARFBUZZ_VERSION}/harfbuzz-${HARFBUZZ_VERSION}.tar.xz" harfbuzz - -python -m pip uninstall -y requests echo "::endgroup::" @@ -37,38 +26,11 @@ echo "Installing Meson and Ninja" pip3 install -U meson ninja echo "::endgroup::" -echo "::group::Building and Install Glib" -meson setup --prefix=$PREFIX --buildtype=release -Dselinux=disabled -Dlibmount=disabled glib_builddir glib -meson compile -C glib_builddir -meson install -C glib_builddir -echo "::endgroup::" - -echo "::group::Building and Install Fribidi" -meson setup --prefix=$PREFIX --buildtype=release fribidi_builddir fribidi -meson compile -C fribidi_builddir -meson install -C fribidi_builddir -echo "::endgroup::" - -echo "::group::Building and Installing Cairo" -echo "Getting patch" -curl -L https://gitlab.freedesktop.org/cairo/cairo/-/commit/cdb7c298c7b89307ad69b94a1126221bd7c06579.patch -o test.diff -cd cairo -patch -Nbp1 -i "$PWD/../test.diff" || true -# it is fine to fail because the CI config is missing. -cd .. -meson setup --prefix=$PREFIX --default-library=shared --buildtype=release -Dfontconfig=enabled -Dfreetype=enabled -Dglib=enabled -Dzlib=enabled -Dtee=enabled cairo_builddir cairo -meson compile -C cairo_builddir -meson install --no-rebuild -C cairo_builddir -echo "::endgroup::" - -echo "::group::Building and Installing Harfbuzz" -meson setup --prefix=$PREFIX -Dcoretext=enabled --buildtype=release -Dtests=disabled -Ddocs=disabled harfbuzz_builddir harfbuzz -meson compile -C harfbuzz_builddir -meson install -C harfbuzz_builddir -echo "::endgroup::" - echo "::group::Buildling and Installing Pango" -meson setup --prefix=$PREFIX --buildtype=release -Dintrospection=disabled pango_builddir pango +meson setup --prefix=$PREFIX --buildtype=release \ + -Dintrospection=disabled \ + -Dfontconfig=enabled \ # tests depends on fontconfig + pango_builddir pango meson compile -C pango_builddir meson install -C pango_builddir echo "::endgroup::" diff --git a/packing/download_and_extract.py b/packing/download_and_extract.py index 6b3ee4d5..4677c942 100644 --- a/packing/download_and_extract.py +++ b/packing/download_and_extract.py @@ -7,8 +7,7 @@ import tarfile import tempfile from pathlib import Path - -import requests +import urllib.request logging.basicConfig(format="%(levelname)s - %(message)s", level=logging.INFO) parser = argparse.ArgumentParser(description="Download things.") @@ -16,25 +15,22 @@ parser.add_argument("folder", help="folder name to extract") args = parser.parse_args() -a = requests.get(args.url) -logging.info("Download Complete Extracting") -assert a.status_code != 404, "Does not exist." with tempfile.TemporaryDirectory() as tmpdirname: - tmpdirname = Path(tmpdirname) - fname = Path(args.url).name - for i in tmpdirname.iterdir(): - print(i) - with open(tmpdirname / fname, "wb") as f: - logging.info(f"Saving to {tmpdirname / fname}") - f.write(a.content) - with tarfile.open(tmpdirname / fname, "r") as tar: - logging.info(f"Extracting {tmpdirname / fname} to {tmpdirname}") + fname = Path(tmpdirname, Path(args.url).name) + + logging.info(f"Download & Saving file to {fname}") + + urllib.request.urlretrieve(args.url, fname) + + with tarfile.open(fname, "r") as tar: + logging.info(f"Extracting {fname} to {tmpdirname}") tar.extractall(tmpdirname) + logging.info( - f"Moving {str(tmpdirname / Path(Path(args.url).stem).stem)} " + f"Moving {Path(tmpdirname, Path(Path(args.url).stem).stem)} " f"to {str(args.folder)}" ) shutil.move( - str(tmpdirname / Path(Path(args.url).stem).stem), + Path(tmpdirname, Path(Path(args.url).stem).stem), str(args.folder), )