Fix: replaced Python module "imp" with "implib"

Python 3.4.0 deprecated the "imp" module, and replaced it with
"importlib". This changes imp.reload() into implib.reload().

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1016
This commit is contained in:
Sybren A. Stüvel 2015-01-22 17:05:39 +11:00 committed by Campbell Barton
parent 4741a42e5d
commit d47e9be4fb
Notes: blender-bot 2023-02-14 19:49:50 +01:00
Referenced by issue #47811, Blender 2.8x / Python, Proposed Changes
44 changed files with 160 additions and 160 deletions

View File

@ -31,10 +31,10 @@ bl_info = {
"category": "Add Curve"}
if "bpy" in locals():
import imp
imp.reload(add_curve_aceous_galore)
imp.reload(add_curve_spirals)
imp.reload(add_curve_torus_knots)
import importlib
importlib.reload(add_curve_aceous_galore)
importlib.reload(add_curve_spirals)
importlib.reload(add_curve_torus_knots)
else:
from . import add_curve_aceous_galore

View File

@ -33,8 +33,8 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(utils)
import importlib
importlib.reload(utils)
else:
from add_curve_sapling import utils

View File

@ -30,8 +30,8 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(Boltfactory)
import importlib
importlib.reload(Boltfactory)
else:
from add_mesh_BoltFactory import Boltfactory

View File

@ -32,20 +32,20 @@ bl_info = {
}
if "bpy" in locals():
import imp
imp.reload(add_mesh_extra_objects)
imp.reload(add_mesh_twisted_torus)
imp.reload(add_mesh_gemstones)
imp.reload(add_mesh_gears)
imp.reload(add_mesh_3d_function_surface)
imp.reload(add_mesh_polysphere)
imp.reload(add_mesh_supertoroid)
imp.reload(add_mesh_pyramid)
imp.reload(add_mesh_torusknot)
imp.reload(add_mesh_honeycomb)
imp.reload(add_mesh_teapot)
imp.reload(add_mesh_pipe_joint)
imp.reload(add_mesh_solid)
import importlib
importlib.reload(add_mesh_extra_objects)
importlib.reload(add_mesh_twisted_torus)
importlib.reload(add_mesh_gemstones)
importlib.reload(add_mesh_gears)
importlib.reload(add_mesh_3d_function_surface)
importlib.reload(add_mesh_polysphere)
importlib.reload(add_mesh_supertoroid)
importlib.reload(add_mesh_pyramid)
importlib.reload(add_mesh_torusknot)
importlib.reload(add_mesh_honeycomb)
importlib.reload(add_mesh_teapot)
importlib.reload(add_mesh_pipe_joint)
importlib.reload(add_mesh_solid)
else:
from . import add_mesh_extra_objects

View File

