Cleanup: rename package manager addon from bpkg -> package_manager

As I see it, the *package manager* is called "bpkg", while the *package
manager addon* is called "package_manager".

The *package manager* contains the actual package management code, and
the *package manager addon* provides the interface to use it.
This commit is contained in:
Ellwood Zwovic
2017-07-20 23:05:13 -07:00
parent 57f730b04c
commit a250777d15
4 changed files with 38 additions and 38 deletions

View File

@@ -154,15 +154,15 @@ class SubprocMixin:
raise NotImplementedError()
class BPKG_OT_install(SubprocMixin, bpy.types.Operator):
bl_idname = 'bpkg.install'
class PACKAGE_OT_install(SubprocMixin, bpy.types.Operator):
bl_idname = 'package.install'
bl_label = 'Install package'
bl_description = 'Downloads and installs a Blender add-on package'
bl_options = {'REGISTER'}
package_url = bpy.props.StringProperty(name='package_url', description='The URL of the file to download')
log = logging.getLogger(__name__ + '.BPKG_OT_install')
log = logging.getLogger(__name__ + '.PACKAGE_OT_install')
def invoke(self, context, event):
if not self.package_url:
@@ -173,7 +173,7 @@ class BPKG_OT_install(SubprocMixin, bpy.types.Operator):
def create_subprocess(self):
"""Starts the download process.
tuple to
Also registers the message handlers.
:rtype: multiprocessing.Process
@@ -234,15 +234,15 @@ tuple to
self.log.error('Process died without telling us! Exit code was 0 though')
self.report({'WARNING'}, 'Error downloading package, but process finished OK. This is weird.')
class BPKG_OT_uninstall(SubprocMixin, bpy.types.Operator):
bl_idname = 'bpkg.uninstall'
class PACKAGE_OT_uninstall(SubprocMixin, bpy.types.Operator):
bl_idname = 'package.uninstall'
bl_label = 'Install package'
bl_description = 'Downloads and installs a Blender add-on package'
bl_options = {'REGISTER'}
package_name = bpy.props.StringProperty(name='package_name', description='The name of the package to uninstall')
log = logging.getLogger(__name__ + '.BPKG_OT_uninstall')
log = logging.getLogger(__name__ + '.PACKAGE_OT_uninstall')
def invoke(self, context, event):
if not self.package_name:
@@ -307,12 +307,12 @@ def get_packages_from_repo() -> list:
pkg.repository = repo.name
return repo.packages
class BPKG_OT_refresh_packages(bpy.types.Operator):
bl_idname = "bpkg.refresh_packages"
class PACKAGE_OT_refresh_packages(bpy.types.Operator):
bl_idname = "package.refresh_packages"
bl_label = "Refresh Packages"
bl_description = "Scan for packages on disk"
log = logging.getLogger(__name__ + ".BPKG_OT_refresh_packages")
log = logging.getLogger(__name__ + ".PACKAGE_OT_refresh_packages")
def execute(self, context):
installed_packages = get_packages_from_disk(refresh=True)
@@ -321,13 +321,13 @@ class BPKG_OT_refresh_packages(bpy.types.Operator):
return {'FINISHED'}
class BPKG_OT_refresh_repositories(SubprocMixin, bpy.types.Operator):
bl_idname = "bpkg.refresh_repositories"
class PACKAGE_OT_refresh_repositories(SubprocMixin, bpy.types.Operator):
bl_idname = "package.refresh_repositories"
bl_label = "Refresh Repositories"
bl_description = 'Check repositories for new and updated packages'
bl_options = {'REGISTER'}
log = logging.getLogger(__name__ + ".BPKG_OT_refresh")
log = logging.getLogger(__name__ + ".PACKAGE_OT_refresh")
def create_subprocess(self):
"""Starts the download process.
@@ -409,8 +409,8 @@ class BPKG_OT_refresh_repositories(SubprocMixin, bpy.types.Operator):
#TODO:
# monkey patch refresh_repositories and add refresh_packages in the success callback
# this way refresh_packages is always called after repositories have been refreshed
class BPKG_OT_refresh(bpy.types.Operator):
bl_idname = "bpkg.refresh"
class PACKAGE_OT_refresh(bpy.types.Operator):
bl_idname = "package.refresh"
bl_label = "Refresh"
bl_description = "Check for new and updated packages"
@@ -420,13 +420,13 @@ class BPKG_OT_refresh(bpy.types.Operator):
return {'FINISHED'}
class BPKG_OT_hang(SubprocMixin, bpy.types.Operator):
bl_idname = 'bpkg.hang'
class PACKAGE_OT_hang(SubprocMixin, bpy.types.Operator):
bl_idname = 'package.hang'
bl_label = 'Hang (debug)'
bl_description = 'Starts a process that hangs for an hour, for debugging purposes'
bl_options = {'REGISTER'}
log = logging.getLogger(__name__ + '.BPKG_OT_install')
log = logging.getLogger(__name__ + '.PACKAGE_OT_install')
def create_subprocess(self):
"""Starts the download process.
@@ -444,13 +444,13 @@ class BPKG_OT_hang(SubprocMixin, bpy.types.Operator):
def report_process_died(self):
self.report({'ERROR'}, 'Process died, exit code %s' % self.process.exitcode)
class BPKG_OT_load_repositories(SubprocMixin, bpy.types.Operator):
bl_idname = 'bpkg.load_repositories'
class PACKAGE_OT_load_repositories(SubprocMixin, bpy.types.Operator):
bl_idname = 'package.load_repositories'
bl_label = 'Load Repositories'
bl_description = 'Load repositories from disk'
bl_options = {'REGISTER'}
log = logging.getLogger(__name__ + '.BPKG_OT_load_repositories')
log = logging.getLogger(__name__ + '.PACKAGE_OT_load_repositories')
def create_subprocess(self):
"""
@@ -618,13 +618,13 @@ class USERPREF_PT_packages(bpy.types.Panel):
latest_pkg = pkg.get_latest_version()
if latest_pkg.installed:
if latest_pkg.url:
right.operator(BPKG_OT_uninstall.bl_idname,
right.operator(PACKAGE_OT_uninstall.bl_idname,
text="Uninstall").package_name=latest_pkg.name
else:
right.label("Installed")
else:
if latest_pkg.url:
right.operator(BPKG_OT_install.bl_idname,
right.operator(PACKAGE_OT_install.bl_idname,
text="Install").package_url=pkg.versions[0].url
else:
right.label("Not installed, but no URL?")
@@ -815,7 +815,7 @@ class PackageManagerPreferences(bpy.types.AddonPreferences):
temp_box = layout.box()
temp_box.label(text="Temporary stuff while we're developing")
temp_box.prop(self, 'repository_url')
temp_box.operator(BPKG_OT_refresh.bl_idname)
temp_box.operator(PACKAGE_OT_refresh.bl_idname)
def validate_packagelist(pkglist: list) -> list:
"""Ensures all packages have required fields; strips out bad packages and returns them in a list"""
@@ -857,13 +857,13 @@ def build_composite_packagelist(installed: list, available: list) -> OrderedDict
return OrderedDict(sorted(masterlist.items()))
def register():
bpy.utils.register_class(BPKG_OT_install)
bpy.utils.register_class(BPKG_OT_uninstall)
bpy.utils.register_class(BPKG_OT_refresh_repositories)
bpy.utils.register_class(BPKG_OT_refresh_packages)
bpy.utils.register_class(BPKG_OT_refresh)
bpy.utils.register_class(BPKG_OT_load_repositories)
bpy.utils.register_class(BPKG_OT_hang)
bpy.utils.register_class(PACKAGE_OT_install)
bpy.utils.register_class(PACKAGE_OT_uninstall)
bpy.utils.register_class(PACKAGE_OT_refresh_repositories)
bpy.utils.register_class(PACKAGE_OT_refresh_packages)
bpy.utils.register_class(PACKAGE_OT_refresh)
bpy.utils.register_class(PACKAGE_OT_load_repositories)
bpy.utils.register_class(PACKAGE_OT_hang)
bpy.utils.register_class(USERPREF_PT_packages)
bpy.utils.register_class(WM_OT_package_toggle_expand)
bpy.types.WindowManager.package_search = bpy.props.StringProperty(
@@ -883,13 +883,13 @@ def register():
def unregister():
bpy.utils.unregister_class(BPKG_OT_install)
bpy.utils.unregister_class(BPKG_OT_uninstall)
bpy.utils.unregister_class(BPKG_OT_refresh_repositories)
bpy.utils.unregister_class(BPKG_OT_refresh_packages)
bpy.utils.unregister_class(BPKG_OT_refresh)
bpy.utils.unregister_class(BPKG_OT_load_repositories)
bpy.utils.unregister_class(BPKG_OT_hang)
bpy.utils.unregister_class(PACKAGE_OT_install)
bpy.utils.unregister_class(PACKAGE_OT_uninstall)
bpy.utils.unregister_class(PACKAGE_OT_refresh_repositories)
bpy.utils.unregister_class(PACKAGE_OT_refresh_packages)
bpy.utils.unregister_class(PACKAGE_OT_refresh)
bpy.utils.unregister_class(PACKAGE_OT_load_repositories)
bpy.utils.unregister_class(PACKAGE_OT_hang)
bpy.utils.unregister_class(USERPREF_PT_packages)
bpy.utils.unregister_class(WM_OT_package_toggle_expand)
del bpy.types.WindowManager.package_search