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
+ input_archive_path = f"{ os .getenv ('BUILD_STAGINGDIRECTORY' )} )/vscode-arduino.vsix"
5
+ output_archive_path = f"{ os .getenv ('BUILD_STAGINGDIRECTORY' )} )/vscode-arduino-out.vsix"
6
+
7
+ filenames = [
8
+ "extension/out/serial-monitor-cli/darwin/main" ,
9
+ "extension/out/serial-monitor-cli/linux/main"
10
+ ]
11
+
12
+ input_archive = zipfile .ZipFile (input_archive_path , 'r' )
13
+ output_archive = zipfile .ZipFile (output_archive_path , 'w' )
14
+
15
+ executable_count = 0
16
+ for info in input_archive .infolist ():
17
+ data = input_archive .read (info )
18
+ if info .filename in filenames :
19
+ # Magic number from from https://stackoverflow.com/a/48435482
20
+ info .external_attr = 0o100755 << 16
21
+ executable_count += 1
22
+ output_archive .writestr (info , data )
23
+
24
+ if executable_count != len (filenames ):
25
+ raise Exception (f'Expected to find { len (filenames )} executables but only found { executable_count } ' )
26
+
27
+ input_archive .close ()
28
+ output_archive .close ()
29
+
30
+ os .replace (output_archive_path , input_archive_path )
31
+ os .remove (output_archive_path )
You can’t perform that action at this time.
0 commit comments