-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #168: avoid creating duplicate link for addon #172
Fix #168: avoid creating duplicate link for addon #172
Conversation
- Capitalize global variables - Add type hints
The change should be working now.
Note: I have basic experience with tests. pip install pytest
cd pythonFile
$env:PYTHONPATH="./include" # powershell
pytest -s .\tests\blender_vscode\test_load_addons.py::TestIsInAnyAddonDirectory::test_is_in_any_addon_directory # ok
pytest -s .\tests # 1 ok 5 fail |
I think I fixed the tests, but i need to sleep on it.
Those tests are just prototypes that helped me find 2 more errors in my code. I am not sure if this is the right way to test (very complicated test for little code) The tests are prepared to run outside of blender, and without fake-bpy-module |
Ehh, enother long evening. |
I am pretty sure this patch works as expected. Final test was done by adding addon and extension to both
as seen on screeshot, all looks ok. The policy violation was fixed in 445778f I verified that tests work even if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good if you could update the initial PR description to be a bit more comprehensive.
A few words about how to run the tests would be good too. Also looks like they work on linux only (it's ok, but would be good to be more explicit about it)?
ugh, breaks older blender. Totally forgot about that. I need to fight the persmission denied error when pip installing and check with blender 2.8 - i think this is the oldest one we support. Hey, but I am developing this PR on windows, tests should work... Oh, I named the path in Linux style. It does not matter, it works on windows |
Fresh installation of blender is not going to have directory created.
fixed compability with bledner 2.80. Please squash merge after #174 - it fixes one more issue with 2.80 compability |
there are problems with python 3.7 and dealing with junctions in windows. They are not recognized correctly and give different errors than python 3.12 |
- Windows only: You upgraded Blender version and imported old setting. Now links became real directories. | ||
- Path is a real directory with the same name as addon (removing might cause data loss!)""" | ||
) | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically, there is no need to "panic" here, we can still load other addons, but there is no indication that linking failed and bledner needs to be restarted anyways...
This became very involving change, hopefully this is last iteration and I will merge it on the weekend. |
# Conflicts: # CHANGELOG.md # pythonFiles/include/blender_vscode/__init__.py # pythonFiles/include/blender_vscode/installation.py
It is not critical functionality, it is ok to ignore errors
tested on ubuntu 22.04 snap installed blender 4.2. Works fine. |
In this PR:
\4.2\scripts\addons
-> default dir for addons\4.2\extensions\blender_org
-> directory indicated bybpy.context.preferences.extensions.repos
(list of directories)Squash merge when ready. Please squash merge after #174 - it fixes one more issue with 2.80 compability
About tests:
bpy
andaddon_utils
are not necessary for testsI could not figure out how to run tests with VS code UI. Works fine with pycharm UI when you mark include directory as source directory.
todo:
Corner cases (for documentation):