Reduced imports
This commit is contained in:
parent
1a8b6705e0
commit
d33f78960d
3 changed files with 15 additions and 12 deletions
|
|
@ -9,6 +9,7 @@ import sys
|
||||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from docopt import docopt
|
from docopt import docopt
|
||||||
|
from functions.common import *
|
||||||
from functions.ufd import *
|
from functions.ufd import *
|
||||||
from settings.ufd import *
|
from settings.ufd import *
|
||||||
init_global_vars()
|
init_global_vars()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
# Wizard Kit: Functions - UFD
|
# Wizard Kit: Functions - UFD
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
import pathlib
|
import pathlib
|
||||||
from functions.common import *
|
|
||||||
|
|
||||||
|
|
||||||
def case_insensitive_search(path, item):
|
def case_insensitive_search(path, item):
|
||||||
|
|
@ -27,11 +29,11 @@ def case_insensitive_search(path, item):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
if real_path:
|
if not real_path:
|
||||||
return real_path
|
|
||||||
else:
|
|
||||||
raise FileNotFoundError('{}/{}'.format(path, item))
|
raise FileNotFoundError('{}/{}'.format(path, item))
|
||||||
|
|
||||||
|
return real_path
|
||||||
|
|
||||||
|
|
||||||
def find_path(path):
|
def find_path(path):
|
||||||
"""Find path case-insensitively, returns pathlib.Path obj."""
|
"""Find path case-insensitively, returns pathlib.Path obj."""
|
||||||
|
|
@ -103,7 +105,7 @@ def recursive_copy(source, dest, overwrite=True):
|
||||||
shutil.copytree(source, dest)
|
shutil.copytree(source, dest)
|
||||||
elif not dest.is_dir():
|
elif not dest.is_dir():
|
||||||
# Refusing to replace file with dir
|
# Refusing to replace file with dir
|
||||||
raise GenericError('Refusing to replace file with dir: {}'.format(dest))
|
raise FileExistsError('Refusing to replace file: {}'.format(dest))
|
||||||
else:
|
else:
|
||||||
# Dest exists and is a dir, merge dirs
|
# Dest exists and is a dir, merge dirs
|
||||||
for item in os.scandir(source):
|
for item in os.scandir(source):
|
||||||
|
|
@ -114,14 +116,14 @@ def recursive_copy(source, dest, overwrite=True):
|
||||||
shutil.copy2(source, dest)
|
shutil.copy2(source, dest)
|
||||||
elif not dest.is_file():
|
elif not dest.is_file():
|
||||||
# Refusing to replace dir with file
|
# Refusing to replace dir with file
|
||||||
raise GenericError('Refusing to replace dir with file: {}'.format(dest))
|
raise FileExistsError('Refusing to replace dir: {}'.format(dest))
|
||||||
elif overwrite:
|
elif overwrite:
|
||||||
# Dest file exists, deleting and replacing file
|
# Dest file exists, deleting and replacing file
|
||||||
os.remove(dest)
|
os.remove(dest)
|
||||||
shutil.copy2(source, dest)
|
shutil.copy2(source, dest)
|
||||||
else:
|
else:
|
||||||
# Refusing to delete file when overwrite=False
|
# Refusing to delete file when overwrite=False
|
||||||
raise GenericError('Refusing to delete file: {}'.format(dest))
|
raise FileExistsError('Refusing to delete file: {}'.format(dest))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
# Wizard Kit: Settings - UFD
|
'''Wizard Kit: Settings - UFD'''
|
||||||
|
# pylint: disable=C0326,E0611
|
||||||
|
# vim: sts=2 sw=2 ts=2
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from settings.main import *
|
from settings.main import KIT_NAME_FULL,KIT_NAME_SHORT
|
||||||
|
|
||||||
# General
|
# General
|
||||||
DOCSTRING = '''WizardKit: Build UFD
|
DOCSTRING = '''WizardKit: Build UFD
|
||||||
|
|
@ -31,7 +33,7 @@ Options:
|
||||||
'''
|
'''
|
||||||
ISO_LABEL = '{}_LINUX'.format(KIT_NAME_SHORT)
|
ISO_LABEL = '{}_LINUX'.format(KIT_NAME_SHORT)
|
||||||
UFD_LABEL = '{}_UFD'.format(KIT_NAME_SHORT)
|
UFD_LABEL = '{}_UFD'.format(KIT_NAME_SHORT)
|
||||||
UFD_SOURCES = ({
|
UFD_SOURCES = OrderedDict({
|
||||||
'Linux': {'Arg': '--linux', 'Type': 'ISO'},
|
'Linux': {'Arg': '--linux', 'Type': 'ISO'},
|
||||||
'Linux (Minimal)': {'Arg': '--linux-minimal', 'Type': 'ISO'},
|
'Linux (Minimal)': {'Arg': '--linux-minimal', 'Type': 'ISO'},
|
||||||
'WinPE': {'Arg': '--winpe', 'Type': 'ISO'},
|
'WinPE': {'Arg': '--winpe', 'Type': 'ISO'},
|
||||||
|
|
@ -84,5 +86,3 @@ ITEMS = {
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("This file is not meant to be called directly.")
|
print("This file is not meant to be called directly.")
|
||||||
|
|
||||||
# vim: sts=2 sw=2 ts=2
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue