2323# error: can't create or remove files in install directory
2424# (https://github.com/pypa/pip/issues/7953#issuecomment-645133255)
2525site .ENABLE_USER_SITE = "--user" in sys .argv [1 :]
26+
27+
2628class PostInstallCommand (install ):
2729 """Contains post install actions."""
2830
@@ -32,13 +34,14 @@ def __init__(self, *args, **kwargs):
3234
3335 @staticmethod
3436 def patch_holoscan ():
35- """ Patch Holoscan for its known issue of missing one import."""
37+ """Patch Holoscan for its known issue of missing one import."""
3638
3739 import importlib .util
3840 from pathlib import Path
3941
4042 def needed_to_patch ():
4143 from importlib .metadata import version
44+
4245 try :
4346 version = version ("holoscan" )
4447 # This issue exists in the following versions
@@ -58,7 +61,7 @@ def needed_to_patch():
5861 if spec :
5962 # holoscan core misses one class in its import in __init__.py
6063 module_to_add = " MultiMessageConditionInfo,"
61- module_path = Path (str (spec .origin )).parent .joinpath (' core/__init__.py' )
64+ module_path = Path (str (spec .origin )).parent .joinpath (" core/__init__.py" )
6265 print (f"Patching file { module_path } " )
6366 if module_path .exists ():
6467 lines_r = []
@@ -72,10 +75,10 @@ def needed_to_patch():
7275 existed = True
7376 break
7477 elif in_block and ")\n " in line_r :
75- # Need to add the missing class.
76- line_r = f"{ module_to_add } \n { line_r } "
77- in_block = False
78- print ("Added missing module in holoscan." )
78+ # Need to add the missing class.
79+ line_r = f"{ module_to_add } \n { line_r } "
80+ in_block = False
81+ print ("Added missing module in holoscan." )
7982
8083 lines_r .append (line_r )
8184
@@ -84,9 +87,10 @@ def needed_to_patch():
8487 f_w .writelines (lines_r )
8588 print ("Completed patching holoscan." )
8689
90+
8791setup (
8892 version = versioneer .get_version (),
89- cmdclass = versioneer .get_cmdclass ({' install' : PostInstallCommand }),
93+ cmdclass = versioneer .get_cmdclass ({" install" : PostInstallCommand }),
9094 packages = find_namespace_packages (include = ["monai.*" ]),
9195 include_package_data = True ,
9296 zip_safe = False ,
0 commit comments