Skip to content
Snippets Groups Projects
Commit 4172d5c1 authored by Jenni Rinker's avatar Jenni Rinker
Browse files

restructured from refutils

parent d697073b
No related branches found
No related tags found
1 merge request!7Resolve "Take towerclearance dll from direct download from repo"
This commit is part of merge request !7. Comments created here will be created in the context of that merge request.
...@@ -3,10 +3,9 @@ ...@@ -3,10 +3,9 @@
""" """
import os import os
import shutil import shutil
import subprocess
import sys import sys
from refutils import (base_to_hs2, base_to_step, base_to_turb, delete_dlls, from refutils import base_to_hs2, base_to_step, base_to_turb
clone_repo, get_repo_info) from refutils.dll_utils import get_towerclearance_mblade, clone_dll_repo
if __name__ == '__main__': if __name__ == '__main__':
...@@ -22,8 +21,7 @@ if __name__ == '__main__': ...@@ -22,8 +21,7 @@ if __name__ == '__main__':
dll_list = [('dtu_we_controller.dll', 'dtu_we_controller.dll'), dll_list = [('dtu_we_controller.dll', 'dtu_we_controller.dll'),
('generator_servo.dll', 'generator_servo.dll'), ('generator_servo.dll', 'generator_servo.dll'),
('mech_brake.dll', 'mech_brake.dll'), ('mech_brake.dll', 'mech_brake.dll'),
('servo_with_limits.dll', 'servo_with_limits.dll'), ('servo_with_limits.dll', 'servo_with_limits.dll')]
('towerclearance_mblade.dll', 'towerclearance_mblade.dll')]
# ======= make hawcstab2 and step-wind files ======= # ======= make hawcstab2 and step-wind files =======
htc_base = mod_dir + f'htc/{basename}.htc' htc_base = mod_dir + f'htc/{basename}.htc'
...@@ -45,7 +43,7 @@ if __name__ == '__main__': ...@@ -45,7 +43,7 @@ if __name__ == '__main__':
step_path = mod_dir + f'htc/{basename}_step.htc' step_path = mod_dir + f'htc/{basename}_step.htc'
base_to_step(htc_base, step_path, **kwargs) base_to_step(htc_base, step_path, **kwargs)
# ======= clone dll repo and copy in the ones we need ======= # ======= create/clean control folder =======
control_dir = mod_dir + 'control/' # must end with slash! control_dir = mod_dir + 'control/' # must end with slash!
# delete dlls in control repo # delete dlls in control repo
...@@ -54,27 +52,18 @@ if __name__ == '__main__': ...@@ -54,27 +52,18 @@ if __name__ == '__main__':
except FileNotFoundError: # if control folder doesn't exist, create it except FileNotFoundError: # if control folder doesn't exist, create it
os.mkdir(control_dir) os.mkdir(control_dir)
# ======= download tower clearance =======
get_towerclearance_mblade(folder=control_dir)
# ======= get dlls from binary repo =======
# clone dll repo (will throw error if repo not deleted) # clone dll repo (will throw error if repo not deleted)
clone_repo(dll_git_url, dll_branch) clone_dll_repo(dll_branch)
# copy dlls to control repo # copy dlls to control repo
[shutil.copy('control-win32/' + t[0], control_dir + t[1]) [shutil.copy('control-win32/' + t[0], control_dir + t[1])
for t in dll_list] for t in dll_list]
# delete control binaries
#shutil.rmtree('./control-win32/') # doesn't work on WINDOWS >:(
#subprocess.run(['rmdir', '/s', '/q', 'control-win32'], shell=True, check=True)
# write the git branch and commit to file
#url, branch, commit, date = get_repo_info()
#with open(mod_dir + 'git_version.txt', 'w') as f:
# f.write(f'Git info for {basename} zip file\n')
# f.write('------------------------------------\n')
# f.write('Automatically generated using CI on following repo.\n\n')
# f.write(f'Repo url: {url}\n')
# f.write(f'Branch: {branch}\n')
# f.write(f'Commit: {commit} made on {date}\n')
# ======= make the archive ======= # ======= make the archive =======
shutil.make_archive(zip_name, 'zip', mod_dir) shutil.make_archive(zip_name, 'zip', mod_dir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment