From 4172d5c1d7c4ee837461c84a42f21b54b42f35cb Mon Sep 17 00:00:00 2001
From: Jenni Rinker <rink@win.dtu.dk>
Date: Fri, 4 Sep 2020 20:22:24 +0200
Subject: [PATCH 1/2] restructured from refutils

---
 utils/prepare_zip_file.py | 31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/utils/prepare_zip_file.py b/utils/prepare_zip_file.py
index 63e0623..524b920 100644
--- a/utils/prepare_zip_file.py
+++ b/utils/prepare_zip_file.py
@@ -3,10 +3,9 @@
 """
 import os
 import shutil
-import subprocess
 import sys
-from refutils import (base_to_hs2, base_to_step, base_to_turb, delete_dlls,
-                      clone_repo, get_repo_info)
+from refutils import base_to_hs2, base_to_step, base_to_turb
+from refutils.dll_utils import get_towerclearance_mblade, clone_dll_repo
 
 
 if __name__ == '__main__':
@@ -22,8 +21,7 @@ if __name__ == '__main__':
     dll_list = [('dtu_we_controller.dll', 'dtu_we_controller.dll'),
                 ('generator_servo.dll', 'generator_servo.dll'),
                 ('mech_brake.dll', 'mech_brake.dll'),
-                ('servo_with_limits.dll', 'servo_with_limits.dll'),
-                ('towerclearance_mblade.dll', 'towerclearance_mblade.dll')]
+                ('servo_with_limits.dll', 'servo_with_limits.dll')]
 
     # ======= make hawcstab2 and step-wind files =======
     htc_base = mod_dir + f'htc/{basename}.htc'
@@ -45,7 +43,7 @@ if __name__ == '__main__':
     step_path = mod_dir + f'htc/{basename}_step.htc'
     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!
 
     # delete dlls in control repo
@@ -54,27 +52,18 @@ if __name__ == '__main__':
     except FileNotFoundError:  # if control folder doesn't exist, create it
         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_repo(dll_git_url, dll_branch)
+    clone_dll_repo(dll_branch)
 
     # copy dlls to control repo
     [shutil.copy('control-win32/' + t[0], control_dir + t[1])
      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 =======
     shutil.make_archive(zip_name, 'zip', mod_dir)
 
-- 
GitLab


From ac7d86b1d7208bc86af09b04293c6e1b33f17158 Mon Sep 17 00:00:00 2001
From: Jenni Rinker <rink@win.dtu.dk>
Date: Fri, 4 Sep 2020 20:35:14 +0200
Subject: [PATCH 2/2] make zip always

---
 .gitlab-ci.yml            | 4 ----
 utils/prepare_zip_file.py | 4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 94ac82b..c0ff9f6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,10 +10,6 @@ make_32bit_zip:
     tags:
 #    - CPAV_old
      - python
-    only:
-     - tags
-     - release*
-     - make_zip
 
 # see deepwind repo for configuring report/zip compilation
 
diff --git a/utils/prepare_zip_file.py b/utils/prepare_zip_file.py
index 524b920..8313946 100644
--- a/utils/prepare_zip_file.py
+++ b/utils/prepare_zip_file.py
@@ -4,8 +4,8 @@
 import os
 import shutil
 import sys
-from refutils import base_to_hs2, base_to_step, base_to_turb
-from refutils.dll_utils import get_towerclearance_mblade, clone_dll_repo
+from refutils.htc_conversion import base_to_hs2, base_to_step, base_to_turb
+from refutils.dll_utils import get_towerclearance_mblade, clone_dll_repo, delete_dlls
 
 
 if __name__ == '__main__':
-- 
GitLab