From 1decc06e45c041f25a3e9a35172b4e3bbfb53d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=B0=E6=96=87?= <1635370493@qq.com> Date: Sat, 13 May 2023 21:55:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=B8=80=E7=82=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=B9=B6=E8=B0=83=E6=95=B4specs=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E7=94=9F=E6=88=90=E5=90=8E=E7=9A=84=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildTypeDirectory | 1 + MCMDC/constants.py | 22 +++++++++++++ MCMDC/docs_helper.py | 10 ++++-- MCMDC_CUI.py | 6 ++-- version_info.txt | 76 +++++++++++++++++++++++--------------------- version_info_d.txt | 45 ++++++++++++++++++++++++++ 6 files changed, 118 insertions(+), 42 deletions(-) create mode 100644 BuildTypeDirectory create mode 100644 version_info_d.txt diff --git a/BuildTypeDirectory b/BuildTypeDirectory new file mode 100644 index 0000000..ddbae48 --- /dev/null +++ b/BuildTypeDirectory @@ -0,0 +1 @@ +Nothing here. \ No newline at end of file diff --git a/MCMDC/constants.py b/MCMDC/constants.py index 85c96d9..3b07672 100644 --- a/MCMDC/constants.py +++ b/MCMDC/constants.py @@ -27,6 +27,28 @@ else: isBuilt = True print(f'{LOGMODE_LOADING_OHEADER}This is a builded version.') + basedir = osp.normpath(osp.join(basedir, '..')) + print(f'{LOGMODE_LOADING_OHEADER}Basedir is reset to [{basedir}].') + +BuildType: str +BuildTypeDirectory = 'Directory' +BuildTypeFile = 'File' +BuildTypeNone = 'None' + +try: + if BuildType is None: pass; +except Exception as e: + if isBuilt: + if osp.exists(osp.join(basedir, 'BuildTypeDirectory')): + BuildType = BuildTypeDirectory + print(f'{LOGMODE_LOADING_OHEADER}Build Type: Folder.') + # basedir_folder = osp.dirname(osp.abspath(sys.argv[0])) + # print(f'{LOGMODE_LOADING_OHEADER}basedir_folder is set to [{basedir_folder}].') + else: + BuildType = BuildTypeFile + print(f'{LOGMODE_LOADING_OHEADER}Build Type: Single.') + else: + BuildType = BuildTypeNone devpause: bool diff --git a/MCMDC/docs_helper.py b/MCMDC/docs_helper.py index 6e1f158..001bbc9 100644 --- a/MCMDC/docs_helper.py +++ b/MCMDC/docs_helper.py @@ -164,10 +164,16 @@ def GiveDoc(file: str, lang: str = 'en-us', executor: str = 'start', startOption __moreimport__() + # if isBuilt and BuildType == BuildTypeDirectory: + # librarydir = basedir_folder + # else: + # librarydir = basedir + librarydir = basedir + if isBuilt: - filepath = os.path.join(basedir, 'docs') + filepath = os.path.join(librarydir, 'docs') else: - filepath = os.path.join(basedir, '..', 'docs') + filepath = os.path.join(librarydir, '..', 'docs') filepath = os.path.normpath(filepath) print_debug(file, enabled=False) diff --git a/MCMDC_CUI.py b/MCMDC_CUI.py index 1b7f5f7..79a5c9f 100644 --- a/MCMDC_CUI.py +++ b/MCMDC_CUI.py @@ -2,9 +2,9 @@ import os.path as osp import MCMDC from MCMDC.constants import * -if isBuilt: - MCMDC.constants.basedir = basedir = osp.normpath(osp.join(basedir, '..')) - print(f'{LOGMODE_LOADING_OHEADER}Basedir is set to [{basedir}].') +# if isBuilt: +# MCMDC.constants.basedir = basedir = osp.normpath(osp.join(basedir, '..')) +# print(f'{LOGMODE_LOADING_OHEADER}Basedir is set to [{basedir}].') # LOGMODE_LOADING_OHEADER = '[ProgramLoad]: ' if __name__ == "__main__": diff --git a/version_info.txt b/version_info.txt index 07a3a45..c9a0ed3 100644 --- a/version_info.txt +++ b/version_info.txt @@ -2,42 +2,44 @@ # # For more details about fixed file info 'ffi' see: # http://msdn.microsoft.com/en-us/library/ms646997.aspx + VSVersionInfo( - ffi=FixedFileInfo( -# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) -# Set not needed items to zero 0. -filevers=(1, 0, 0, 0), # 文件版本 -prodvers=(1, 0, 0, 0), -# Contains a bitmask that specifies the valid bits 'flags'r -mask=0x3f, -# Contains a bitmask that specifies the Boolean attributes of the file. -flags=0x0, -# The operating system for which this file was designed. -# 0x4 - NT and there is no need to change it. -OS=0x4, -# The general type of file. -# 0x1 - the file is an application. -fileType=0x1, # 类型 -# The function of the file. -# 0x0 - the function is not defined for this fileType -subtype=0x0, -# Creation date and time stamp. -date=(0, 0) -), - kids=[ -StringFileInfo( - [ - StringTable( - u'040904B0', - [StringStruct(u'CompanyName', u'-'), - StringStruct(u'FileDescription', u'《我的世界》模组依赖项检查工具, 联系邮箱: liuljwtt@foxmail.com'), # 文件说明 - StringStruct(u'FileVersion', u'1.0.0'), - StringStruct(u'InternalName', u'MCMDC'), - StringStruct(u'LegalCopyright', u'LiuJiewen'), #版权 - StringStruct(u'OriginalFilename', u'MCMDC.exe'), #原始文件名 - StringStruct(u'ProductName', u'Minecraft Mod Dependency Check'), #产品名称 - StringStruct(u'ProductVersion', u'1.0.0')]) #产品版本 - ]), -VarFileInfo([VarStruct(u'Translation', [2052, 1200])]) # 语言 - ] + ffi=FixedFileInfo( + # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) + # Set not needed items to zero 0. + filevers=(1, 0, 0, 0), # 文件版本 + prodvers=(1, 0, 0, 0), + # Contains a bitmask that specifies the valid bits 'flags'r + mask=0x3f, + # Contains a bitmask that specifies the Boolean attributes of the file. + flags=0x0, + # The operating system for which this file was designed. + # 0x4 - NT and there is no need to change it. + OS=0x4, + # The general type of file. + # 0x1 - the file is an application. + fileType=0x1, # 类型 + # The function of the file. + # 0x0 - the function is not defined for this fileType + subtype=0x0, + # Creation date and time stamp. + date=(0, 0) + ), + kids=[ + StringFileInfo( + [ + StringTable( + u'040904B0', + [StringStruct(u'CompanyName', u''), + StringStruct(u'FileDescription', u'《我的世界》模组依赖项检查工具(A版)。联系邮箱: liuljwtt@foxmail.com。此程序开源,Github账户:LiuJiewenTT。'), # 文件说明 + StringStruct(u'FileVersion', u'1.0.0'), + StringStruct(u'InternalName', u'MCMDC'), + StringStruct(u'LegalCopyright', u'刘杰文'), #版权 + StringStruct(u'OriginalFilename', u'MCMDC.exe'), #原始文件名 + StringStruct(u'ProductName', u'Minecraft Mod Dependency Check'), #产品名称 + StringStruct(u'ProductVersion', u'1.0.0')]) #产品版本 + ] + ), + VarFileInfo([VarStruct(u'Translation', [2052, 1200])]) # 语言 + ] ) \ No newline at end of file diff --git a/version_info_d.txt b/version_info_d.txt new file mode 100644 index 0000000..2410db1 --- /dev/null +++ b/version_info_d.txt @@ -0,0 +1,45 @@ +# UTF-8 +# +# For more details about fixed file info 'ffi' see: +# http://msdn.microsoft.com/en-us/library/ms646997.aspx + +VSVersionInfo( + ffi=FixedFileInfo( + # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) + # Set not needed items to zero 0. + filevers=(1, 0, 0, 0), # 文件版本 + prodvers=(1, 0, 0, 0), + # Contains a bitmask that specifies the valid bits 'flags'r + mask=0x3f, + # Contains a bitmask that specifies the Boolean attributes of the file. + flags=0x0, + # The operating system for which this file was designed. + # 0x4 - NT and there is no need to change it. + OS=0x4, + # The general type of file. + # 0x1 - the file is an application. + fileType=0x1, # 类型 + # The function of the file. + # 0x0 - the function is not defined for this fileType + subtype=0x0, + # Creation date and time stamp. + date=(0, 0) + ), + kids=[ + StringFileInfo( + [ + StringTable( + u'040904B0', + [StringStruct(u'CompanyName', u''), + StringStruct(u'FileDescription', u'《我的世界》模组依赖项检查工具(B版)。联系邮箱: liuljwtt@foxmail.com。此程序开源,Github账户:LiuJiewenTT。'), # 文件说明 + StringStruct(u'FileVersion', u'1.0.0'), + StringStruct(u'InternalName', u'MCMDC'), + StringStruct(u'LegalCopyright', u'刘杰文'), #版权 + StringStruct(u'OriginalFilename', u'MCMDC.exe'), #原始文件名 + StringStruct(u'ProductName', u'Minecraft Mod Dependency Check'), #产品名称 + StringStruct(u'ProductVersion', u'1.0.0')]) #产品版本 + ] + ), + VarFileInfo([VarStruct(u'Translation', [2052, 1200])]) # 语言 + ] +) \ No newline at end of file