mirror of https://github.com/wanadev/yoga.git
Compare commits
61 Commits
Author | SHA1 | Date |
---|---|---|
Fabien LOISON | 10f46a1486 | |
dependabot[bot] | 591b8bea38 | |
Fabien LOISON | 572ccae0b0 | |
dependabot[bot] | b9c06cb414 | |
Fabien LOISON | 667415d603 | |
Fabien LOISON | fffc964b53 | |
Fabien LOISON | 7f2612ea43 | |
Fabien LOISON | 24e24a25f7 | |
Fabien LOISON | b1d0577969 | |
Damien Fernandes | f7bf1d8e1d | |
Fabien LOISON | 0d94c99352 | |
Fabien LOISON | ea76ed0d2d | |
Fabien LOISON | b8308c5098 | |
Fabien LOISON | 7098c7f519 | |
dependabot[bot] | c84ae0333d | |
Fabien LOISON | 6179603311 | |
Fabien LOISON | 55357d2b8a | |
dependabot[bot] | c29003e2d1 | |
Fabien LOISON | 01a713c32a | |
Fabien LOISON | 67c5370f35 | |
Fabien LOISON | 02045ca5fe | |
Fabien LOISON | dbfc65e7e3 | |
Fabien LOISON | 2f00b90e48 | |
Fabien LOISON | 0204383719 | |
Fabien LOISON | 786125df0d | |
Fabien LOISON | 5fc75adb9d | |
Fabien LOISON | fce71f5f5a | |
Fabien LOISON | b946eb5f2a | |
Fabien LOISON | 9e28095ba6 | |
Fabien LOISON | 8ca8432626 | |
Fabien LOISON | 6bf28043ab | |
Fabien LOISON | a1d83e798b | |
Fabien LOISON | e0f35a8598 | |
Fabien LOISON | 2678c3a4ae | |
Fabien LOISON | a1d5312273 | |
Fabien LOISON | 70849b8c26 | |
dependabot[bot] | 8857a02445 | |
dependabot[bot] | 7c48dc8555 | |
Fabien LOISON | 3bd861239b | |
dependabot[bot] | bd8abafb6d | |
Fabien LOISON | a6ddab32c6 | |
dependabot[bot] | a58b3c17f7 | |
Fabien LOISON | e459110ac4 | |
Fabien LOISON | deef18712b | |
Fabien LOISON | 80331b1156 | |
Fabien LOISON | 5d762b5ff5 | |
Fabien LOISON | 209e3b5473 | |
Fabien LOISON | dcd7ce3629 | |
dependabot[bot] | 83acd8edf8 | |
Fabien LOISON | a2ded89a7b | |
dependabot[bot] | 771518a8d3 | |
Fabien LOISON | f0972a2932 | |
dependabot[bot] | a79961fc99 | |
Fabien LOISON | e827e647c5 | |
dependabot[bot] | a6009440c8 | |
Fabien LOISON | e31f0b8750 | |
Fabien LOISON | 70e05003c8 | |
Fabien LOISON | b3c49cd87c | |
Fabien LOISON | 494a5fba72 | |
Fabien LOISON | de66166f1c | |
Fabien LOISON | fb2e982439 |
|
@ -0,0 +1,6 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
|
@ -14,15 +14,15 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: "Checkout the repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
submodules: true
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
python-version: "3.12"
|
||||
|
||||
- name: "Install Python dependencies"
|
||||
run: |
|
||||
|
|
|
@ -8,7 +8,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
||||
|
||||
name: "Build and test YOGA"
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -16,19 +16,18 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: "Checkout the repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: "Set up Python ${{ matrix.python-version }}"
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: "Install Nox"
|
||||
- name: "Install Python dependencies"
|
||||
run: |
|
||||
pip3 install setuptools
|
||||
pip3 install nox
|
||||
pip install setuptools nox
|
||||
|
||||
- name: "Lint with flake8, Black and codespell"
|
||||
run: |
|
||||
|
|
|
@ -3,7 +3,9 @@ name: "Build and Publish Python Packages"
|
|||
|
||||
on:
|
||||
push:
|
||||
tags: "v[0-9]+.[0-9]+.[0-9]+"
|
||||
tags:
|
||||
- "v[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||
- "v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+"
|
||||
|
||||
jobs:
|
||||
|
||||
|
@ -15,21 +17,25 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: "Checkout the repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
python-version: "3.12"
|
||||
|
||||
- name: "Install python dependencies"
|
||||
run: |
|
||||
pip install setuptools
|
||||
|
||||
- name: "Build source distribution"
|
||||
run: |
|
||||
python setup.py sdist
|
||||
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sdist
|
||||
path: dist/
|
||||
|
@ -51,20 +57,20 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: "Checkout the repository"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: "Build wheels"
|
||||
uses: pypa/cibuildwheel@v2.11.2
|
||||
uses: pypa/cibuildwheel@v2.18.1
|
||||
env:
|
||||
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
|
||||
CIBW_SKIP: cp*-win32
|
||||
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheels
|
||||
name: wheels-${{ matrix.os }}
|
||||
path: ./wheelhouse/*.whl
|
||||
retention-days: 1
|
||||
|
||||
|
@ -79,13 +85,13 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: "Download artifacts"
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: "Move packages to the dist/ folder"
|
||||
run: |
|
||||
mkdir dist/
|
||||
mv sdist/* dist/
|
||||
mv wheels/*.whl dist/
|
||||
mv wheels-*/*.whl dist/
|
||||
|
||||
- name: "Publish packages on PyPI"
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
name: "Standalone Builds"
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||
- "v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+"
|
||||
branches:
|
||||
- master
|
||||
pull_request: {}
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
name: "Build Windows standalone version"
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: "Checkout the repository"
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: "Build YOGA Windows Standelone Version"
|
||||
run: |
|
||||
winbuild\builddist.bat
|
||||
|
||||
- name: Archive Windows Build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yoga-vX.X.X_win_standalone_x86-64
|
||||
path: yogawin.dist
|
||||
|
||||
linux:
|
||||
name: "Build Linux standalone version"
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: "Checkout the repository"
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: "Build YOGA Linux Standelone Version"
|
||||
run: |
|
||||
linux-bin/build.sh
|
||||
|
||||
- name: "Make the release tarball"
|
||||
run: |
|
||||
mv yoga-bin.dist yoga-v$(python setup.py --version)_linux_standalone_x86-64
|
||||
tar -cvzf yoga-v$(python setup.py --version)_linux_standalone_x86-64.tar.gz yoga-v$(python setup.py --version)_linux_standalone_x86-64
|
||||
|
||||
- name: "Upload Linux tarball"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yoga-vX.X.X_linux_standalone_x86-64
|
||||
path: "yoga-*.tar.gz"
|
|
@ -1,39 +0,0 @@
|
|||
name: "Windows Standalone Build"
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: "v[0-9]+.[0-9]+.[0-9]+"
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
name: "Build Windows standalone version"
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: "Checkout the repository"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: "Get some useful debug information"
|
||||
run: |
|
||||
python -VV
|
||||
python -c "from distutils import ccompiler; print(ccompiler.get_default_compiler())"
|
||||
|
||||
- name: "Build YOGA Windows Standelone Version"
|
||||
run: |
|
||||
winbuild\builddist.bat
|
||||
|
||||
- name: Archive Windows Build
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: yoga-vX.X.X_win_standalone_x86-64
|
||||
path: yogawin.dist
|
|
@ -17,3 +17,5 @@ _*.c*
|
|||
.pytest_cache/
|
||||
*.tags
|
||||
/__misc__/
|
||||
yoga-bin.dist
|
||||
yoga-bin.build
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2017-2021, Wanadev <http://www.wanadev.fr/>
|
||||
Copyright (c) 2017-2024, Wanadev <http://www.wanadev.fr/>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
1272
MANIFEST.in
1272
MANIFEST.in
File diff suppressed because it is too large
Load Diff
35
README.rst
35
README.rst
|
@ -11,8 +11,8 @@ YOGA - Yummy Optimizer for Gorgeous Assets
|
|||
* convert and optimize images from various format to JPEG, PNG and WEBP,
|
||||
* convert and optimize 3D models from various formats to `glTF and GLB`_.
|
||||
|
||||
**Images** are opened using Pillow_ and optimized using Guetzli_ (for JPEGs),
|
||||
Zopflipng_ (for PNGs) and libwebp_ (for WEBPs).
|
||||
**Images** are opened using Pillow_ and optimized using Guetzli_ and MozJPEG_
|
||||
for JPEGs, Zopflipng_ for PNGs and libwebp_ for WEBPs.
|
||||
|
||||
**3D Models** are converted and optimized using assimp_. If models contain or
|
||||
reference images, they are processed by YOGA's image optimizer.
|
||||
|
@ -32,6 +32,7 @@ EXAMPLE: Converting and optimizing a 3D model from CLI::
|
|||
.. _glTF and GLB: https://www.khronos.org/gltf/
|
||||
.. _Pillow: https://github.com/python-pillow/Pillow
|
||||
.. _Guetzli: https://github.com/google/guetzli
|
||||
.. _MozJPEG: https://github.com/mozilla/mozjpeg
|
||||
.. _Zopflipng: https://github.com/google/zopfli
|
||||
.. _libwebp: https://chromium.googlesource.com/webm/libwebp/
|
||||
.. _assimp: https://github.com/assimp/assimp
|
||||
|
@ -56,7 +57,35 @@ Changelog
|
|||
|
||||
* **[NEXT]** (changes on ``master`` that have not been released yet):
|
||||
|
||||
* Nothing yet :)
|
||||
* Nothing yet ;)
|
||||
|
||||
* **v1.3.1-1:**
|
||||
|
||||
* This version has no code change from the v1.3.1. It is only an update of
|
||||
the distribution :
|
||||
|
||||
* A brand new standalone version was build for Linux
|
||||
* The Windows standalone distribution was updated (changes in documentation)
|
||||
|
||||
* dist: Added scripts to build a standalone binary version of YOGA on Linux
|
||||
|
||||
* **v1.3.1:**
|
||||
|
||||
* chore(sdist): Fixed included files in sdist package (@flozz)
|
||||
|
||||
* **v1.3.0:**
|
||||
|
||||
* feat(assimp): Updated assimp to v5.3.1 (fixed build on GCC >= 13) (@flozz)
|
||||
* chore: Removed a script that is no more needed (@flozz)
|
||||
* docs: Updated contributing documentation (libraries, supported Python
|
||||
version, assimp update) (@flozz)
|
||||
|
||||
* **v1.2.3:**
|
||||
|
||||
* Code quality: more robust type comparison (@flozz)
|
||||
* Code quality: cleanup some Python 2.7 specific code (@flozz)
|
||||
* Added Python 3.12 support (@flozz)
|
||||
* Removed Python 3.7 support (@flozz)
|
||||
|
||||
* **v1.2.2:**
|
||||
|
||||
|
|
12
RELEASE.rst
12
RELEASE.rst
|
@ -7,9 +7,8 @@ This file is a memo for the maintainer.
|
|||
0. Checks
|
||||
---------
|
||||
|
||||
* If assimp has been updated, ensure ``./scripts/generate_manifest_in.sh`` has
|
||||
been run, generate an sdist package and check we are able to build a wheel
|
||||
from it.
|
||||
* Check years in ``LICENSE``
|
||||
* Check years in ``docs/conf.py``
|
||||
|
||||
|
||||
1. Release
|
||||
|
@ -29,9 +28,10 @@ Publish source dist and wheels on PyPI.
|
|||
→ Automated :)
|
||||
|
||||
|
||||
4. Publish Github Release
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
3. Publish Github Release
|
||||
-------------------------
|
||||
|
||||
* Make a release on Github
|
||||
* Add changelog
|
||||
* Add Windows standalone build from the CI (``winbuild`` workflow)
|
||||
* Add Windows standalone zip from the CI (``standalone-builds`` workflow)
|
||||
* Add Linux standalone tarball from the CI (``standalone-builds`` workflow)
|
||||
|
|
2
assimp
2
assimp
|
@ -1 +1 @@
|
|||
Subproject commit 21d7085be6b7a3c6912ce33d9931688dc1a4a6dc
|
||||
Subproject commit 6a08c39e3a91ef385e76515cfad86aca4bfd57ff
|
|
@ -18,7 +18,7 @@
|
|||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'YOGA'
|
||||
copyright = '2021, Wanadev'
|
||||
copyright = '2017-2024, Wanadev'
|
||||
author = 'Wanadev'
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ You will need the following dependencies to build YOGA:
|
|||
* GCC with C++ 11 support
|
||||
* GNU Make
|
||||
* cmake
|
||||
* Python >= 3.7 (with headers)
|
||||
* Python >= 3.8 (with headers)
|
||||
* Python setuptools
|
||||
* Python CFFI
|
||||
|
||||
|
@ -96,15 +96,17 @@ Linux as operating system and a POSIX shell (like Bash or ZSH).
|
|||
|
||||
Programming languages used in this project:
|
||||
|
||||
* Python_ (2.7, 3.7, 3.8 and 3.9)
|
||||
* Python_ (3.8 to 3.12)
|
||||
* C++
|
||||
|
||||
Libraries:
|
||||
|
||||
* CFFI_: C/Python binding
|
||||
* imagequant_: Color quantization (to reduce number of colors in an image)
|
||||
* mozjpeg-lossless-optimization_: Lossless JPEG optimization
|
||||
* Pillow_: Image processing library
|
||||
* PyGuetzli_: JPEG optimization
|
||||
* ZopfliPy_: PNG Optimization
|
||||
* ZopfliPy_: PNG optimization
|
||||
|
||||
Development tools:
|
||||
|
||||
|
@ -222,10 +224,11 @@ To run the tests only for a specific Python version, you can use following
|
|||
commands (the corresponding Python interpreter must be installed on your
|
||||
machine)::
|
||||
|
||||
nox -s test-2.7
|
||||
nox -s test-3.7
|
||||
nox -s test-3.8
|
||||
nox -s test-3.9
|
||||
nox -s test-3.10
|
||||
nox -s test-3.11
|
||||
nox -s test-3.12
|
||||
|
||||
YOGA tests are very slow to run (especially the ones related to the image
|
||||
optimization). If you want to run only specific tests, you can run them using
|
||||
|
@ -249,9 +252,37 @@ Then you can run the following command::
|
|||
nox -s gendoc
|
||||
|
||||
|
||||
Updating ASSIMP
|
||||
---------------
|
||||
|
||||
ASSIMP is the C++ library used by YOGA to manipulate 3D models. To update it,
|
||||
first check the latest version tag on the project's repo :
|
||||
|
||||
* https://github.com/assimp/assimp/tags
|
||||
|
||||
Then go to the assimp subfolder and checkout the latest release tag::
|
||||
|
||||
cd assimp/
|
||||
git fetch
|
||||
git checkout vX.Y.Z
|
||||
cd ..
|
||||
|
||||
Then, run tests to ensure YOGA still work::
|
||||
|
||||
nox -s test
|
||||
|
||||
Finally, check we are still able to build a wheel from the sdist package::
|
||||
|
||||
nox -s test_build_wheel
|
||||
|
||||
If the build fails because of a missing file, add it in ``MANIFEST.in``.
|
||||
|
||||
|
||||
.. _Python: https://www.python.org/
|
||||
|
||||
.. _CFFI: https://cffi.readthedocs.io/en/latest/
|
||||
.. _imagequant: https://github.com/wanadev/imagequant-python
|
||||
.. _mozjpeg-lossless-optimization: https://github.com/wanadev/mozjpeg-lossless-optimization
|
||||
.. _Pillow: https://pillow.readthedocs.io/en/stable/
|
||||
.. _PyGuetzli: https://github.com/wanadev/pyguetzli
|
||||
.. _ZopfliPy: https://github.com/hattya/zopflipy
|
||||
|
|
|
@ -11,8 +11,8 @@ Welcome to YOGA's documentation!
|
|||
* convert and optimize images from various format to JPEG, PNG and WEBP,
|
||||
* convert and optimize 3D models from various formats to `glTF and GLB`_.
|
||||
|
||||
**Images** are opened using Pillow_ and optimized using Guetzli_ (for JPEGs),
|
||||
Zopflipng_ (for PNGs) and libwebp_ (for WEBPs).
|
||||
**Images** are opened using Pillow_ and optimized using Guetzli_ and MozJPEG_
|
||||
for JPEGs, Zopflipng_ for PNGs and libwebp_ for WEBPs.
|
||||
|
||||
**3D Models** are converted and optimized using assimp_. If models contain or
|
||||
reference images, they are processed by YOGA's image optimizer.
|
||||
|
@ -20,6 +20,7 @@ reference images, they are processed by YOGA's image optimizer.
|
|||
.. _glTF and GLB: https://www.khronos.org/gltf/
|
||||
.. _Pillow: https://github.com/python-pillow/Pillow
|
||||
.. _Guetzli: https://github.com/google/guetzli
|
||||
.. _MozJPEG: https://github.com/mozilla/mozjpeg
|
||||
.. _Zopflipng: https://github.com/google/zopfli
|
||||
.. _libwebp: https://chromium.googlesource.com/webm/libwebp/
|
||||
.. _assimp: https://github.com/assimp/assimp
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# YOGA binary for Linux
|
||||
|
||||
> YOGA: Yummy Optimizer for Gorgeous Assets
|
||||
|
||||
YOGA is a command-line tool that:
|
||||
|
||||
* converts and optimizes images from various format to JPEG, PNG and WebP,
|
||||
* converts and optimizes 3D models from various formats to glTF and GLB.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
YOGA does not need any installation. Just unzip the content of this archive
|
||||
and you are ready to go! :)
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
YOGA is a CLI (command line) program. To use it, open a terminal in this folder
|
||||
and just use one of the following commands, depending on the terminal you are
|
||||
using.
|
||||
|
||||
./yoga.bin -h
|
||||
|
||||
|
||||
## Links
|
||||
|
||||
Project page and source code:
|
||||
|
||||
* https://github.com/wanadev/yoga
|
||||
|
||||
Documentation:
|
||||
|
||||
* https://wanadev.github.io/yoga/
|
||||
|
||||
Please report any issue on our bug tracker:
|
||||
|
||||
* https://github.com/wanadev/yoga/issues
|
|
@ -0,0 +1,28 @@
|
|||
# YOGA Linux binary
|
||||
|
||||
This forlder contains scripts to compile yoga as an executable binary for Linux.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Python 3.x
|
||||
* Python 3 headers (Debian/Ubuntu: `apt install python3-dev`)
|
||||
* Virtualenv (Debian/Ubuntu: `apt install python3-venv`)
|
||||
* Build tools and CMake (Debian/Ubuntu: `apt install build-essential cmake`)
|
||||
|
||||
|
||||
## Build standalone version from source
|
||||
|
||||
Clone this repository:
|
||||
|
||||
git clone https://github.com/wanadev/yoga.git
|
||||
cd yoga
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
Run the build script (from the root directory of this repository):
|
||||
|
||||
./linux-bin/build.sh
|
||||
|
||||
Once the build finished, you will find the result in the `yoga-bin.dist` folder. To run YOGA, use the `yoga` executable:
|
||||
|
||||
./yoga-bin.dist/yoga.bin -h
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# Create and/or activate the virtual env
|
||||
mkdir -p build/
|
||||
|
||||
if [ ! -d build/__env__/ ] ; then
|
||||
python3 -m venv build/__env__/
|
||||
source build/__env__/bin/activate
|
||||
pip install -r linux-bin/requirements.txt
|
||||
pip install -e .
|
||||
else
|
||||
source build/__env__/bin/activate
|
||||
fi
|
||||
|
||||
|
||||
# Build YOGA
|
||||
python -m nuitka \
|
||||
--standalone \
|
||||
--follow-imports \
|
||||
--include-package=PIL \
|
||||
linux-bin/yoga-bin.py
|
||||
|
||||
|
||||
# Rename YOGA binary
|
||||
mv yoga-bin.dist/yoga-bin.bin yoga-bin.dist/yoga.bin
|
||||
|
||||
|
||||
# Copy additional files
|
||||
cp LICENSE yoga-bin.dist/LICENSE
|
||||
cp linux-bin/README-linux-dist.md yoga-bin.dist/README.md
|
|
@ -0,0 +1 @@
|
|||
nuitka==2.1.2
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from yoga.__main__ import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
12
noxfile.py
12
noxfile.py
|
@ -8,6 +8,8 @@ PYTHON_FILES = [
|
|||
"noxfile.py",
|
||||
]
|
||||
|
||||
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
||||
|
||||
|
||||
@nox.session(reuse_venv=True)
|
||||
def lint(session):
|
||||
|
@ -24,7 +26,7 @@ def lint(session):
|
|||
session.run(
|
||||
"codespell",
|
||||
"-L",
|
||||
"ans,alph",
|
||||
"ans,alph,ccompiler",
|
||||
"doc/",
|
||||
"scripts/",
|
||||
"test/",
|
||||
|
@ -42,13 +44,19 @@ def black_fix(session):
|
|||
session.run("black", *PYTHON_FILES)
|
||||
|
||||
|
||||
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"], reuse_venv=True)
|
||||
@nox.session(python=PYTHON_VERSIONS, reuse_venv=True)
|
||||
def test(session):
|
||||
session.install("pytest")
|
||||
session.install(".")
|
||||
session.run("pytest", "-v", "test")
|
||||
|
||||
|
||||
@nox.session(reuse_venv=False)
|
||||
def test_build_wheel(session):
|
||||
session.install("build")
|
||||
session.run("python", "-m", "build")
|
||||
|
||||
|
||||
@nox.session(reuse_venv=True)
|
||||
def gendoc(session):
|
||||
session.install("sphinx", "sphinx-rtd-theme")
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[tool.black]
|
||||
line-length = 79
|
||||
target-version = ['py37']
|
||||
target-version = ['py38']
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
##
|
||||
## Lists the files to include in sdist distribution. This can be used to
|
||||
## generate the MANIFEST.in contents:
|
||||
##
|
||||
## scripts/generate_manifest_in.sh > MANIFEST.in
|
||||
##
|
||||
|
||||
echo "include README.rst"
|
||||
echo "include LICENSE"
|
||||
|
||||
echo
|
||||
|
||||
find yoga/model -name "*.h" -exec echo "include" "{}" ";"
|
||||
find yoga/model -name "*.c" -exec echo "include" "{}" ";"
|
||||
find yoga/model -name "*.cpp" -exec echo "include" "{}" ";"
|
||||
|
||||
echo
|
||||
|
||||
echo "include assimp/CREDITS"
|
||||
echo "include assimp/LICENSE"
|
||||
echo "include assimp/README.md"
|
||||
echo "include assimp/CMakeLists.txt"
|
||||
find assimp -type f -name "*.in" -exec echo "include" "{}" ";" \
|
||||
| grep -v "^include assimp/\(include\|cmake-modules\|contrib\|test\|doc\)/"
|
||||
find assimp/cmake-modules -type f -exec echo "include" "{}" ";"
|
||||
find assimp/code -type f -exec echo "include" "{}" ";"
|
||||
find assimp/contrib -type f -exec echo "include" "{}" ";" \
|
||||
| grep -v "^include assimp/contrib/gtest"
|
||||
find assimp/include -type f -exec echo "include" "{}" ";"
|
||||
|
||||
echo
|
||||
|
||||
echo "recursive-exclude test *"
|
2
setup.py
2
setup.py
|
@ -72,7 +72,7 @@ if os.path.isfile("README.rst"):
|
|||
|
||||
setup(
|
||||
name="yoga",
|
||||
version="1.2.2",
|
||||
version="1.3.1",
|
||||
description="Yummy Optimizer for Gorgeous Assets",
|
||||
url="https://github.com/wanadev/yoga",
|
||||
project_urls={
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
YOGA is a command-line tool that:
|
||||
|
||||
* converts and optimizes images from various format to JPEG and PNG,
|
||||
* converts and optimizes 3D models from various formats to GLB.
|
||||
* converts and optimizes images from various format to JPEG, PNG and WebP,
|
||||
* converts and optimizes 3D models from various formats to glTF and GLB.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
YOGA does not need any installation. Just unzip the content of this directory
|
||||
YOGA does not need any installation. Just unzip the content of this archive
|
||||
and you are ready to go! :)
|
||||
|
||||
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
* Visual Studio Build Tools (MSVC and MSBuild)
|
||||
|
||||
|
||||
## Build and install from PYPI
|
||||
|
||||
pip install yoga
|
||||
|
||||
|
||||
## Build standalone version from source
|
||||
|
||||
Clone this repository (using Git Bash):
|
||||
|
|
|
@ -1 +1 @@
|
|||
nuitka==0.9
|
||||
nuitka==1.8.3
|
||||
|
|
|
@ -257,7 +257,7 @@ def optimize(input_file, output_file, options={}, verbose=False, quiet=False):
|
|||
options = normalize_options(options)
|
||||
|
||||
# Image as file-like object
|
||||
if type(input_file) is str:
|
||||
if isinstance(input_file, str):
|
||||
image_file = open(input_file, "rb")
|
||||
elif hasattr(input_file, "read") and hasattr(input_file, "seek"):
|
||||
image_file = input_file
|
||||
|
|
|
@ -4,7 +4,7 @@ from PIL import Image
|
|||
|
||||
|
||||
# Since Pillow v9.1.0, constants on the Image object are deprecated and will be
|
||||
# removed in Pillow v10.0.0. This code ansure the compatibility with all
|
||||
# removed in Pillow v10.0.0. This code ensures the compatibility with all
|
||||
# versions.
|
||||
# See: https://pillow.readthedocs.io/en/stable/deprecations.html#constants
|
||||
Transpose = Image
|
||||
|
|
|
@ -177,9 +177,11 @@ def clean_png(data):
|
|||
chunks.append(
|
||||
{
|
||||
"type": "IDAT",
|
||||
"data": idat_zopfli
|
||||
if len(idat_zopfli) <= len(idat_concat)
|
||||
else idat_concat,
|
||||
"data": (
|
||||
idat_zopfli
|
||||
if len(idat_zopfli) <= len(idat_concat)
|
||||
else idat_concat
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -52,10 +52,10 @@ def normalize_options(options=None):
|
|||
if "resize" in options:
|
||||
value = options["resize"]
|
||||
|
||||
if type(value) == bytes:
|
||||
if isinstance(value, bytes):
|
||||
value = value.decode()
|
||||
|
||||
if type(value) in (str, bytes):
|
||||
if isinstance(value, (str, bytes)):
|
||||
value = value.lower()
|
||||
|
||||
if value.isdigit():
|
||||
|
@ -69,7 +69,7 @@ def normalize_options(options=None):
|
|||
elif value != "orig":
|
||||
raise ValueError("Invalid value for 'resize': %s" % value)
|
||||
|
||||
if type(value) in (int, float):
|
||||
if isinstance(value, (int, float)):
|
||||
value = [value, value]
|
||||
|
||||
result["resize"] = value
|
||||
|
@ -80,7 +80,7 @@ def normalize_options(options=None):
|
|||
if "jpeg_quality" in options:
|
||||
value = options["jpeg_quality"]
|
||||
|
||||
if type(value) in (str, bytes):
|
||||
if isinstance(value, (str, bytes)):
|
||||
value = float(value)
|
||||
|
||||
if value > 1:
|
||||
|
@ -97,7 +97,7 @@ def normalize_options(options=None):
|
|||
if "webp_quality" in options:
|
||||
value = options["webp_quality"]
|
||||
|
||||
if type(value) in (str, bytes):
|
||||
if isinstance(value, (str, bytes)):
|
||||
value = float(value)
|
||||
|
||||
if value > 1:
|
||||
|
@ -114,7 +114,7 @@ def normalize_options(options=None):
|
|||
if "opacity_threshold" in options:
|
||||
value = options["opacity_threshold"]
|
||||
|
||||
if type(value) in (str, bytes):
|
||||
if isinstance(value, (str, bytes)):
|
||||
value = float(value)
|
||||
|
||||
if value < 1:
|
||||
|
@ -145,7 +145,7 @@ def normalize_options(options=None):
|
|||
if "quantization_dithering_level" in options:
|
||||
value = options["quantization_dithering_level"]
|
||||
|
||||
if type(value) in (str, bytes):
|
||||
if isinstance(value, (str, bytes)):
|
||||
value = float(value)
|
||||
|
||||
value = max(value, 0.0)
|
||||
|
@ -160,7 +160,7 @@ def normalize_options(options=None):
|
|||
if "quantization_max_colors" in options:
|
||||
value = options["quantization_max_colors"]
|
||||
|
||||
if type(value) in (str, bytes):
|
||||
if isinstance(value, (str, bytes)):
|
||||
value = float(value)
|
||||
|
||||
value = max(value, 1)
|
||||
|
|
|
@ -177,7 +177,6 @@ API
|
|||
---
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
from .assimp import assimp_import_from_bytes, assimp_export_to_bytes
|
||||
|
@ -229,7 +228,7 @@ def optimize(
|
|||
if hasattr(input_file, "name"):
|
||||
root_path = os.path.dirname(os.path.abspath(input_file.name))
|
||||
|
||||
if sys.version_info.major == 2 and type(root_path) is str:
|
||||
if isinstance(root_path, bytes):
|
||||
root_path = root_path.decode("utf-8")
|
||||
|
||||
# input_file -> string (path), bytes, file-like
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
This module contains functions binded from the Assimp C++ API.
|
||||
"""
|
||||
|
||||
|
||||
from ._assimp import lib, ffi
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from ._assimp import ffi
|
||||
|
||||
import io
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
import unidecode
|
||||
|
@ -81,7 +80,7 @@ def extract_files_dictionary(root_path):
|
|||
if root_path is None:
|
||||
return None
|
||||
|
||||
if sys.version_info.major == 2 and type(root_path) is str:
|
||||
if isinstance(root_path, bytes):
|
||||
root_path = root_path.decode("utf-8")
|
||||
|
||||
# Recursive walk of root_path files
|
||||
|
|
|
@ -1 +1 @@
|
|||
VERSION = "1.2.2"
|
||||
VERSION = "1.3.1"
|
||||
|
|
Loading…
Reference in New Issue