Skip to content

Commit

Permalink
Merge pull request #2 from ericjohnson97/build_updates
Browse files Browse the repository at this point in the history
Build Updates
  • Loading branch information
ericjohnson97 authored Mar 11, 2023
2 parents 080e8ee + 71c2ddc commit 5869646
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 33 deletions.
29 changes: 7 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build_linux:
runs-on: ubuntu-latest
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04, windows-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -21,24 +24,6 @@ jobs:

- uses: actions/upload-artifact@v3
with:
name: iq_sim_client_linux
path: iq_sim_client_linux.zip
if-no-files-found: error

build_windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Install Pip Packages
run: pip install -r requirements.txt

- name: Run a Python script
run: python generate_executable.py

- uses: actions/upload-artifact@v3
with:
name: iq_sim_client_windows
path: iq_sim_client_windows.zip
name: iq_sim_client_${{ matrix.os }}
path: iq_sim_client
if-no-files-found: error
9 changes: 9 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
import requests
import subprocess
import os
import distro
from sys import platform


# check if distro is ubuntu 22.04
distro = distro.name(pretty=True).replace(" ", "_").replace(".", "_")
print(distro)
if "22_04" in distro:
print("setting qt platform to wayland")
os.environ['QT_QPA_PLATFORM'] = "wayland"


class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
mavp2p_process = None
api_ip = "intelligentquads.com"
Expand Down
33 changes: 24 additions & 9 deletions generate_executable.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import shutil
from sys import platform
import sys
import platform
import distro
import argparse


def main():
def main(zip):
try:
shutil.rmtree("iq_sim_client")
except:
Expand All @@ -14,23 +16,36 @@ def main():
except:
print("no file iq_sim_client.zip")

if platform == "linux" or platform == "linux2":
if sys.platform == "linux" or sys.platform == "linux2":
shutil.copytree("mavp2p/mavp2p_linux",
"iq_sim_client/mavp2p/mavp2p_linux")
output_filename = "iq_sim_client_linux"
elif platform == "darwin":
distro_name = distro.name(pretty=True).replace(" ", "_").replace(".", "_")
print(distro_name)
output_filename = output_filename + "_" + distro_name
elif sys.platform == "darwin":
print("todo")
return
elif platform == "win32":
elif sys.platform == "win32":
shutil.copytree("mavp2p/mavp2p_windows",
"iq_sim_client/mavp2p/mavp2p_windows")
output_filename = "iq_sim_client_windows"

os.system("pyinstaller -F app.py --distpath iq_sim_client")

shutil.copytree("imgs", "iq_sim_client/imgs")
shutil.make_archive(output_filename, 'zip', "iq_sim_client")

if zip:
print("zipping application")
shutil.make_archive(output_filename, 'zip', "iq_sim_client")
else:
print("not zipping application")

if __name__ == "__main__":
main()
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("--zip", help="zip the executable", action="store_true")

args = parser.parse_args()


main(args.zip)
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
distro==1.8.0
PyQt5==5.15.7
requests==2.22.0
pyinstaller==5.3
requests==2.28.1
pyinstaller==5.3
argparse==1.4.0

0 comments on commit 5869646

Please sign in to comment.