v1.2.2 - WizardHats
More UTF-8
This commit is contained in:
commit
b077602a42
5 changed files with 16 additions and 37 deletions
|
|
@ -1,28 +0,0 @@
|
|||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
pushd "%~dp0"
|
||||
|
||||
rem Prep
|
||||
mkdir _out\_Drivers
|
||||
set "out=%cd%\_out"
|
||||
|
||||
rem _Drivers
|
||||
pushd _Drivers
|
||||
for %%f in (*) do (
|
||||
set "file=%%f"
|
||||
"%programfiles%\7-Zip\7z.exe" a -t7z -mx=9 -myx=9 -ms=on -mhe -pAbracadabra "%out%\_Drivers\!file:~0,-4!.7z" "%%f"
|
||||
)
|
||||
popd
|
||||
|
||||
rem Rest
|
||||
for /d %%d in (*) do (
|
||||
if not "%%d" == "_out" (
|
||||
pushd "%%d"
|
||||
"%programfiles%\7-Zip\7z.exe" a -t7z -mx=9 -myx=9 -ms=on -mhe -pAbracadabra "%out%\%%d.7z" *
|
||||
popd
|
||||
)
|
||||
)
|
||||
|
||||
popd
|
||||
endlocal
|
||||
|
|
@ -160,7 +160,8 @@ def get_ticket_number():
|
|||
_input = input('Enter ticket number: ')
|
||||
if re.match(r'^([0-9]+([-_]?\w+|))$', _input):
|
||||
ticket_number = _input
|
||||
with open(r'{LogDir}\TicketNumber'.format(**global_vars), 'w') as f:
|
||||
with open(r'{}\TicketNumber'.format(global_vars['LogDir']), 'w',
|
||||
encoding='utf-8') as f:
|
||||
f.write(ticket_number)
|
||||
return ticket_number
|
||||
|
||||
|
|
@ -341,7 +342,7 @@ def print_warning(*args, **kwargs):
|
|||
def print_log(message='', end='\n', timestamp=True):
|
||||
time_str = time.strftime("%Y-%m-%d %H%M%z: ") if timestamp else ''
|
||||
if 'LogFile' in global_vars and global_vars['LogFile'] is not None:
|
||||
with open(global_vars['LogFile'], 'a') as f:
|
||||
with open(global_vars['LogFile'], 'a', encoding='utf-8') as f:
|
||||
for line in message.splitlines():
|
||||
f.write('{timestamp}{line}{end}'.format(
|
||||
timestamp = time_str,
|
||||
|
|
@ -481,7 +482,7 @@ def upload_data(path, file):
|
|||
winreg.REG_SZ, CLIENT_INFO_SERVER['RegEntry'])
|
||||
|
||||
# Write batch file
|
||||
with open(r'{TmpDir}\psftp.batch'.format(**global_vars),
|
||||
with open(r'{}\psftp.batch'.format(global_vars['TmpDir']),
|
||||
'w', encoding='ascii') as f:
|
||||
f.write('lcd "{path}"\n'.format(path=path))
|
||||
f.write('cd "{Share}"\n'.format(**CLIENT_INFO_SERVER))
|
||||
|
|
|
|||
|
|
@ -197,8 +197,7 @@ def run_fast_copy(items, dest):
|
|||
raise Exception
|
||||
|
||||
cmd = [global_vars['Tools']['FastCopy'], *FAST_COPY_ARGS]
|
||||
if 'LogFile' in global_vars:
|
||||
cmd.append('/logfile={LogFile}'.format(**global_vars))
|
||||
cmd.append(r'/logfile={}\FastCopy.log'.format(global_vars['LogDir']))
|
||||
cmd.extend(items)
|
||||
cmd.append('/to={}\\'.format(dest))
|
||||
|
||||
|
|
@ -211,7 +210,8 @@ def run_wimextract(source, items, dest):
|
|||
extract_item('wimlib', silent=True)
|
||||
|
||||
# Write files.txt
|
||||
with open(r'{}\wim_files.txt'.format(global_vars['TmpDir']), 'w') as f:
|
||||
with open(r'{}\wim_files.txt'.format(global_vars['TmpDir']), 'w',
|
||||
encoding='utf-8') as f:
|
||||
# Defaults
|
||||
for item in items:
|
||||
f.write('{}\n'.format(item))
|
||||
|
|
|
|||
|
|
@ -345,11 +345,13 @@ def run_bleachbit():
|
|||
out = run_program(cmd, check=False)
|
||||
# Save stderr
|
||||
if out.stderr.decode().splitlines():
|
||||
with open(global_vars['LogDir']+r'\BleachBit.err', 'a') as f:
|
||||
with open(global_vars['LogDir']+r'\BleachBit.err', 'a',
|
||||
encoding='utf-8') as f:
|
||||
for line in out.stderr.decode().splitlines():
|
||||
f.write(line.strip() + '\n')
|
||||
# Save stdout
|
||||
with open(global_vars['LogDir']+r'\BleachBit.log', 'a') as f:
|
||||
with open(global_vars['LogDir']+r'\BleachBit.log', 'a',
|
||||
encoding='utf-8') as f:
|
||||
for line in out.stdout.decode().splitlines():
|
||||
f.write(line.strip() + '\n')
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,11 @@ def scan_for_net_installers(server, family_name, min_year):
|
|||
|
||||
if server['Mounted']:
|
||||
for year in os.scandir(r'\\{IP}\{Share}'.format(**server)):
|
||||
if int(year.name) < min_year:
|
||||
try:
|
||||
year_ok = int(year.name) < min_year
|
||||
except ValueError:
|
||||
year_ok = False # Skip non-year items
|
||||
if year_ok:
|
||||
# Don't support outdated installers
|
||||
continue
|
||||
for version in os.scandir(year.path):
|
||||
|
|
|
|||
Loading…
Reference in a new issue