From ef50eccfae5d2491bd450b4aec0c22a30da96160 Mon Sep 17 00:00:00 2001 From: Jameel Al-Aziz Date: Tue, 31 Aug 2021 04:10:21 -0700 Subject: [PATCH 1/2] Add hidden import to PyInstaller build Add new platformdirs dependency as a hidden import when creating PyInstaller based binaries. --- .github/workflows/upload_binary.yml | 7 +++++-- CHANGES.md | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upload_binary.yml b/.github/workflows/upload_binary.yml index 766f37cc321..6156051b64b 100644 --- a/.github/workflows/upload_binary.yml +++ b/.github/workflows/upload_binary.yml @@ -40,8 +40,11 @@ jobs: python -m pip install pyinstaller - name: Build binary - run: | - python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data 'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py + run: > + python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data + 'src/blib2to3${{ matrix.pathsep }}blib2to3' --hidden-import platformdirs.unix + --hidden-import platformdirs.macos --hidden-import platformdirs.windows + src/black/__main__.py - name: Upload binary as release asset uses: actions/upload-release-asset@v1 diff --git a/CHANGES.md b/CHANGES.md index 576e3c84882..ef0a57d6142 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Change Log +## Unreleased + +### Packaging + +- Fix missing modules in self-contained binaries (#2466) + ## 21.8b0 ### _Black_ From 07f6998897c11e865cb958967ebb696b950fff2c Mon Sep 17 00:00:00 2001 From: Jameel Al-Aziz Date: Tue, 31 Aug 2021 15:40:27 -0700 Subject: [PATCH 2/2] Only include the platformdirs for the relevant os --- .github/workflows/upload_binary.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upload_binary.yml b/.github/workflows/upload_binary.yml index 6156051b64b..8f44d4ec27b 100644 --- a/.github/workflows/upload_binary.yml +++ b/.github/workflows/upload_binary.yml @@ -16,14 +16,17 @@ jobs: pathsep: ";" asset_name: black_windows.exe executable_mime: "application/vnd.microsoft.portable-executable" + platform: windows - os: ubuntu-20.04 pathsep: ":" asset_name: black_linux executable_mime: "application/x-executable" + platform: unix - os: macos-latest pathsep: ":" asset_name: black_macos executable_mime: "application/x-mach-binary" + platform: macos steps: - uses: actions/checkout@v2 @@ -42,9 +45,8 @@ jobs: - name: Build binary run: > python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data - 'src/blib2to3${{ matrix.pathsep }}blib2to3' --hidden-import platformdirs.unix - --hidden-import platformdirs.macos --hidden-import platformdirs.windows - src/black/__main__.py + 'src/blib2to3${{ matrix.pathsep }}blib2to3' --hidden-import platformdirs.${{ + matrix.platform }} src/black/__main__.py - name: Upload binary as release asset uses: actions/upload-release-asset@v1