This repository was archived by the owner on Oct 1, 2024. It is now read-only.
File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ steps:
115
115
includeRootFolder : false
116
116
archiveType : zip
117
117
archiveFile : $(Build.StagingDirectory)\vscode-arduino.vsix
118
+ - script : python .\build\markExecutableFiles.py
119
+ displayName : Make serial monitor executable
118
120
- task : MSBuild@1
119
121
displayName : Sign VSIX
120
122
inputs :
Original file line number Diff line number Diff line change
1
+ import os
2
+ import zipfile
3
+
4
+ staging_directory = os .getenv ('BUILD_STAGINGDIRECTORY' )
5
+ input_archive_path = f"{ staging_directory } /vscode-arduino.vsix"
6
+ output_archive_path = f"{ staging_directory } /vscode-arduino-out.vsix"
7
+
8
+ filenames = [
9
+ "extension/out/serial-monitor-cli/darwin/main" ,
10
+ "extension/out/serial-monitor-cli/linux/main"
11
+ ]
12
+
13
+ input_archive = zipfile .ZipFile (input_archive_path , 'r' )
14
+ output_archive = zipfile .ZipFile (output_archive_path , 'w' )
15
+
16
+ executable_count = 0
17
+ for info in input_archive .infolist ():
18
+ data = input_archive .read (info )
19
+ if info .filename in filenames :
20
+ # Magic number from from https://stackoverflow.com/a/48435482
21
+ info .external_attr = 0o100755 << 16
22
+ executable_count += 1
23
+ output_archive .writestr (info , data )
24
+
25
+ if executable_count != len (filenames ):
26
+ raise Exception (f'Expected to find { len (filenames )} executables but only found { executable_count } ' )
27
+
28
+ input_archive .close ()
29
+ output_archive .close ()
30
+
31
+ os .replace (output_archive_path , input_archive_path )
You can’t perform that action at this time.
0 commit comments