Skip to content

Commit

Permalink
Created function for extracting arm-gcc-none-eabi version name from z…
Browse files Browse the repository at this point in the history
…ip package.
  • Loading branch information
sakoPO committed Sep 6, 2018
1 parent 1abda25 commit b931b19
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions scripts/windows_installer_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def compile_online_installer():
download7zipStandaloneConsoleVersion() # needed to unpack repositories while installing on windows

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

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

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

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

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

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

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


def get_gcc_arm_none_eabi_name(filename):
return re.sub('-win32(-sha2)?\.(exe|zip)', '', filename)


def download7zipStandaloneConsoleVersion():
filename = '7z1604-extra.7z'
dest = '../norepo/windows'
Expand Down

0 comments on commit b931b19

Please sign in to comment.