-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Checkpoint adding some changes * Adding more handling * Adding fixes
- Loading branch information
1 parent
a15da71
commit bb6aff4
Showing
10 changed files
with
129 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import subprocess | ||
from ..register.dependency_handling import \ | ||
are_dependencies_installed, get_dependencies,\ | ||
install_and_import_module, install_pip, set_dependency_installed_flag | ||
|
||
from ..register import register_dependent_objects | ||
|
||
import bpy | ||
|
||
|
||
class MEASURES_OT_Install_Dependencies(bpy.types.Operator): | ||
bl_idname = "measures.install_dependencies" | ||
bl_label = "Install dependencies" | ||
bl_description = ("Downloads and installs the required python packages for this add-on. " | ||
"Internet connection is required. Blender may have to be started with " | ||
"elevated permissions in order to install the package") | ||
bl_options = {"REGISTER", "INTERNAL"} | ||
|
||
@classmethod | ||
def poll(self, context): | ||
# Deactivate when dependencies have been installed | ||
return not are_dependencies_installed() | ||
|
||
def execute(self, context): | ||
try: | ||
install_pip() | ||
for dependency in get_dependencies(): | ||
install_and_import_module(module_name=dependency.module, | ||
package_name=dependency.package, | ||
global_name=dependency.name) | ||
except (subprocess.CalledProcessError, ImportError) as err: | ||
self.report({"ERROR"}, str(err)) | ||
return {"CANCELLED"} | ||
|
||
set_dependency_installed_flag(True) | ||
|
||
# Register the panels, operators, etc. since dependencies are installed | ||
register_dependent_objects() | ||
|
||
return {"FINISHED"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters