moved get_avalon_database and set_io_database to deprecated

This commit is contained in:
iLLiCiTiT 2020-11-03 10:54:10 +01:00
parent acb134c208
commit 15c03de485
3 changed files with 35 additions and 11 deletions

View file

@ -1,5 +1,10 @@
# -*- coding: utf-8 -*-
"""Pype lib module."""
from .deprecated import (
get_avalon_database,
set_io_database
)
from .lib_old import (
_subprocess,
get_paths_from_environ,
@ -19,8 +24,6 @@ from .lib_old import (
get_project,
get_version_from_path,
get_last_version_from_path,
get_avalon_database,
set_io_database,
get_subsets,
CustomNone,
get_linked_assets,
@ -38,6 +41,9 @@ from .hooks import PypeHook, execute_hook
from .plugin_tools import filter_pyblish_plugins
__all__ = [
"get_avalon_database",
"set_io_database",
"PypeHook",
"execute_hook",

View file

@ -0,0 +1,26 @@
import os
from avalon import io
def get_avalon_database():
"""Mongo database used in avalon's io.
* Function is not used in pype 3.0 where was replaced with usage of
AvalonMongoDB.
"""
if io._database is None:
set_io_database()
return io._database
def set_io_database():
"""Set avalon's io context with environemnts.
* Function is not used in pype 3.0 where was replaced with usage of
AvalonMongoDB.
"""
required_keys = ["AVALON_PROJECT", "AVALON_ASSET", "AVALON_SILO"]
for key in required_keys:
os.environ[key] = os.environ.get(key, "")
io.install()

View file

@ -13,6 +13,7 @@ import getpass
import acre
import platform
from pype.lib.hooks import execute_hook
from .deprecated import get_avalon_database
from avalon import io, pipeline
import avalon.api
@ -535,17 +536,8 @@ def get_last_version_from_path(path_dir, filter):
return None
def get_avalon_database():
if io._database is None:
set_io_database()
return io._database
def set_io_database():
required_keys = ["AVALON_PROJECT", "AVALON_ASSET", "AVALON_SILO"]
for key in required_keys:
os.environ[key] = os.environ.get(key, "")
io.install()
def get_subsets(asset_name,