Skip to content

Commit

Permalink
Add executable generation
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Jul 23, 2023
1 parent 85e9021 commit 51c0f15
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/exe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: WeasyPrint’s exe generation
on: [push]

jobs:
generate:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-20.04', 'macos-11', 'windows-2019']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Use absolute imports
if: matrix.os == 'ubuntu-20.04'
run: |
sed -i 's/^from \. /from weasyprint /' weasyprint/__main__.py
sed -i 's/^from \./from weasyprint\./' weasyprint/__main__.py
- name: Use absolute imports and install Pango (MacOS)
if: matrix.os == 'macos-11'
run: |
sed -i '' 's/^from \. /from weasyprint /' weasyprint/__main__.py
sed -i '' 's/^from \./from weasyprint\./' weasyprint/__main__.py
rm /usr/local/bin/2to3
brew install pango
- name: Use absolute imports and install Pango (Windows)
if: matrix.os == 'windows-2019'
run: |
(Get-Content weasyprint/__main__.py).replace('^from \. ', 'from weasyprint ').replace('^from \.', 'from weasyprint\.') | Set-Content weasyprint/__main__.py
C:\msys64\usr\bin\bash -lc 'pacman -S mingw-w64-x86_64-pango --noconfirm'
rm C:\msys64\mingw64\bin\python.exe
- name: Install requirements
run: python -m pip install . pyinstaller
- name: Generate executable
run: python -m PyInstaller weasyprint/__main__.py -n weasyprint -F
- name: Test executable
run: dist/weasyprint --help
- name: Store executable
uses: actions/upload-artifact@v3
with:
name: weasyprint
path: |
dist/weasyprint
README.rst
LICENSE

0 comments on commit 51c0f15

Please sign in to comment.