Update:Refractored inflate_bubble

Refractor code to keep with DRY

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2023-12-11 20:01:18 +09:00
parent 08f82a05ea
commit e858f9e0aa
1 changed files with 45 additions and 61 deletions

View File

@ -43,143 +43,127 @@ def set_fusato_structure():
'etc/skel/.config/autostart/', 'etc/skel/.config/autostart/',
'etc/lightdm/lightdm.conf.d/', 'etc/lightdm/lightdm.conf.d/',
] ]
os.chdir(HOME_FOLDER + FUSATO_ROOT) os.chdir(os.path.join(HOME_FOLDER, FUSATO_ROOT))
if os.path.exists('config'): if os.path.exists('config'):
rm_cmd = "sudo rm -r -f config" rm_cmd = "sudo rm -r -f config"
os.system(rm_cmd) os.system(rm_cmd)
os.makedirs('config') os.makedirs('config')
else:
pass
make_bootstrap = ['etc/apt'] make_bootstrap = ['etc/apt']
make_packages = ['package-lists/'] make_packages = ['package-lists/']
make_chfldrs = make_chroot make_chfldrs = make_chroot
for f_f in make_chfldrs: for f_f in make_chfldrs:
os.makedirs(HOME_FOLDER + CHROOT_FOLDER + f_f) os.makedirs(os.path.join(HOME_FOLDER, CHROOT_FOLDER, f_f))
for f_f in make_bootstrap: for f_f in make_bootstrap:
os.makedirs(HOME_FOLDER + BOOTSTRAP_FOLDER + f_f) os.makedirs(os.path.join(HOME_FOLDER, BOOTSTRAP_FOLDER, f_f))
for f_f in make_packages: for f_f in make_packages:
os.makedirs(HOME_FOLDER + PACKAGE_LIST + f_f) os.makedirs(os.path.join(HOME_FOLDER,PACKAGE_LIST, f_f))
# Commonly Shared # Commonly Shared
def make_build_file(base, arch, extension, build_description):
"""
This will get the base, arch, extension, and build, to write the file
"""
file_path = os.path.join(os.path.expanduser(HOME_FOLDER), FUSATO_ROOT,
f'{base}.{arch}{extension}'
)
with open(file_path, 'w', encoding='UTF-8') as f_p:
f_p.write(build_description)
def make_bld_xfce(base,arch): def make_bld_xfce(base,arch):
"""Write the build file""" """Write the xfce build file"""
with open(HOME_FOLDER + FUSATO_ROOT + '/' + base + '.' + arch + 'xfc', make_build_file(base, arch, 'xfc', 'XFCE Build')
'w', encoding='UTF-8') as f_p:
f_p.write('XFCE Build')
def make_bld_gnomeflashback(base,arch): def make_bld_gnomeflashback(base,arch):
"""Write the build file""" """Write the gnome fb build file"""
with open(HOME_FOLDER + FUSATO_ROOT + '/' + base + '.' + arch + 'gfb', make_build_file(base, arch, 'gfb', 'Gnome Flash Back Build')
'w', encoding='UTF-8') as f_p:
f_p.write('Gnome Flash Back Build')
def make_bld_openbox(base,arch): def make_bld_openbox(base,arch):
"""Write the build file""" """Write the openbox build file"""
with open(HOME_FOLDER + FUSATO_ROOT+ '/' + base + '.' + arch + 'opb', make_build_file(base, arch, 'opb', 'OpenBox Build')
'w', encoding='UTF-8') as f_p:
f_p.write('OpenBox Build') # Make the shared package lists files
def make_package_list(file_name, content):
"""Create the package list file with the specified content"""
with open(os.path.join(HOME_FOLDER, PACKAGE_LIST, file_name), 'x',
encoding='UTF-8') as f_p:
f_p.write(content)
def set_general_shared(): def set_general_shared():
""" Create the list for general shared list""" """ Create the list for general shared list"""
with open(HOME_FOLDER + PACKAGE_LIST + 'genshared.list.chroot', 'x', make_package_list('genshared.list.chroot', conf.GENERAL_SHARED_LIST)
encoding='UTF-8') as general_file:
general_file.write(conf.GENERAL_SHARED_LIST)
def set_grub_shared(): def set_grub_shared():
""" Create the list for shared grub list""" """ Create the list for shared grub list"""
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'x', make_package_list('grub.list.chroot', conf.GRUB_LIST_SHARED)
encoding='UTF-8') as system_file:
system_file.write(conf.GRUB_LIST_SHARED)
def set_binary_shared(): def set_binary_shared():
""" Create the shared list for grub binary""" """ Create the shared list for grub binary"""
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'x', make_package_list('installer.list.binary', conf.BINARY_LIST_SHARED)
encoding='UTF-8') as binary_file:
binary_file.write(conf.BINARY_LIST_SHARED)
# Light DM paklage list login window
def set_lightdm(): def set_lightdm():
""" Create the list for the light dm list """ """ Create the list for the light dm list """
with open(HOME_FOLDER + PACKAGE_LIST + 'lightdm.list.chroot', 'x', make_package_list('lightdm.list.chroot', conf.LIGHT_DM_LIST)
encoding='UTF-8') as lightdm_file:
lightdm_file.write(conf.LIGHT_DM_LIST)
# Desktop Environments # Desktop Environments
def set_xfce(): def set_xfce():
""" Create the list for the xfce xfce list""" """ Create the list for the xfce xfce list"""
with open(HOME_FOLDER + PACKAGE_LIST + 'xfce.list.chroot', 'x', make_package_list('xfce.list.chroot', conf.XFCE_LIST)
encoding='UTF-8') as xfce_file:
xfce_file.write(conf.XFCE_LIST)
def set_gfb(): def set_gfb():
""" Create the list for the xfce xfce list""" """ Create the list for the xfce xfce list"""
with open(HOME_FOLDER + PACKAGE_LIST + 'gfb.list.chroot', 'x', make_package_list('gfb.list.chroot', conf.GNOME_FLASHBACK_LIST)
encoding='UTF-8') as gfb_file:
gfb_file.write(conf.GNOME_FLASHBACK_LIST)
# CHROOT Specific # CHROOT Specific
def set_chroot_grub_64(): def set_chroot_grub_64():
""" Append the grub list for 64 bit grub""" """ Append the grub list for 64 bit grub"""
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'a', make_package_list('gfb.list.chroot', conf.GRUB_LIST_64)
encoding='UTF-8') as system_file:
system_file.write(conf.GRUB_LIST_64)
def set_chroot_grub_arm(): def set_chroot_grub_arm():
""" Append the grub list for the ARM grub""" """ Append the grub list for the ARM grub"""
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'a', make_package_list('gfb.list.chroot', conf.GRUB_LIST_ARM64)
encoding='UTF-8') as system_file:
system_file.write(conf.GRUB_LIST_ARM64)
def set_chroot_grub_32(): def set_chroot_grub_32():
""" Append the grub list for the 32 bit grub""" """ Append the grub list for the 32 bit grub"""
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'a', make_package_list('gfb.list.chroot', conf.GRUB_LIST_32)
encoding='UTF-8') as system_file:
system_file.write(conf.GRUB_LIST_32)
# Binary Specific # Binary Specific
def set_binary_64(): def set_binary_64():
""" Create the list for grub binary packages for 64 bit""" """ Create the list for grub binary packages for 64 bit"""
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'a', make_package_list('installer.list.binary', conf.BINARY_LIST_64)
encoding='UTF-8') as binary_file:
binary_file.write(conf.BINARY_LIST_64)
def set_binary_arm(): def set_binary_arm():
""" Create the list for grub binary packages for 64 bit""" """ Create the list for grub binary packages for 64 bit"""
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'a', make_package_list('installer.list.binary', conf.BINARY_LIST_ARM)
encoding='UTF-8') as binary_file:
binary_file.write(conf.BINARY_LIST_ARM)
def set_binary_32(): def set_binary_32():
""" Create the list for grub binary packages for 32 bit""" """ Create the list for grub binary packages for 32 bit"""
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'a', make_package_list('installer.list.binary', conf.BINARY_LIST_32)
encoding='UTF-8') as binary_file:
binary_file.write(conf.BINARY_LIST_32)
# Firmware Specific # Firmware Specific
def set_firmware(): def set_firmware():
""" Create the list for the firmware support for genral ISOs""" """ Create the list for the firmware support for genral ISOs"""
with open(HOME_FOLDER + PACKAGE_LIST + 'firmware.list.chroot', 'x', make_package_list('firmware.list.chroot', conf.FIRMWARE_LIST_32_64)
encoding='UTF-8') as firmware_file:
firmware_file.write(conf.FIRMWARE_LIST_32_64)
def set_firmware_arm(): def set_firmware_arm():
""" Create the list for the firmware support for arm ISOs""" """ Create the list for the firmware support for arm ISOs"""
with open(HOME_FOLDER + PACKAGE_LIST + 'firmware.list.chroot', 'x', make_package_list('firmware.list.chroot', conf.FIRMWARE_LIST_ARM)
encoding='UTF-8') as firmware_file:
firmware_file.write(conf.FIRMWARE_LIST_ARM)