Moo-Ack-Productions / bpy-build

A build sytem to make building Blender addons 10 times easier
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

BpyBuild 0.4.1 #16

Closed StandingPadAnimations closed 4 months ago

StandingPadAnimations commented 4 months ago

This PR backports some of the improvements made for BpyBuild 0.5, as well as adds some additional features for BpyBuild 0.4.1. Unlike BpyBuild 0.5, BpyBuild 0.4.1 will continue to support Python 3.8

This contains the following changes:

TheDuckCow commented 4 months ago

Nice to see this! Let me know when you want me to review. Also calling out https://github.com/Moo-Ack-Productions/bpy-build/issues/17 in case it could be relevant to try and address here as well.

StandingPadAnimations commented 4 months ago

Ready for review @TheDuckCow

StandingPadAnimations commented 4 months ago

Fixed now. BpyBuild 0.4.1 introduces restrictions on character names for actions and the scripts they import, primarially to reduce the area of possible issues that can occur during module imports, and to avoid action names that can't be properly interpreted by most shells. The allowed characters are the following: https://github.com/Moo-Ack-Productions/bpy-build/blob/ba3e18f783f04d530f23a4053713859a65f2457c/bpy_addon_build/util.py#L17

/ was missing from this list, which is present in MCprep's build file (as actions are put in their own seperate directory). This is more of a temporary fix though; at some point, we should handle each part of a given path seperately

StandingPadAnimations commented 4 months ago

Alright, bit of a weird bug in the MCprep tests:

Traceback (most recent call last):
  File "/home/mahid/.pyenv/versions/3.8.18/lib/python3.8/unittest/mock.py", line 1325, in patched
    return func(*newargs, **newkeywargs)
  File "/home/mahid/Documents/bpy-build/test/mcprep_tests.py", line 181, in test_translations
    bab.main()
  File "/home/mahid/Documents/bpy-build/bpy_addon_build/__init__.py", line 74, in main
    build_path = build(context)
  File "/home/mahid/Documents/bpy-build/bpy_addon_build/build_context/build.py", line 55, in build
    hooks.run_prebuild_hooks(ctx)
  File "/home/mahid/Documents/bpy-build/bpy_addon_build/build_context/hooks.py", line 18, in run_prebuild_hooks
    build_action_prebuild(ctx, k, console, BabContext(cwd))
  File "/home/mahid/Documents/bpy-build/bpy_addon_build/build_context/hook_definitions.py", line 142, in build_action_prebuild
    res: Optional[Union[BpyError, BpyWarning]] = func(api_ctx)
  File "/home/mahid/Documents/bpy-build/test/MCprep/action-scripts/translate.py", line 7, in pre_build
    sys.stdout.reconfigure(encoding='utf-8')
AttributeError: '_io.StringIO' object has no attribute 'reconfigure'

Seems like StringIO (which we use in the tests to check command output) doesn't work with sys.stdout.reconfigure in MCprep's translate script (which we use to make sure everything is handled as UTF-8 for POT files). Will have to look into how to resolve.

(This only happens in tests)

TheDuckCow commented 4 months ago

Approving the sense that I give you the permission to do what you see fit for this version, if you want to fix the tests first or not

StandingPadAnimations commented 4 months ago

Opened https://github.com/Moo-Ack-Productions/MCprep/pull/585 to resolve the test issue

StandingPadAnimations commented 4 months ago

Ok tried it out now and indeed it got everything working! Installed to 4.1 and everything despite not having the addon installed there before.

Only nitpick is I would prefer if it could install things in reverse order (ie install to 4.1 first and 2.80 last), since I'm often wanting to do those later blender versions first anyways. I guess if I was being more exact I'd just be installing to a specific blender version anyways, but laziness prevails I suppose.

This should actually be relatively simple, since the list of versions is sorted anyway

StandingPadAnimations commented 4 months ago

Pushed 0.4.1 to PyPi, merging now