Skip to content

Commit

Permalink
added macOS build script
Browse files Browse the repository at this point in the history
  • Loading branch information
dekuNukem committed Sep 17, 2020
1 parent 957f83e commit 7f14943
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 7 deletions.
50 changes: 50 additions & 0 deletions pc_software/build_mac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import os
import sys

"""
https://py2app.readthedocs.io/en/latest/tutorial.html
OPTIONS = {'iconfile':'icon.icns'}
rm -rf build dist
python3.8 setup.py py2app
"""

if 'darwin' not in sys.platform:
print("this script is for macOS only!")
exit()

os.system('rm -rfv ./__pycache__')
os.system('rm -rfv ./build')
os.system('rm -rfv ./dist')
os.system('rm -rfv ./*.zip')

THIS_VERSION = None
try:
mainfile = open('duckypad_config.py')
for line in mainfile:
if "THIS_VERSION_NUMBER =" in line:
THIS_VERSION = line.replace('\n', '').replace('\r', '').split("'")[-2]
mainfile.close()
except Exception as e:
print('build_windows exception:', e)
exit()

if THIS_VERSION is None:
print('could not find version number!')
exit()

print(THIS_VERSION)
os.system("python3 setup.py py2app")

output_folder_path = os.path.join('.', "dist")
original_name = os.path.join(output_folder_path, "duckypad_config.app")
new_name = os.path.join(output_folder_path, "duckypad_config_" + THIS_VERSION + "_macOS.app")

print(original_name)
print(new_name)

os.rename(original_name, new_name)
zip_file_name = "duckypad_config_" + THIS_VERSION + "_macOS.zip"
os.system('cd dist; zip -rv ' + zip_file_name + ' ' + new_name.split('/')[-1] + "; mv " + zip_file_name + " ../")
4 changes: 4 additions & 0 deletions pc_software/build_windows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import os
import sys

if 'win32' not in sys.platform:
print("this script is for windows only!")
exit()

# add C:\Program Files\7-Zip to windows environment variable first!
# or export PATH=$PATH:"C:\Program Files\7-Zip"

Expand Down
7 changes: 0 additions & 7 deletions pc_software/mac_build_instructions.txt

This file was deleted.

Binary file modified sample_profiles.zip
Binary file not shown.

0 comments on commit 7f14943

Please sign in to comment.