Address comments on 67b1857e58
This commit is contained in:
@@ -240,9 +240,6 @@ class BPKG_OT_refresh(SubprocMixin, bpy.types.Operator):
|
||||
|
||||
log = logging.getLogger(__name__ + ".BPKG_OT_refresh")
|
||||
|
||||
def invoke(self, context, event):
|
||||
return super().invoke(context, event)
|
||||
|
||||
def create_subprocess(self):
|
||||
"""Starts the download process.
|
||||
|
||||
|
@@ -190,15 +190,14 @@ class Repository:
|
||||
|
||||
req_headers = {}
|
||||
# Do things this way to avoid adding empty objects/None to the req_headers dict
|
||||
if self._headers:
|
||||
try:
|
||||
req_headers['If-None-Match'] = self._headers['etag']
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
req_headers['If-Modified-Since'] = self._headers['last-modified']
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
req_headers['If-None-Match'] = self._headers['etag']
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
req_headers['If-Modified-Since'] = self._headers['last-modified']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
resp = requests.get(self.url, headers=req_headers)
|
||||
|
||||
@@ -253,22 +252,10 @@ class Repository:
|
||||
"""
|
||||
Get repository attributes from a dict such as produced by `to_dict`
|
||||
"""
|
||||
if repodict is None:
|
||||
repodict = {}
|
||||
|
||||
for attr in ('name', 'url', 'packages', '_headers'):
|
||||
if attr == 'packages':
|
||||
value = set(Package(pkg) for pkg in repodict.get('packages', []))
|
||||
else:
|
||||
value = repodict.get(attr)
|
||||
|
||||
if value is None:
|
||||
try:
|
||||
value = getattr(self, attr)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
setattr(self, attr, value)
|
||||
self.name = repodict.get('name', "")
|
||||
self.url = repodict.get('url', "")
|
||||
self.packages = [Package(pkg) for pkg in repodict.get('packages', [])]
|
||||
self._headers = repodict.get('_headers', [])
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, repodict: dict):
|
||||
@@ -464,8 +451,6 @@ def download_and_install(pipe_to_blender, package_url: str, install_path: pathli
|
||||
|
||||
log = logging.getLogger('%s.download_and_install' % __name__)
|
||||
|
||||
# log.debug(utils.user_resource('SCRIPTS', 'blorp'))
|
||||
|
||||
cache_dir = cache.cache_directory('downloads')
|
||||
downloaded = _download(pipe_to_blender, package_url, cache_dir)
|
||||
|
||||
@@ -479,7 +464,6 @@ def download_and_install(pipe_to_blender, package_url: str, install_path: pathli
|
||||
_install(pipe_to_blender, downloaded, install_path, search_paths)
|
||||
pipe_to_blender.send(Success())
|
||||
except InstallException as err:
|
||||
#TODO
|
||||
log.error("Failed to install package: %s", err)
|
||||
pipe_to_blender.send(InstallError(err))
|
||||
|
||||
|
Reference in New Issue
Block a user