Commit Graph

36 Commits

Author SHA1 Message Date
Campbell Barton
57abd173bb Extensions: remove unused operators
Remove:
- EXTENSIONS_OT_dummy_progress it was mainly useful for development.
- EXTENSIONS_OT_package_enable_not_installed as it's no longer used.
2025-02-26 16:16:54 +11:00
Campbell Barton
900eed683f Extensions: add progress test to "test_cli"
Add a low level test that progress reporting works as expected in
preparation for removing the Blender operator outputting dummy progress.
2025-02-26 16:10:04 +11:00
Campbell Barton
76f9a08963 Fix failure to reinstall an extension uninstalling the extension
When an extension could could be removed but it's directory could be
renamed, the install operation would fail anyway.

Resolve by completing the installation when the directory can be moved.

Report as part of #129884.
2024-11-28 21:28:30 +11:00
Campbell Barton
d9891aa6ad Fix #130561: incorrect Python compatibility checks for wheels
Regression in [0] caused wheels with an older Python version
that used CPython's stable ABI to be considered incompatible.

Resolve using the stable ABI for version checks.

[0]: cfc10b0232565642afbfdc5a867f027640ce8274
2024-11-27 15:44:58 +11:00
Campbell Barton
093cb8bf43 Extensions: fix building packages containing macos universal wheels 2024-11-26 17:32:11 +11:00
Campbell Barton
64b9dbe198 Tests: correct hard coded version string in extensions test 2024-11-26 17:19:52 +11:00
Campbell Barton
67865cb73a Tests: add tests to ensure literal paths are properly handled
Add tests to ensure literal paths are handled properly
(created as part of the fix for #129724).
2024-11-08 16:08:38 +11:00
Campbell Barton
a3a3dda563 Extensions: support for filtering based on Python versions
Support multiple extensions with different Python versions in a similar
way to how "platforms" are handled now.

This will be needed when Blender upgrades to a newer version of Python
so extensions which have a binary dependency on Python 3.11 don't
attempt to install in a Blender built with a newer Python version.

Details:

- Extensions from incompatible Python versions are not listed.
- Python versions are extracted from wheel names.
- An extension may include wheels for multiple Python versions,
  only the compatible wheels will be installed.
- Links may include a "python_versions" field which is checked
  when dropping into Blender.
- JSON generated by the "server-generate" command include the:
  "python_versions" field for extensions that include wheels.
- The "python_versions" field is optional, when omitted no version
  checks are performed.

Also correct watch_test make target.

Ref #128750.
2024-11-07 18:16:11 +11:00
Campbell Barton
f4f50fa2c5 Cleanup: replace typing.Union/Option with logical OR for extensions
Also remove use of deprecated typing.Sequence.
2024-10-18 10:08:12 +11:00
Campbell Barton
a66601ee95 Cleanup: remove deprecated typing built-ins for extension logic
Deprecated since Python 3.9 but still used in many docs/examples.
2024-10-17 19:11:40 +11:00
Campbell Barton
38c30c5c43 Extensions: resolve test failing
Enable the extensions add-on by default, without this, it's enabled
on startup, causing the preferences to be tagged as modified.
2024-10-01 15:36:54 +10:00
Campbell Barton
656fe6d3e4 Extensions: support "blocklist" in the remote repository
Support blocking extensions so there is a way for the maintainers of
the remote repository to notify the user if one of their installed
extensions blocked along with a reason for blocking.

Blocked extensions cannot be installed from the preferences or by
dropping a URL.

When an installed & blocked extension is found:

- An icon int the status bar shows an alert,
  clicking on the icon shows the blocked extensions.
- The extensions preferences show a warning.
- The extensions & add-ons UI shows an alert icon
  and "details" section shows the reason.

Details:

- Blocked & installed extensions are shown first in the installed
  extensions panel.
- The internal "install" logic prevents downloading & installing
  blocked extensions.
- Blocked extensions can still be downloaded & installed from disk.
- The "list" command includes an error message if any installed
  extensions are blocked.
- The "server-generate" command can optionally take a configuration
  file that includes the blocklist for the generated JSON.

See design #124954.
2024-07-26 16:05:34 +10:00
Campbell Barton
319684d8f6 Extensions: warn when extensions violate module policies
As each extension has it's own package, any modules it includes must be
imported as sub-modules. Warn if extensions are including themselves
in the sys.path as this breaks name-spacing of extensions.

Show these warnings in the add-on & extensions UI.
2024-07-11 17:50:30 +10:00
Campbell Barton
0bfea7caea Extensions: fix error it tests where the local repo wasn't cleared
Tests interfered with each other because the local repo path wasn't
cleared between different tests.
2024-07-11 17:37:31 +10:00
Campbell Barton
69fd60b41a Extensions: update tests from changes to repo-list 2024-07-11 11:22:30 +10:00
Campbell Barton
9bbf269fe3 Extensions: suppress all pylint warnings & handle add-on errors
- Suppress pylint warnings via comments or be minor changes.
- Any errors disabling add-ons before upgrading or uninstalling are now
  reported to the operators.
- Disable cyclic import warning is it's impractical to resolve.
- Enable useless-suppression warning.
2024-07-08 15:29:27 +10:00
Campbell Barton
08b75549e3 Extensions: add a new error type "FATAL_ERROR"
Some errors were reported as warnings because they didn't prevent the
operation from completing (such as failing to remove some paths when
uninstalling).

Change message types for the extensions internal command line program:

- Add "fatal error" to use when an operation fails and exits with a
  non-zero error code.
- Use "error" when an operation fails which doesn't prevent other
  actions from succeeding.
- Use "warn" reporting issues what don't prevent the operation
  from completing but may cause problems.
2024-07-05 20:46:40 +10:00
Campbell Barton
f98e422e63 Extensions: support build --split-platforms, generated manifest data
- Add an option to build a separate package for each platform, this is
  useful to produce smaller packages when large wheels are included.

- Add a reserved field: "[build.generated]" to the manifest when
  splitting by platform which overrides the root-level platform
  when it exists.
2024-06-18 16:29:57 +10:00
Campbell Barton
176864ab03 Extensions: install all updates in parallel
Run each update as a separate job, previously updates for each
repository was split into a separate job however that would only
use parallel connections with multiple online repositories which
isn't used by default. Currently the connection limit is hard-coded but
will be made into a preference.
2024-06-14 15:12:23 +10:00
Campbell Barton
2dd339bff3 Extensions: quiet warnings from pylint
Some warnings remain which need further investigation.
2024-06-14 15:12:19 +10:00
Campbell Barton
7952f35292 Extensions: filter out extensions by platform and blender version
Exclude extensions which aren't supported by the Blender version or
the platform (for platform dependent extensions).
2024-06-14 15:12:18 +10:00
Campbell Barton
248a5258e0 Extensions: various fixes
- Fix an unhandled exception listing a repository with no remote data.
- Exclude dot-files from being listed when generating a repository.
- Fix missing import (in an unlikely corner case) when accessing
  tags before the repository data was initialized.
- Fix refresh refreshing the remote not updating the
  internal remote meta-data.
- Suppress warnings in tests caused by default repositories
  (now removed before resting).
2024-06-14 15:12:16 +10:00
Campbell Barton
714d5515a3 Unbreak extensions test 2024-06-11 13:38:04 +10:00
Campbell Barton
b0232b4e0e Cleanup: various warnings from pylint for extensions & addons 2024-06-08 23:33:45 +10:00
Campbell Barton
24abd35d14 Extensions: use "extensions" category for operator
Replace use of "bl_pkg" operator category with "extensions",
this naming was used while the functionality was experimental,
not intended to be used once extensions was moved out of experimental.
2024-05-31 10:32:01 +10:00
Campbell Barton
051e10d39a Extensions: make "test_blender" less noisy 2024-05-29 15:31:44 +10:00
Campbell Barton
f0ebc310c8 Extensions: update tests after changing UI text 2024-05-29 15:11:55 +10:00
Hans Goudey
33a5b47735 Cleanup: Make format 2024-05-28 13:35:44 -04:00
Dalai Felinto
4b57951604 Extensions: New status message when checking for update
```
- Sync repo: {remote_url}
+ Checking repository "{remote_name}" for updates...

- Sync downloading remote data
+ Refreshing extensions list for "{remote_name}"...

- sync: invalid manifest ({error_msg}) reading {remote_url}!"
+ Repository error: invalid manifest ({error_msg}) for repository "{remote_name}"!

- Sync complete: {:s}".format(remote_url)
+ Extensions list for "{remote_name}" updated
```

---

Note, this is working as expected (from Blender anyways), however I can't test test_cli.py at the moment here.

---

Old messages:

<img src="https://projects.blender.org/attachments/9d4db8f5-ef9a-48c8-9e56-cb534aa9aed5" width=650>

New messages:

<img src="https://projects.blender.org/attachments/0245bcb7-6c4e-47e4-a616-0cf831761b47" width=450>

---

Co-authored by Pablo Vazquez

Pull Request: https://projects.blender.org/blender/blender/pulls/122378
2024-05-28 18:39:42 +02:00
Campbell Barton
c33b03fe68 Fix extension tests running after operator poll() changes
Enable "--online-mode" when running tests which require it.
2024-05-28 21:31:25 +10:00
Campbell Barton
54cf0f7f4c Extensions: add support for "build" paths in the manifest
Add an optional `[build]` table, only used for the "build" sub-command.

Supported entries.

- `paths = [..]` list of strings.
  Explicitly list all paths to include.
  Python "wheels" and the manifest are automatically included.

- `paths_exclude_pattern = [..]` list of strings.
  A `.gitignore` compatible list of patterns.

By default "paths_exclude_pattern" is set to:
[".*", "__pycache__"] when the `[build]` table entry isn't found.

Only one of these options is supported at once since it makes to sense
to exclude paths when they're manually listed.
2024-05-22 15:02:12 +10:00
Campbell Barton
3003953e14 Extensions: rename the internal name for repository JSON
Use the name "index.json" instead of "bl_ext_repo.json".

This makes more sense as the name is automatically added to the end
of file:// URL's a little like index.html for web-sites.
2024-05-16 20:44:59 +10:00
Campbell Barton
8ff15f1c70 Cleanup: restore error, exclude extensions tests from bl_load_py_modules
Also remove outdated exclusions.
2024-05-16 16:02:25 +10:00
Campbell Barton
672d203e67 Extensions: support file URI's for the remote URL
Previously regular paths were supported however supporting both
URL's and file paths isn't very common & complicated internal logic.

Also fixed an error where the server-generate sub-command created the
"archive_url" from the file-name without URL encoding.
2024-05-16 13:41:39 +10:00
Campbell Barton
c4a0bbb1f4 Extensions: Support online extensions and move add-ons outside Blender
The extensions system allows to extend Blender with connectivity to the internet. Right now it means Blender can
discover and install add-ons and themes directly from the internet, and notify users about their updates.

By default this is disabled (opt-in), and users can enable it the first time they try to install an extension or visit
the Prefences > Extensions tab. If this is enabled, Blender will automatically check for updates for
extensions.blender.org upon startup.

When will Blender access the remote repositories:

* Every time you open the Preferences → Extensions: ALL the enabled repositories get checked for the latest info (json)
* Every time you try to install by dragging: ALL the enabled repositories get checked for the latest info (json).
* Every time you start Blender: selected repositories get checked for the latest info (json).

------------------

From the Blender code point of view, this means that most of the add-ons and themes originally bundled with Blender
will now be available from the online platform, instead of bundled with Blender. The exception are add-ons which are
deemed core functionality which just happened to be written as Python add-ons.

Links:
* Original Extenesions Platform Announcement: https://code.blender.org/2022/10/blender-extensions-platform/
* Extensions website: https://extensions.blender.org/
* User Manual: https://docs.blender.org/manual/en/4.2/extensions/index.html#extensions-index
* Technical specifications: https://developer.blender.org/docs/features/extensions/
* Changes on add-ons bundling: https://devtalk.blender.org/t/changes-to-add-on-bundling-4-2-onwards/34593

------------------

This PR does the following:

* Move extensions out of experimental.
* No longer install `scripts/addons` & `scripts/addons_contrib`.
* Add `scripts/addons_core` to blender's repository.

These add-ons will still be bundled with Blender and will be always enabled in the future, with their preferences
moved to be more closely integrated with the rest of Blender. This will happen during the remaining bcon2 period.
For more details, see #121830

From scripts/addons:

* copy_global_transform.py
* hydra_storm
* io_anim_bvh
* io_curve_svg
* io_mesh_uv_layout
* io_scene_fbx
* io_scene_gltf2
* pose_library
* ui_translate
* viewport_vr_preview

Extra: bl_pkg (scripts/addons_contrib)

Note: The STL (legacy) add-on is going to be moved to the extensions platform. There is already a C++ version on core
which is enabled by default.

All the other add-ons are already available at extensions.blender.org. To use them you need to:

* Go to User Preferences > Extensions
* You will be greated with an "Online Extensions" message, click on "Enable Repository".
* Search the add-on you are looking for (e.g, Import Images as Planes).
* Click on Install

Over time their maintaince will be transferred over to the community so their development can carry on. If you used to
help maintain a bundled add-on please read: https://devtalk.blender.org/t/changes-to-add-on-bundling-4-2-onwards/34593

Ref: !121825
2024-05-15 19:26:29 +02:00
Campbell Barton
13a3603578 Move addons from the addons repo to "addons_core"
Ref: !121825
2024-05-15 19:26:29 +02:00