From 736418564241deb220392ad0711e1a659a3f4a46 Mon Sep 17 00:00:00 2001
From: Phil Elson <philip.elson@cern.ch>
Date: Tue, 19 Oct 2021 12:18:22 +0200
Subject: [PATCH] Use the new Manager.jvm_required method in order to ensure
 that all cmmnbuild-dep-manager dependants get their JARs resolved correctly
 before the JVM starts up.

---
 pjlsa/__init__.py             | 2 +-
 pjlsa/{pjlsa.py => _pjlsa.py} | 7 +++----
 setup.py                      | 6 +++++-
 3 files changed, 9 insertions(+), 6 deletions(-)
 rename pjlsa/{pjlsa.py => _pjlsa.py} (99%)

diff --git a/pjlsa/__init__.py b/pjlsa/__init__.py
index 035789f..dc8c244 100644
--- a/pjlsa/__init__.py
+++ b/pjlsa/__init__.py
@@ -16,6 +16,6 @@ __stubgen_packages__ = [
     "cern.japc.value"
 ]
 
-from .pjlsa import LSAClient
+from ._pjlsa import LSAClient
 
 __all__ = ["LSAClient"]
diff --git a/pjlsa/pjlsa.py b/pjlsa/_pjlsa.py
similarity index 99%
rename from pjlsa/pjlsa.py
rename to pjlsa/_pjlsa.py
index e2074ee..6fbb92c 100644
--- a/pjlsa/pjlsa.py
+++ b/pjlsa/_pjlsa.py
@@ -1,8 +1,7 @@
-# -*- coding: utf-8 -*-
 """
 PJLSA -- A Python wrapping of Java LSA API
 
-Copyright (c) CERN 2015-2017
+Copyright (c) CERN 2015-2021
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in
@@ -110,8 +109,8 @@ def _toJavaList(lst):
 
 class LSAClient(object):
     def __init__(self, server="gpn"):
-        self._mgr = cmmnbuild_dep_manager.Manager("pjlsa")
-        self._jpype = self._mgr.start_jpype_jvm()
+        self._mgr = cmmnbuild_dep_manager.Manager()
+        self._mgr.jvm_required()
 
         # basic Java packages
         self._cern = jpype.JPackage("cern")
diff --git a/setup.py b/setup.py
index 32f0bbe..38178e5 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,11 @@ import os
 import setuptools
 
 REQUIREMENTS: dict = {
-    "core": ["cmmnbuild-dep-manager>=2.5.0,<3.*", "jpype1>=1.2.1,<2.*", "numpy"],
+    "core": [
+        "cmmnbuild-dep-manager~=2.9",
+        "jpype1>=1.2.1,<2.*",
+        "numpy",
+    ],
     "test": ["pytest", ],
 }
 
-- 
GitLab