From 8ef505fb47f2374ae3d9be05830e769d21fdfa18 Mon Sep 17 00:00:00 2001 From: jerger Date: Thu, 12 May 2022 09:24:19 +0200 Subject: [PATCH] activate venv in termials --- .../provs/desktop/domain/DesktopService.kt | 2 +- .../provs/desktop/infrastructure/Python.kt | 9 +++++---- .../provs/desktop/infrastructure/PythonKtTest.kt | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt index 5addf61..568f1cb 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt @@ -107,7 +107,7 @@ fun Prov.provisionWorkplace( installDevOps() - installPython() + provisionPython() } ProvResult(true) } diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Python.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Python.kt index 1e384e1..08d5793 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Python.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Python.kt @@ -5,9 +5,9 @@ import org.domaindrivenarchitecture.provs.framework.core.ProvResult import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall -fun Prov.installPython() = task { +fun Prov.provisionPython() = task { installPython3() - installVenv() + configureVenv() installPybuilder() installRestClient() installJupyterlab() @@ -17,10 +17,11 @@ fun Prov.installPython3(): ProvResult = task { aptInstall("python3.8-venv python3-pip") } -fun Prov.installVenv(): ProvResult = task { - val venvHome = "~/.python/meissa" +fun Prov.configureVenv(): ProvResult = task { + val venvHome = "~/.venv/meissa" cmd("python3 -m venv " + venvHome) cmd("source " + venvHome + "/bin/activate") + cmd("ln -s " + venvHome + "/bin/activate ~/.bashrc.d/venv.sh") cmd("pip3 install pip --upgrade") } diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PythonKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PythonKtTest.kt index e4d5d46..939ce31 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PythonKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PythonKtTest.kt @@ -9,7 +9,7 @@ internal class PythonKtTest { @ExtensiveContainerTest fun installPython() { // when - val res = defaultTestContainer().installPython() + val res = defaultTestContainer().provisionPython() // then assertTrue(res.success)