瀏覽代碼

try pyinstaller

Thomas Buck 3 年之前
父節點
當前提交
85bde368e0
共有 4 個檔案被更改,包括 44 行新增34 行删除
  1. 27
    2
      .github/workflows/build.yml
  2. 16
    0
      build_linux.sh
  3. 1
    1
      build_win.sh
  4. 0
    31
      dist/setup_win.py

+ 27
- 2
.github/workflows/build.yml 查看文件

@@ -16,7 +16,7 @@ jobs:
16 16
       run: |
17 17
         python -m pip install --upgrade pip
18 18
         pip install PyQt5
19
-        pip install py2exe
19
+        pip install py2app
20 20
     - name: Run Mac build
21 21
       run: |
22 22
         ./build_mac.sh
@@ -26,6 +26,7 @@ jobs:
26 26
         name: octotray_mac
27 27
         path: |
28 28
           ${{ github.workspace }}/build/dist/OctoTray_Mac.zip
29
+
29 30
   build_windows:
30 31
     runs-on: windows-latest
31 32
     steps:
@@ -39,7 +40,7 @@ jobs:
39 40
       run: |
40 41
         python -m pip install --upgrade pip
41 42
         pip install PyQt5
42
-        pip install py2exe
43
+        pip install pyinstaller
43 44
       shell: bash
44 45
     - name: Run Windows build
45 46
       run: |
@@ -54,3 +55,27 @@ jobs:
54 55
         name: octotray_win
55 56
         path: |
56 57
           ${{ github.workspace }}/build/dist/OctoTray_Win.zip
58
+
59
+  build_linux:
60
+    runs-on: ubuntu-latest
61
+    steps:
62
+    - name: Checkout repository
63
+      uses: actions/checkout@v2
64
+    - name: Install Python Environment
65
+      uses: actions/setup-python@v2
66
+      with:
67
+        python-version: 3.8
68
+    - name: Install dependencies
69
+      run: |
70
+        python -m pip install --upgrade pip
71
+        pip install PyQt5
72
+        pip install pyinstaller
73
+    - name: Run Linux build
74
+      run: |
75
+        ./build_linux.sh
76
+    - name: Archive build result artifacts
77
+      uses: actions/upload-artifact@v2
78
+      with:
79
+        name: octotray_linux
80
+        path: |
81
+          ${{ github.workspace }}/build/dist/OctoTray_Linux.zip

+ 16
- 0
build_linux.sh 查看文件

@@ -0,0 +1,16 @@
1
+#!/bin/sh
2
+
3
+rm -rf build/linux
4
+mkdir -p build/linux
5
+
6
+cp src/* build/linux/
7
+cp data/* build/linux/
8
+
9
+cd build/linux
10
+pyinstaller --noconfirm --onefile --name=OctoTray --windowed --add-data="octotray_icon.png:." octotray.py
11
+
12
+zip -r OctoTray_Linux.zip dist/*
13
+
14
+cd ../..
15
+mkdir -p build/dist/linux
16
+cp -r build/linux/OctoTray_Linux.zip build/dist/linux/

+ 1
- 1
build_win.sh 查看文件

@@ -8,7 +8,7 @@ cp data/* build/win/
8 8
 cp dist/setup_win.py build/win/
9 9
 
10 10
 cd build/win
11
-python setup_win.py py2exe
11
+pyinstaller --noconfirm --onefile --name=OctoTray --windowed --add-data="octotray_icon.png:." octotray.py
12 12
 
13 13
 cd ../..
14 14
 mkdir -p build/dist/win

+ 0
- 31
dist/setup_win.py 查看文件

@@ -1,31 +0,0 @@
1
-#!/usr/bin/env python
2
-# -*- coding: utf-8 -*-
3
-
4
-import py2exe
5
-from distutils.core import setup
6
-
7
-APP_NAME = "OctoTray"
8
-APP = [ 'octotray.py' ]
9
-DATA_FILES = [ 'octotray_icon.png' ]
10
-VERSION="0.3"
11
-
12
-includes = [
13
-    "PyQt5",
14
-    "PyQt5.QtCore",
15
-    "PyQt5.QtGui",
16
-    "PyQt5.QtNetwork",
17
-    "PyQt5.QtWidgets"
18
-]
19
-
20
-OPTIONS = {
21
-    "bundle_files": 1,
22
-    "includes": includes
23
-}
24
-
25
-setup(
26
-    name=APP_NAME,
27
-    version=VERSION,
28
-    windows=[ { "script": "octotray.py" } ],
29
-    data_files=DATA_FILES,
30
-    options={ 'py2exe': OPTIONS }
31
-)

Loading…
取消
儲存