Skip to content

Commit

Permalink
Fixed Windows-based bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky4546 committed Apr 24, 2023
1 parent c16ddd6 commit 7d22f74
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
2 changes: 0 additions & 2 deletions build/WINDOWS/TvhLib.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ Function AddFiles
File /r /x __pycache__ /x development "${SOURCEPATH}\lib\*.*"
SetOutPath "$INSTDIR\plugins"
File /r /x __pycache__ "${SOURCEPATH}\plugins\*.*"
SetOutPath "$INSTDIR\plugins_ext"
File /r /x __pycache__ /x provider* "${SOURCEPATH}\plugins_ext\*.*"

SetOutPath "$INSTDIR\build\WINDOWS"
File "${SOURCEPATH}\build\WINDOWS\UpdateConfig.pyw"
Expand Down
37 changes: 31 additions & 6 deletions build/WINDOWS/buildwin.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
!define PRODUCT_NAME "cabernet"
!define PRODUCT_VERSION ${VERSION}
!define PRODUCT_PUBLISHER "rocky4546"
!define PRODUCT_WEB_SITE "http://www.mycompany.com"
!define PRODUCT_WEB_SITE "https://github.com/cabernetwork/cabernet"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\tvh_main.py"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
Expand Down Expand Up @@ -224,9 +224,16 @@ FunctionEnd


Function un.onInit
Var /GLOBAL remove_all
!insertmacro MULTIUSER_UNINIT
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name)?" IDYES +2
Abort
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to remove all data and plugins?" IDYES true2
StrCpy $remove_all "0"
Goto end2
true2:
StrCpy $remove_all "1"
end2:
FunctionEnd


Expand All @@ -242,17 +249,35 @@ Section Uninstall
Call un.installService
${EndIf}

#Delete "$INSTDIR\${PRODUCT_NAME}.url"
#Delete "$INSTDIR\uninst.exe"
RMDIR /r "$INSTDIR\*.*"
${If} $remove_all == "1"
RMDIR /r "$INSTDIR\*.*"
${Else}
#Delete Cabernet folders
RMDIR /r "$INSTDIR\build"
RMDIR /r "$INSTDIR\lib"
RMDIR /r "$INSTDIR\plugins"

#Delete Cabernet files
Delete "$INSTDIR\CHANGE*.*"
Delete "$INSTDIR\Dock*"
Delete "$INSTDIR\LIC*"
Delete "$INSTDIR\READ*.*"
Delete "$INSTDIR\req*.*"
Delete "$INSTDIR\tvh*.*"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\${PRODUCT_NAME}.url"
${EndIf}

Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
Delete "$DESKTOP\cabernet.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\cabernet.lnk"

RMDir "$SMPROGRAMS\$ICONS_GROUP"
RMDir "$INSTDIR"

${If} $remove_all == "1"
RMDir "$INSTDIR"
${EndIf}

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
Expand Down
2 changes: 1 addition & 1 deletion lib/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import lib.common.exceptions as exceptions

VERSION = '0.9.12.14'
VERSION = '0.9.12.15'
CABERNET_URL = 'https://github.com/cabernetwork/cabernet'
CABERNET_ID = 'cabernet'
CABERNET_REPO = 'manifest.json'
Expand Down
2 changes: 1 addition & 1 deletion lib/config/user_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def config_json(_webserver):


class TVHUserConfig:
config_handler = configparser.ConfigParser(interpolation=None)

def __init__(self, _script_dir=None, _opersystem=None, _args=None, _config=None):
self.logger = None
Expand All @@ -63,6 +62,7 @@ def __init__(self, _script_dir=None, _opersystem=None, _args=None, _config=None)
self.script_dir = str(_script_dir)
self.defn_json = config_defn.load_default_config_defns()
self.data = self.defn_json.get_default_config()
self.config_handler = configparser.ConfigParser(interpolation=None)

if _script_dir is not None:
config_file = TVHUserConfig.get_config_path(_script_dir, _args)
Expand Down
3 changes: 2 additions & 1 deletion lib/db/datamgmt/data_mgmt_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ def select_del_instance(self):
for ns, inst_list in name_inst_dict.items():
for inst in inst_list:
section = utils.instance_config_section(ns, inst)
if self.config.get(section) and self.config[section]['enabled']:
if self.config.get(section) \
and self.config[section].get('enabled'):
name_inst.append(''.join([
ns, ':', inst]))
db_channels = DBChannels(self.config)
Expand Down
2 changes: 1 addition & 1 deletion lib/db/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def export_sql(self, backup_folder):
shutil.make_archive(backup_filelink, 'zip', db_linkfilepath)

backup_file = pathlib.Path(backup_folder, self.db_name + BACKUP_EXT)
with open(backup_file, 'w') as export_f:
with open(backup_file, 'w', encoding='utf-8') as export_f:
for line in DB.conn[self.db_name][threading.get_ident()].iterdump():
export_f.write('%s\n' % line)
except PermissionError as e:
Expand Down

0 comments on commit 7d22f74

Please sign in to comment.