Remove uninstall feature, as the built-in Blender remove plugin now handles this

This commit is contained in:
Dion Moult
2020-04-07 12:57:07 +10:00
parent 4c3051267e
commit 503fcee432
3 changed files with 1 additions and 42 deletions
@@ -94,7 +94,6 @@ if bpy is not None:
operator.AssignContext,
operator.SetViewPreset1,
operator.OpenUpstream,
operator.Uninstall,
prop.BcfTopic,
prop.BcfTopicLabel,
prop.BcfTopicFile,
@@ -1576,41 +1576,3 @@ class OpenUpstream(bpy.types.Operator):
elif self.page == 'community':
webbrowser.open('https://community.osarch.org/')
return {'FINISHED'}
class Uninstall(bpy.types.Operator):
bl_idname = 'bim.uninstall'
bl_label = 'Uninstall BlenderBIM'
def execute(self, context):
import shutil
import glob
cwd = os.path.dirname(os.path.realpath(__file__))
addon_dir = os.path.join(cwd, '..')
files = ['ifcdiff.py', 'ordered_set.py', 'pyparsing.py', 'six.py']
directories = ['OCC', 'bcfplugin', 'dateutil', 'deepdiff',
'elementpath', 'ifcopenshell', 'jsonpickle', 'lib', 'pystache',
'pytz', 'svgwrite', 'xmlschema']
for f in files:
path = os.path.join(addon_dir, f)
if os.path.isfile(path):
os.remove(path)
lib_dir = os.path.join(cwd, '..', 'lib')
lib_files = glob.glob(os.path.join(lib_dir, '..', '..', '..', 'lib*.so*'))
for lib_file in lib_files:
try:
os.remove(lib_file)
except:
print('Error while deleting file: ', lib_file)
shutil.rmtree(os.path.join(lib_dir, '..', '..', '..', 'oce-0.17'), ignore_errors=True)
for directory in directories:
path = os.path.join(addon_dir, directory)
shutil.rmtree(path, ignore_errors=True)
bpy.ops.preferences.addon_remove(module='blenderbim')
return {'FINISHED'}
@@ -842,7 +842,7 @@ class BIM_UL_topics(bpy.types.UIList):
class BIM_ADDON_preferences(bpy.types.AddonPreferences):
bl_idname = __package__
bl_idname = 'blenderbim'
def draw(self, context):
layout = self.layout
@@ -852,5 +852,3 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
row = layout.row()
row.operator('bim.open_upstream', text='Visit Wiki').page = 'wiki'
row.operator('bim.open_upstream', text='Visit Community').page = 'community'
row = layout.row()
row.operator('bim.uninstall')