@ -31,11 +31,11 @@ bl_info = {
"category": "Import-Export"}
if "bpy" in locals():
import imp
import importlib
if "import_bvh" in locals():
imp.reload(import_bvh)
importlib.reload(import_bvh)
if "export_bvh" in locals():
imp.reload(export_bvh)
importlib.reload(export_bvh)
import bpy
from bpy.props import (StringProperty,

View File

@ -35,11 +35,11 @@ bl_info = {
# To support reload properly, try to access a package var,
# if it's there, reload everything
if "bpy" in locals():
import imp
import importlib
if "import_nuke_chan" in locals():
imp.reload(import_nuke_chan)
importlib.reload(import_nuke_chan)
if "export_nuke_chan" in locals():
imp.reload(export_nuke_chan)
importlib.reload(export_nuke_chan)
import bpy

View File

@ -31,9 +31,9 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(coat)
imp.reload(tex)
import importlib
importlib.reload(coat)
importlib.reload(tex)
else:
from . import coat
from . import tex

View File

@ -46,8 +46,8 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(import_img)
import importlib
importlib.reload(import_img)
else:
from . import import_img

View File

@ -35,9 +35,9 @@ bl_info = {
# To support reload properly, try to access a package var,
# if it's there, reload everything
if "bpy" in locals():
import imp
import importlib
if "import_svg" in locals():
imp.reload(import_svg)
importlib.reload(import_svg)
import bpy

View File

@ -36,11 +36,11 @@ bl_info = {
# To support reload properly, try to access a package var,
# if it's there, reload everything
if "bpy" in locals():
import imp
import importlib
if "export_ply" in locals():
imp.reload(export_ply)
importlib.reload(export_ply)
if "import_ply" in locals():
imp.reload(import_ply)
importlib.reload(import_ply)
import os

View File

@ -33,11 +33,11 @@ bl_info = {
}
if "bpy" in locals():
import imp
import importlib
if "import_raw" in locals():
imp.reload(import_raw)
importlib.reload(import_raw)
if "export_raw" in locals():
imp.reload(export_raw)
importlib.reload(export_raw)
else:
import bpy

View File

@ -48,11 +48,11 @@ Import:
"""
if "bpy" in locals():
import imp
import importlib
if "stl_utils" in locals():
imp.reload(stl_utils)
importlib.reload(stl_utils)
if "blender_utils" in locals():
imp.reload(blender_utils)
importlib.reload(blender_utils)
import os

View File

@ -36,13 +36,13 @@ bl_info = {
# @todo write the wiki page
if "bpy" in locals():
import imp
import importlib
if "export_uv_eps" in locals():
imp.reload(export_uv_eps)
importlib.reload(export_uv_eps)
if "export_uv_png" in locals():
imp.reload(export_uv_png)
importlib.reload(export_uv_png)
if "export_uv_svg" in locals():
imp.reload(export_uv_svg)
importlib.reload(export_uv_svg)
import bpy

View File

@ -32,11 +32,11 @@ bl_info = {
"category": "Import-Export"}
if "bpy" in locals():
import imp
import importlib
if "import_3ds" in locals():
imp.reload(import_3ds)
importlib.reload(import_3ds)
if "export_3ds" in locals():
imp.reload(export_3ds)
importlib.reload(export_3ds)
import bpy

View File

@ -48,9 +48,9 @@ bl_info = {
# To support reload properly, try to access a package var,
# if it's there, reload everything
if 'bpy' in locals():
import imp
import importlib
if 'io_scene_ms3d.ms3d_ui' in locals():
imp.reload(io_scene_ms3d.ms3d_ui)
importlib.reload(io_scene_ms3d.ms3d_ui)
else:
from io_scene_ms3d.ms3d_ui import (
Ms3dImportOperator,
@ -74,8 +74,8 @@ from bpy.types import (
def register():
####################
# F8 - key
import imp
imp.reload(ms3d_ui)
import importlib
importlib.reload(ms3d_ui)
# F8 - key
####################

View File

@ -33,11 +33,11 @@ bl_info = {
"category": "Import-Export"}
if "bpy" in locals():
import imp
import importlib
if "import_obj" in locals():
imp.reload(import_obj)
importlib.reload(import_obj)
if "export_obj" in locals():
imp.reload(export_obj)
importlib.reload(export_obj)
import bpy

View File

@ -31,9 +31,9 @@ bl_info = {
"category": "Import-Export"}
if "bpy" in locals():
import imp
import importlib
if "export_vrml2" in locals():
imp.reload(export_vrml2)
importlib.reload(export_vrml2)
import os

View File

@ -31,11 +31,11 @@ bl_info = {
"category": "Import-Export"}
if "bpy" in locals():
import imp
import importlib
if "import_x3d" in locals():
imp.reload(import_x3d)
importlib.reload(import_x3d)
if "export_x3d" in locals():
imp.reload(export_x3d)
importlib.reload(export_x3d)
import bpy
from bpy.props import StringProperty, BoolProperty, EnumProperty, FloatProperty

View File

@ -31,11 +31,11 @@ bl_info = {
"category": "Import-Export"}
if "bpy" in locals():
import imp
import importlib
if "import_mdd" in locals():
imp.reload(import_mdd)
importlib.reload(import_mdd)
if "export_mdd" in locals():
imp.reload(export_mdd)
importlib.reload(export_mdd)
import bpy

View File

@ -32,8 +32,8 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(light_field_tools)
import importlib
importlib.reload(light_field_tools)
else:
from . import light_field_tools

View File

@ -32,7 +32,7 @@ bl_info = {
if "bpy" in locals():
import imp
import importlib
else:
from . import geom
from . import model

View File

@ -33,13 +33,13 @@ bl_info = {
}
if "bpy" in locals():
import imp
import importlib
if "mocap_constraints" in locals():
imp.reload(mocap_constraints)
importlib.reload(mocap_constraints)
if "retarget" in locals():
imp.reload(retarget)
importlib.reload(retarget)
if "mocap_tools" in locals():
imp.reload(mocap_tools)
importlib.reload(mocap_tools)
else:
import bpy
from bpy.props import (BoolProperty,

View File

@ -34,19 +34,19 @@ bl_info = {
# To support reload properly, try to access a package var, if it's there, reload everything
if "init_data" in locals():
import imp
imp.reload(model)
imp.reload(operators)
imp.reload(client)
imp.reload(slave)
imp.reload(master)
imp.reload(master_html)
imp.reload(utils)
imp.reload(balancing)
imp.reload(ui)
imp.reload(repath)
imp.reload(versioning)
imp.reload(baking)
import importlib
importlib.reload(model)
importlib.reload(operators)
importlib.reload(client)
importlib.reload(slave)
importlib.reload(master)
importlib.reload(master_html)
importlib.reload(utils)
importlib.reload(balancing)
importlib.reload(ui)
importlib.reload(repath)
importlib.reload(versioning)
importlib.reload(baking)
else:
from netrender import model
from netrender import operators

View File

@ -30,9 +30,9 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(fracture_ops)
imp.reload(fracture_setup)
import importlib
importlib.reload(fracture_ops)
importlib.reload(fracture_setup)
else:
from . import fracture_ops
from . import fracture_setup

View File

@ -30,8 +30,8 @@ bl_info = {
#if "bpy" in locals():
# import imp
# imp.reload(fracture_cell_setup)
# import importlib
# importlib.reload(fracture_cell_setup)
import bpy
from bpy.props import (StringProperty,

View File

@ -32,9 +32,9 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(ui)
imp.reload(operators)
import importlib
importlib.reload(ui)
importlib.reload(operators)
else:
import bpy
from bpy.props import (StringProperty,

View File

@ -33,10 +33,10 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(operator)
imp.reload(panel)
imp.reload(translations)
import importlib
importlib.reload(operator)
importlib.reload(panel)
importlib.reload(translations)
else:
from . import operator, panel, translations

View File

@ -32,10 +32,10 @@ bl_info = {
}
if "bpy" in locals():
import imp
imp.reload(ui)
imp.reload(render)
imp.reload(update_files)
import importlib
importlib.reload(ui)
importlib.reload(render)
importlib.reload(update_files)
else:
import bpy

View File

@ -17,7 +17,7 @@
# ##### END GPL LICENSE BLOCK #####
import xmlrpc.client
import imp
import importlib
import time
import bpy
@ -31,9 +31,9 @@ def _is_dev():
pwfile = bpy.utils.user_resource('CONFIG', 'rffi', True)
pwmod = None
try:
pwmod = imp.find_module('rffi_dev',[pwfile])
pwmod = implib.find_module('rffi_dev',[pwfile])
try:
user_creds = imp.load_module('rffi_dev', pwmod[0], pwmod[1], pwmod[2])
user_creds = implib.load_module('rffi_dev', pwmod[0], pwmod[1], pwmod[2])
if 'dev' in dir(user_creds) and user_creds.dev:
is_dev = True
except ImportError:
@ -52,9 +52,9 @@ def _be_verbose():
pwfile = bpy.utils.user_resource('CONFIG', 'rffi', True)
pwmod = None
try:
pwmod = imp.find_module('rffi_dev',[pwfile])
pwmod = implib.find_module('rffi_dev',[pwfile])
try:
user_creds = imp.load_module('rffi_dev', pwmod[0], pwmod[1], pwmod[2])
user_creds = implib.load_module('rffi_dev', pwmod[0], pwmod[1], pwmod[2])
if 'verbose' in dir(user_creds) and user_creds.verbose:
be_verbose = True
except ImportError:

View File

@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####
import imp
import importlib
from os.path import join
@ -37,12 +37,12 @@ def _read_credentials():
pwfile = bpy.utils.user_resource('CONFIG', 'rffi', True)
try:
pwmod = imp.find_module('rffi_credentials',[pwfile])
pwmod = implib.find_module('rffi_credentials',[pwfile])
except ImportError:
_write_credentials('', '')
pwmod = imp.find_module('rffi_credentials',[pwfile])
pwmod = implib.find_module('rffi_credentials',[pwfile])
try:
user_creds = imp.load_module('rffi_credentials', pwmod[0], pwmod[1], pwmod[2])
user_creds = implib.load_module('rffi_credentials', pwmod[0], pwmod[1], pwmod[2])
bpy.rffi_user = user_creds.user
bpy.rffi_hash = user_creds.hash
bpy.rffi_creds_found = True
@ -50,9 +50,9 @@ def _read_credentials():
# doesn't exist yet, write template
_write_credentials('', '')
pwfile = bpy.utils.user_resource('CONFIG', 'rffi', True)
pwmod = imp.find_module('rffi_credentials',[pwfile])
pwmod = implib.find_module('rffi_credentials',[pwfile])
try:
user_creds = imp.load_module('rffi_credentials', pwmod[0], pwmod[1], pwmod[2])
user_creds = implib.load_module('rffi_credentials', pwmod[0], pwmod[1], pwmod[2])
bpy.rffi_user = user_creds.user
bpy.rffi_hash = user_creds.hash
bpy.rffi_creds_found = True

View File

@ -32,12 +32,12 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(generate)
imp.reload(ui)
imp.reload(utils)
imp.reload(metarig_menu)
imp.reload(rig_lists)
import importlib
importlib.reload(generate)
importlib.reload(ui)
importlib.reload(utils)
importlib.reload(metarig_menu)
importlib.reload(rig_lists)
else:
from . import utils, rig_lists, generate, ui, metarig_menu

View File

@ -19,12 +19,12 @@
# <pep8 compliant>
import bpy
import imp
import importlib
from . import fk, ik, deform
imp.reload(fk)
imp.reload(ik)
imp.reload(deform)
importlib.reload(fk)
importlib.reload(ik)
importlib.reload(deform)
script = """
fk_arm = ["%s", "%s", "%s"]

View File

@ -19,12 +19,12 @@
# <pep8 compliant>
import bpy
import imp
import importlib
from . import fk, ik, deform
imp.reload(fk)
imp.reload(ik)
imp.reload(deform)
importlib.reload(fk)
importlib.reload(ik)
importlib.reload(deform)
script = """
fk_leg = ["%s", "%s", "%s", "%s"]

View File

@ -1,5 +1,5 @@
import bpy
import imp
import importlib
import importlib
from ...utils import create_widget

View File

@ -277,8 +277,8 @@ class Generate(bpy.types.Operator):
bl_options = {'UNDO'}
def execute(self, context):
import imp
imp.reload(generate)
import importlib
importlib.reload(generate)
use_global_undo = context.user_preferences.edit.use_global_undo
context.user_preferences.edit.use_global_undo = False

View File

@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
import imp
import importlib
import importlib
import math
import random
@ -647,7 +647,7 @@ def get_rig_type(rig_type):
"""
name = ".%s.%s" % (RIG_DIR, rig_type)
submod = importlib.import_module(name, package=MODULE_NAME)
imp.reload(submod)
importlib.reload(submod)
return submod
@ -656,7 +656,7 @@ def get_metarig_module(metarig_name):
"""
name = ".%s.%s" % (METARIG_DIR, metarig_name)
submod = importlib.import_module(name, package=MODULE_NAME)
imp.reload(submod)
importlib.reload(submod)
return submod

View File

@ -33,9 +33,9 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(utils)
imp.reload(draw)
import importlib
importlib.reload(utils)
importlib.reload(draw)
else:
from . import utils, draw

View File

@ -32,9 +32,9 @@ bl_info = {
# To support reload properly, try to access a package var, if it's there, reload everything
if "bpy" in locals():
import imp
import importlib
if "config" in locals():
imp.reload(config)
importlib.reload(config)
import bpy

View File

@ -33,12 +33,12 @@ bl_info = {
if "bpy" in locals():
import imp
imp.reload(settings)
imp.reload(edit_translation)
imp.reload(update_svn)
imp.reload(update_addon)
imp.reload(update_ui)
import importlib
importlib.reload(settings)
importlib.reload(edit_translation)
importlib.reload(update_svn)
importlib.reload(update_addon)
importlib.reload(update_ui)
else:
import bpy
from . import (settings,

View File

@ -19,9 +19,9 @@
# <pep8 compliant>
if "bpy" in locals():
import imp
imp.reload(settings)
imp.reload(utils_i18n)
import importlib
importlib.reload(settings)
importlib.reload(utils_i18n)
else:
import bpy
from bpy.props import (BoolProperty,

View File

@ -19,8 +19,8 @@
# <pep8 compliant>
if "bpy" in locals():
import imp
imp.reload(settings_i18n)
import importlib
importlib.reload(settings_i18n)
else:
import bpy
from bpy.props import (BoolProperty,

View File

@ -19,10 +19,10 @@
# <pep8 compliant>
if "bpy" in locals():
import imp
imp.reload(settings)
imp.reload(utils_i18n)
imp.reload(bl_extract_messages)
import importlib
importlib.reload(settings)
importlib.reload(utils_i18n)
importlib.reload(bl_extract_messages)
else:
import bpy
from bpy.props import (BoolProperty,

View File

@ -19,10 +19,10 @@
# <pep8 compliant>
if "bpy" in locals():
import imp
imp.reload(settings)
imp.reload(utils_i18n)
imp.reload(utils_languages_menu)
import importlib
importlib.reload(settings)
importlib.reload(utils_i18n)
importlib.reload(utils_languages_menu)
else:
import bpy
from bpy.props import (BoolProperty,

View File

@ -19,9 +19,9 @@
# <pep8 compliant>
if "bpy" in locals():
import imp
imp.reload(settings)
imp.reload(utils_i18n)
import importlib
importlib.reload(settings)
importlib.reload(utils_i18n)
else:
import bpy
from bpy.props import (BoolProperty,