Skip to content

Commit

Permalink
added linux build script
Browse files Browse the repository at this point in the history
  • Loading branch information
dekuNukem committed Sep 28, 2020
1 parent 1149c87 commit e372970
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
43 changes: 43 additions & 0 deletions pc_software/build_linux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
import sys
import shutil

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_linux exception:', e)
exit()

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

print(THIS_VERSION)
py_file_list = [x for x in os.listdir('.') if x.endswith('.py')]
py_file_list = [x for x in py_file_list if 'build_' not in x.lower() and 'setup.py' not in x.lower()]
print(py_file_list)

output_dir_name = "duckypad_config_" + THIS_VERSION + "_source"
if os.path.isdir(output_dir_name):
shutil.rmtree(output_dir_name)
os.mkdir(output_dir_name)
output_dir_path = os.path.join('.', output_dir_name)
print(output_dir_path)

for item in py_file_list:
shutil.copy(item, output_dir_path)

zip_file_name = "duckypad_config_" + THIS_VERSION + "_source.zip"
os.system('7z.exe a ' + zip_file_name + ' -r ' + output_dir_path)
if os.path.isdir(output_dir_path):
shutil.rmtree(output_dir_path)
2 changes: 1 addition & 1 deletion pc_software/build_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
THIS_VERSION = line.replace('\n', '').replace('\r', '').split("'")[-2]
mainfile.close()
except Exception as e:
print('build_windows exception:', e)
print('build_mac exception:', e)
exit()

if THIS_VERSION is None:
Expand Down
Binary file modified sample_profiles.zip
Binary file not shown.

0 comments on commit e372970

Please sign in to comment.