diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd7a79fb..d017dc2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,11 +22,11 @@ jobs: run: rm -rf mmd_tools/typings - name: Create a zip - run: zip -r -9 mmd_tools-${GITHUB_REF_NAME}.zip mmd_tools/ + run: (cd mmd_tools && find . -type f ! -path "*/.*" ! -path "*/__pycache__/*" -print | zip -9r "../mmd_tools-${GITHUB_REF_NAME}.zip" -@) - name: Create a Release id: create_release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: name: Release ${{ github.ref_name }} tag_name: ${{ github.ref_name }} diff --git a/mmd_tools/__init__.py b/mmd_tools/__init__.py index 2b613fa7..026658ea 100644 --- a/mmd_tools/__init__.py +++ b/mmd_tools/__init__.py @@ -15,33 +15,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - -bl_info = { - "name": "mmd_tools", - "author": "sugiany", - "version": (4, 2, 2), - "blender": (4, 2, 0), - "location": "View3D > Sidebar > MMD Panel", - "description": "Utility tools for MMD model editing. (UuuNyaa's forked version)", - "warning": "", - "doc_url": "https://mmd-blender.fandom.com/wiki/MMD_Tools", - "wiki_url": "https://mmd-blender.fandom.com/wiki/MMD_Tools", - "tracker_url": "https://github.com/UuuNyaa/blender_mmd_tools/issues", - "support": "COMMUNITY", - "category": "Object", -} - -MMD_TOOLS_VERSION = ".".join(map(str, bl_info["version"])) - import os -PACKAGE_PATH = os.path.dirname(__file__) PACKAGE_NAME = __package__ +PACKAGE_PATH = os.path.dirname(__file__) + +with open(os.path.join(PACKAGE_PATH, "blender_manifest.toml"), "rb") as f: + import tomllib + + manifest = tomllib.load(f) + MMD_TOOLS_VERSION = manifest["version"] from . import auto_load -auto_load.init() +auto_load.init(PACKAGE_NAME) def register(): @@ -54,7 +42,7 @@ def register(): # pylint: disable=import-outside-toplevel from .m17n import translation_dict - bpy.app.translations.register(bl_info["name"], translation_dict) + bpy.app.translations.register(PACKAGE_NAME, translation_dict) handlers.MMDHanders.register() @@ -66,7 +54,7 @@ def unregister(): handlers.MMDHanders.unregister() - bpy.app.translations.unregister(bl_info["name"]) + bpy.app.translations.unregister(PACKAGE_NAME) auto_load.unregister() diff --git a/mmd_tools/auto_load.py b/mmd_tools/auto_load.py index 72254c06..88e04deb 100644 --- a/mmd_tools/auto_load.py +++ b/mmd_tools/auto_load.py @@ -18,11 +18,11 @@ modules = None ordered_classes = None -def init(): +def init(package_name): global modules global ordered_classes - modules = get_all_submodules(Path(__file__).parent) + modules = get_all_submodules(Path(__file__).parent, package_name) ordered_classes = get_ordered_classes_to_register(modules) def register(): @@ -49,8 +49,8 @@ def unregister(): # Import modules ################################################# -def get_all_submodules(directory): - return list(iter_submodules(directory, directory.name)) +def get_all_submodules(directory, package_name): + return list(iter_submodules(directory, package_name)) def iter_submodules(path, package_name): for name in sorted(iter_submodule_names(path)):