feat: add replication as a submoduke

This commit is contained in:
Swann 2021-05-04 14:56:50 +02:00
parent 0efe5d5a10
commit 58d639e9d8
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
4 changed files with 18 additions and 9 deletions

3
.gitmodules vendored
View File

@ -0,0 +1,3 @@
[submodule "multi_user/libs/replication"]
path = multi_user/libs/replication
url = git@gitlab.com:slumber/replication.git

View File

@ -44,9 +44,10 @@ from . import environment
DEPENDENCIES = {
("replication", '0.1.33'),
"pyzmq",
"deepdiff"
}
LIBS = os.path.dirname(os.path.abspath(__file__))+"/libs/replication"
module_error_msg = "Insufficient rights to install the multi-user \
dependencies, aunch blender with administrator rights."
@ -65,6 +66,13 @@ def register():
environment.setup(DEPENDENCIES, python_binary_path)
if LIBS in sys.path:
logging.debug('Third party module already added')
else:
logging.info('Adding local modules dir to the path')
sys.path.insert(0, LIBS)
from . import presence
from . import operators
from . import ui

View File

@ -50,7 +50,7 @@ def install_pip():
subprocess.run([str(PYTHON_PATH), "-m", "ensurepip"])
def install_package(name, version):
def install_package(name):
logging.info(f"installing {name} version...")
env = os.environ
if "PIP_REQUIRE_VIRTUALENV" in env:
@ -60,7 +60,7 @@ def install_package(name, version):
# env var for the subprocess.
env = os.environ.copy()
del env["PIP_REQUIRE_VIRTUALENV"]
subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", f"{name}=={version}"], env=env)
subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", f"{name}"], env=env)
if name in sys.modules:
del sys.modules[name]
@ -103,9 +103,7 @@ def setup(dependencies, python_path):
if not module_can_be_imported("pip"):
install_pip()
for package_name, package_version in dependencies:
for package_name in dependencies:
if not module_can_be_imported(package_name):
install_package(package_name, package_version)
install_package(package_name)
module_can_be_imported(package_name)
elif not check_package_version(package_name, package_version):
install_package(package_name, package_version)

@ -1 +1 @@
Subproject commit 001fbdc60da58a5e3b7006f1d782d6f472c12809
Subproject commit ce10f9da8958d908096dc2bdb4ef0010c9865033