Skip to content

Commit b931b19

Browse files
committed
Created function for extracting arm-gcc-none-eabi version name from zip package.
1 parent 1abda25 commit b931b19

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

scripts/windows_installer_creator.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def compile_online_installer():
4444
download7zipStandaloneConsoleVersion() # needed to unpack repositories while installing on windows
4545

4646
# include toolchain patch files into installer, firstly copy patch files into proper directory
47-
patchDirectoryName = re.sub('-win32(-sha2)?\.(exe|zip)', '',
48-
packages.toolchains['gcc-arm-none-eabi']['gcc-arm-none-eabi-7-2018-q2-update'][
49-
'windows']['filename'])
47+
patchDirectoryName = get_gcc_arm_none_eabi_name(
48+
packages.toolchains['gcc-arm-none-eabi']['gcc-arm-none-eabi-7-2018-q2-update'][
49+
'windows']['filename'])
5050
shutil.copytree('../toolchains/gcc-arm-none-eabi-patch/' + patchDirectoryName,
5151
'../norepo/windows/toolchainPatch/' + patchDirectoryName)
5252

@@ -60,11 +60,11 @@ def compile_offline_installer():
6060
components_dir = '../norepo/windows/components'
6161

6262
# include toolchain patch files into installer, firstly copy patch files into proper directory
63-
patchDirectoryName = re.sub('-win32(-sha2)?\.(exe|zip)', '',
64-
packages.toolchains['gcc-arm-none-eabi']['gcc-arm-none-eabi-7-2018-q2-update'][
65-
'windows']['filename'])
63+
patchDirectoryName = get_gcc_arm_none_eabi_name(
64+
packages.toolchains['gcc-arm-none-eabi']['gcc-arm-none-eabi-7-2018-q2-update'][
65+
'windows']['filename'])
6666
dir_util.copy_tree('../toolchains/gcc-arm-none-eabi-patch/' + patchDirectoryName,
67-
components_dir + '/gcc_arm_none_eabi')
67+
components_dir + '/gcc_arm_none_eabi')
6868

6969
fs.copyfile('inno setup/microide_offline.iss', '../norepo/windows/microide_offline.iss')
7070
print("Compiling offline installer...")
@@ -77,8 +77,8 @@ def generateWindowsProductSetup():
7777
content = file.read()
7878

7979
# gcc_arm_none_eabi = packages.toolchains['gcc-arm-none-eabi']['gcc-arm-none-eabi-7-2018-q2-update']['windows']
80-
toolchainPatch = gcc_arm_none_eabi['installationLocation'].replace('{app}', 'microideDir') + '/' + re.sub(
81-
'-.{5,6}-win32\.(exe|zip)', '', gcc_arm_none_eabi['filename'])
80+
toolchainPatch = gcc_arm_none_eabi['installationLocation'].replace('{app}', 'microideDir') + '/' + \
81+
get_gcc_arm_none_eabi_name(gcc_arm_none_eabi['filename'])
8282
content = content.replace("##microideToolchainPatch##", toolchainPatch.replace('\\', '/'))
8383

8484
# clang = packages.toolchains['clang']['6.0.1']['windows']
@@ -110,8 +110,8 @@ def generateInnoSetupFile(microide_version, destination):
110110
file.write('#define ARM_GCC_TOOLCHAIN_FILENAME "' + gcc_arm_none_eabi['filename'] + '"\n')
111111
file.write('#define ARM_GCC_TOOLCHAIN_VERSION "' + gcc_arm_none_eabi['version'] + '"\n')
112112
file.write('#define ARM_GCC_TOOLCHAIN_SIZE ' + str(gcc_arm_none_eabi['installation size']) + '\n')
113-
file.write('#define ARM_GCC_TOOLCHAIN_LOCATION "' + gcc_arm_none_eabi['installationLocation'] + '\\' + re.sub(
114-
'-win32(-sha2)?\.(exe|zip)', '', gcc_arm_none_eabi['filename']) + '"\n')
113+
file.write('#define ARM_GCC_TOOLCHAIN_LOCATION "' + gcc_arm_none_eabi[
114+
'installationLocation'] + '\\' + get_gcc_arm_none_eabi_name(gcc_arm_none_eabi['filename']) + '"\n')
115115
file.write('#define ARM_GCC_TOOLCHAIN_CHECKSUM_MD5 "' + gcc_arm_none_eabi['checksum']['md5'] + '"\n')
116116
file.write('\n')
117117

@@ -168,6 +168,10 @@ def generateInnoSetupFile(microide_version, destination):
168168
file.write('\n')
169169

170170

171+
def get_gcc_arm_none_eabi_name(filename):
172+
return re.sub('-win32(-sha2)?\.(exe|zip)', '', filename)
173+
174+
171175
def download7zipStandaloneConsoleVersion():
172176
filename = '7z1604-extra.7z'
173177
dest = '../norepo/windows'

0 commit comments

Comments
 (0)