Skip to content

Commit 51abf53

Browse files
vaibhavxlrpre-commit-ci[bot]cobaltt7
authored
fix: add conditional stripping for Linux executables (#5223)
* fix: add conditional stripping for Linux executables (#2291) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Apply suggestion from @cobaltt7 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
1 parent 513058f commit 51abf53

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/publish_binaries.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,27 @@ jobs:
2323
pathsep: ";"
2424
asset_name: black_windows.exe
2525
executable_mime: "application/vnd.microsoft.portable-executable"
26+
strip: false
2627
- os: windows-11-arm
2728
pathsep: ";"
2829
asset_name: black_windows-arm.exe
2930
executable_mime: "application/vnd.microsoft.portable-executable"
31+
strip: false
3032
- os: ubuntu-latest
3133
pathsep: ":"
3234
asset_name: black_linux
3335
executable_mime: "application/x-executable"
36+
strip: true
3437
- os: ubuntu-24.04-arm
3538
pathsep: ":"
3639
asset_name: black_linux-arm
3740
executable_mime: "application/x-executable"
41+
strip: true
3842
- os: macos-latest
3943
pathsep: ":"
4044
asset_name: black_macos
4145
executable_mime: "application/x-mach-binary"
46+
strip: false
4247
permissions:
4348
contents: write # Needed to upload to release
4449

@@ -56,8 +61,9 @@ jobs:
5661

5762
- name: Build executable with PyInstaller
5863
run:
59-
python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data
60-
'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py
64+
python -m PyInstaller -F ${{ matrix.strip && '--strip' || '' }} --name ${{
65+
matrix.asset_name }} --add-data 'src/blib2to3${{ matrix.pathsep }}blib2to3'
66+
src/black/__main__.py
6167

6268
- name: Quickly test executable
6369
run: |

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868

6969
<!-- Changes to how Black is packaged, such as dependency requirements -->
7070

71+
- Reduce the size of Linux standalone binaries by stripping debug symbols during the
72+
PyInstaller release build (#5223)
73+
7174
### Parser
7275

7376
<!-- Changes to the parser or to version autodetection -->

0 commit comments

Comments
 (0)