Fix inport errors and maintain compatibility with python 3.5x)

This commit is contained in:
Ellwood Zwovic
2017-07-22 20:14:09 -07:00
parent 6752108930
commit 06a05c81b2
4 changed files with 38 additions and 27 deletions

View File

@@ -6,8 +6,8 @@ import logging
import pathlib
import shutil
import json
from .bpkg import utils
from .bpkg import Package, Repository
from .messages import *
from .bpkg.exceptions import *
@@ -114,7 +114,7 @@ def _install(pipe_to_blender, pkgpath: pathlib.Path, dest: pathlib.Path, searchp
# The following is adapted from `addon_install` in bl_operators/wm.py
# check to see if the file is in compressed format (.zip)
if zipfile.is_zipfile(pkgpath):
if zipfile.is_zipfile(str(pkgpath)):
log.debug("Package is zipfile")
try:
file_to_extract = zipfile.ZipFile(str(pkgpath), 'r')
@@ -135,7 +135,7 @@ def _install(pipe_to_blender, pkgpath: pathlib.Path, dest: pathlib.Path, searchp
backups = []
for conflict in conflicts:
log.debug("Creating backup of conflict %s", conflict)
backups.append(InplaceBackup(conflict))
backups.append(utils.InplaceBackup(conflict))
try:
file_to_extract.extractall(str(dest))
@@ -152,7 +152,7 @@ def _install(pipe_to_blender, pkgpath: pathlib.Path, dest: pathlib.Path, searchp
dest_file = (dest / pkgpath.name)
if dest_file.exists():
backup = InplaceBackup(dest_file)
backup = utils.InplaceBackup(dest_file)
try:
shutil.copyfile(str(pkgpath), str(dest_file))