diff --git a/CHANGELOG.md b/CHANGELOG.md index f7f7f567..1cd56490 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - #822: The CPF resource processor now supports system expressions and macros in CPF merge files - #578 Added functionality to record and display IPM history of install, uninstall, load, and update - #961: Adding creation of a lock file for a module by using the `-create-lockfile` flag on install. +- #1024: Added flag -export-python-deps to publish command ### Changed - #316: All parameters, except developer mode, included with a `load`, `install` or `update` command will be propagated to dependencies diff --git a/src/cls/IPM/Lifecycle/Base.cls b/src/cls/IPM/Lifecycle/Base.cls index c90e0487..bc51042a 100644 --- a/src/cls/IPM/Lifecycle/Base.cls +++ b/src/cls/IPM/Lifecycle/Base.cls @@ -1183,10 +1183,6 @@ Method %Export( } } } - set exportPythonDependencies = $get(pParams("ExportPythonDependencies"), 0) - if exportPythonDependencies { - do ..ExportPythonDependencies(.pParams) - } // Deployed items should be exported as a studio project to a designated directory set tDeployedProjectName = ##class(%IPM.Utils.Module).GetDeployedProjectName(..Module.Name) @@ -1209,6 +1205,11 @@ Method %Export( do ..ExportSingleModule(.tSingleModuleArray, pTargetDirectory, .pDependencyGraph, .tParams, tVerbose) } + set exportPythonDependencies = $get(pParams("ExportPythonDependencies"), 0) + if exportPythonDependencies { + do ..ExportPythonDependencies(.pParams) + } + // Export the deployed project to the target directory, if it's non-empty if tDeployedProject.Items.Count() > 0 { // Intentionally not calling .%Save() on the project; we don't want to persist it. diff --git a/src/cls/IPM/Main.cls b/src/cls/IPM/Main.cls index 8734ec9a..ccc34b46 100644 --- a/src/cls/IPM/Main.cls +++ b/src/cls/IPM/Main.cls @@ -140,6 +140,7 @@ This command is an alias for `module-action module-name publish` + diff --git a/tests/integration_tests/Test/PM/Integration/ProcessPythonWheel.cls b/tests/integration_tests/Test/PM/Integration/ProcessPythonWheel.cls index e7e60e03..bc1b0a66 100644 --- a/tests/integration_tests/Test/PM/Integration/ProcessPythonWheel.cls +++ b/tests/integration_tests/Test/PM/Integration/ProcessPythonWheel.cls @@ -15,6 +15,8 @@ Parameter PackageWithPythonDepsLocation = "package-with-python-deps"; Parameter ExportPackageWithPythonDepsLocation = "export-package-with-python-deps"; +Parameter PublishWithPythonDepsLocation = "publish-with-python-deps"; + /// The PythonWheel resource processor expects to install wheels from the dist directory, as opposed to source code ClassMethod GenerateWheel() { @@ -199,4 +201,45 @@ Method TestPackageWithPythonDeps() As %Status do $$$AssertStatusOK(sc, "Deleted local filesystem repo") } +/// Test publishing with the -export-python-deps flag +Method TestPublishWithPythonDeps() As %Status +{ + set moduleName = "publish-with-python-deps" + + // Create a filesystem repository + set dir = ..GetModuleDir("python-deps-tests", ..#PublishWithPythonDepsLocation) + set sc = ##class(%IPM.Main).Shell("repo -fs -name localrepo -path "_dir) + do $$$AssertStatusOK(sc, "Configured local filesystem repo") + + // Install module from local filesystem repo + set sc = ##class(%IPM.Main).Shell("install -v localrepo/"_moduleName) + do $$$AssertStatusOK(sc, "Installed module from local filesystem repo") + + // Create a remote repository for publishing + set sc = ##class(%IPM.Main).Shell("repo -r -name remote -url http://registry:52773/registry -username admin -password SYS") + do $$$AssertStatusOK(sc, "Configured remote repo") + + // Publish module to remote repository + set sc = ##class(%IPM.Main).Shell("publish -v "_moduleName_" -r remote -export-python-deps") + do $$$AssertStatusOK(sc, "Published module "_moduleName_" to remote repository") + + // Uninstall module that came from filesystem repository + set sc = ##class(%IPM.Main).Shell("uninstall "_moduleName) + do $$$AssertStatusOK(sc, "Uninstalled module successfully") + + // Install published module from remote repository + set sc = ##class(%IPM.Main).Shell("install -v remote/"_moduleName) + do $$$AssertStatusOK(sc, "Successfully installed published module "_moduleName_" from remote repository") + + // Uninstall the module used for this test + set sc = ##class(%IPM.Main).Shell("uninstall "_moduleName) + do $$$AssertStatusOK(sc, "Uninstalled module "_moduleName_" successfully") + + // Remove the repositories used for this test + set sc = ##class(%IPM.Main).Shell("repo -delete -n localrepo") + do $$$AssertStatusOK(sc, "Removed local filesystem repo") + set sc = ##class(%IPM.Main).Shell("repo -delete -n remote") + do $$$AssertStatusOK(sc, "Removed remote repo") +} + } diff --git a/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/lune-1.6.2-py3-none-any.whl b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/lune-1.6.2-py3-none-any.whl new file mode 100644 index 00000000..e1c9f027 Binary files /dev/null and b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/lune-1.6.2-py3-none-any.whl differ diff --git a/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/module.xml b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/module.xml new file mode 100644 index 00000000..ba33b973 --- /dev/null +++ b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/module.xml @@ -0,0 +1,12 @@ + + + + + publish-with-python-deps + 1.6.2 + module + + + + + diff --git a/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/requirements.txt b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/requirements.txt new file mode 100644 index 00000000..47639bf9 --- /dev/null +++ b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/requirements.txt @@ -0,0 +1 @@ +lune==1.6.4 diff --git a/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/wheels/lune-1.6.4-py3-none-any.whl b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/wheels/lune-1.6.4-py3-none-any.whl new file mode 100644 index 00000000..f823326e Binary files /dev/null and b/tests/integration_tests/Test/PM/Integration/_data/python-deps-tests/publish-with-python-deps/wheels/lune-1.6.4-py3-none-any.whl differ