From 36c246f07d4c9f07e2b530721257b8fba97417da Mon Sep 17 00:00:00 2001 From: nemanjarajic Date: Mon, 16 Aug 2021 16:02:15 -0700 Subject: [PATCH 1/3] Makes sure neuropod_path and python_root are not the same directory --- source/python/neuropod/backends/python/packager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/python/neuropod/backends/python/packager.py b/source/python/neuropod/backends/python/packager.py index 54b6058f..73e98d65 100644 --- a/source/python/neuropod/backends/python/packager.py +++ b/source/python/neuropod/backends/python/packager.py @@ -116,11 +116,13 @@ def addition_model(x, y): for copy_spec in code_path_spec: python_root = copy_spec["python_root"] - if os.path.realpath(neuropod_path).startswith( + #Ensures that neuropod_path is not a subdirectory of python_root + #Ensures neuropod_path and python_root are not the same directory + if os.path.samefile(neuropod_path,python_root) or os.path.realpath(neuropod_path).startswith( os.path.realpath(python_root) + os.sep ): raise ValueError( - "`neuropod_path` cannot be a subdirectory of `python_root`" + "`neuropod_path` cannot be the same directory as `python_root' or a subdirectory of `python_root`" ) for dir_to_package in copy_spec["dirs_to_package"]: From 182475e1aaab7ac0aa48e229fa6ca23ad039ec40 Mon Sep 17 00:00:00 2001 From: nemanjarajic Date: Mon, 16 Aug 2021 19:53:18 -0700 Subject: [PATCH 2/3] Making sure neuropod_path and python_root are not the same directory --- source/python/neuropod/backends/python/packager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/python/neuropod/backends/python/packager.py b/source/python/neuropod/backends/python/packager.py index 73e98d65..ff9a5c98 100644 --- a/source/python/neuropod/backends/python/packager.py +++ b/source/python/neuropod/backends/python/packager.py @@ -122,7 +122,7 @@ def addition_model(x, y): os.path.realpath(python_root) + os.sep ): raise ValueError( - "`neuropod_path` cannot be the same directory as `python_root' or a subdirectory of `python_root`" + "`neuropod_path` cannot be the same directory as `python_root' or a subdirectory of `python_root`." ) for dir_to_package in copy_spec["dirs_to_package"]: From fe795fd2c74c29fd5a7c3d1b948f714257a0c700 Mon Sep 17 00:00:00 2001 From: nemanjarajic Date: Mon, 16 Aug 2021 20:47:33 -0700 Subject: [PATCH 3/3] Packager.py change --- source/python/neuropod/backends/python/packager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/python/neuropod/backends/python/packager.py b/source/python/neuropod/backends/python/packager.py index ff9a5c98..73e98d65 100644 --- a/source/python/neuropod/backends/python/packager.py +++ b/source/python/neuropod/backends/python/packager.py @@ -122,7 +122,7 @@ def addition_model(x, y): os.path.realpath(python_root) + os.sep ): raise ValueError( - "`neuropod_path` cannot be the same directory as `python_root' or a subdirectory of `python_root`." + "`neuropod_path` cannot be the same directory as `python_root' or a subdirectory of `python_root`" ) for dir_to_package in copy_spec["dirs_to_package"]: