Skip to content

Commit 0ec1634

Browse files
committed
Add initial support for venv and update related settings
1 parent 520cb5d commit 0ec1634

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
9+
## [unreleased] - Unreleased
10+
### Added
11+
- Initial support for venv
12+
813
## [3.4.4] - 2025-06-13
914
### Added
1015

src/iop/cls/IOP/BusinessProcess.cls

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ Storage Default
140140
<Value name="13">
141141
<Value>%PythonRuntimeLibraryVersion</Value>
142142
</Value>
143+
<Value name="14">
144+
<Value>%Venv</Value>
145+
</Value>
143146
</Data>
144147
<Data name="persistentProperties">
145148
<Attribute>persistentProperties</Attribute>

src/iop/cls/IOP/Common.cls

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Property %PythonInterpreterPath As %String(MAXLEN = 255);
2929

3030
Property %traceback As %Boolean [ InitialExpression = 1 ];
3131

32+
Property %Venv As %Boolean [ InitialExpression = 0 ];
33+
3234
Property %PythonPath As %String(MAXLEN = 255);
3335

3436
Property %PythonRuntimeLibrary As %String(MAXLEN = 255);
@@ -84,9 +86,17 @@ Method DisplayTraceback(ex) As %Status
8486
Method OnInit() As %Status
8587
{
8688
set tSC = $$$OK
89+
set tSemName = "^PythonSettings"
90+
if $SYSTEM.Semaphore.Open(tSemName) '= 1 {
91+
// Create the semaphore if it does not exist
92+
set tSC = $SYSTEM.Semaphore.Create(tSemName)
93+
}
8794
try {
8895
LOCK +^PythonSettings:5
89-
do ##class(IOP.Utils).SetPythonSettings(..%PythonRuntimeLibrary, ..%PythonPath, ..%PythonRuntimeLibraryVersion)
96+
97+
if ..%Venv {
98+
$$$ThrowOnError(##class(IOP.Utils).SetPythonSettings(..%PythonRuntimeLibrary, ..%PythonPath, ..%PythonRuntimeLibraryVersion))
99+
}
90100

91101
do ..DisplayPythonVersion()
92102

@@ -102,6 +112,7 @@ Method OnInit() As %Status
102112

103113
set tSC = ..DisplayTraceback(ex)
104114
}
115+
LOCK -^PythonSettings
105116
quit tSC
106117
}
107118

@@ -226,6 +237,11 @@ Method SetPropertyValues()
226237
set tSQL = tSQL _ " and name <> '%port'"
227238
set tSQL = tSQL _ " and name <> '%PythonInterpreterPath'"
228239
set tSQL = tSQL _ " and name <> '%traceback'"
240+
set tSQL = tSQL _ " and name <> '%PythonPath'"
241+
set tSQL = tSQL _ " and name <> '%PythonRuntimeLibrary'"
242+
set tSQL = tSQL _ " and name <> '%PythonRuntimeLibraryVersion'"
243+
set tSQL = tSQL _ " and name <> '%settings'"
244+
set tSQL = tSQL _ " and name <> '%Venv'"
229245

230246
set tStmt = ##class(%SQL.Statement).%New()
231247

src/iop/cls/IOP/Utils.cls

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ ClassMethod GenerateProxyClass(
240240
#; Do not display any of the connection settings
241241
#dim tSETTINGSParamValue As %String = "%classname:Python $type,%module:Python $type,%settings:Python $type,%classpaths:Python $type"
242242
set tSETTINGSParamValue = tSETTINGSParamValue_","_"%enable:Python Debug $type,%timeout:Python Debug $type,%port:Python Debug $type,%PythonInterpreterPath:Python Debug $type,%traceback:Python Debug $type"
243-
set tSETTINGSParamValue = tSETTINGSParamValue_","_"%PythonPath:Python Settings $type,%PythonRuntimeLibrary:Python Settings $type,%PythonRuntimeLibraryVersion:Python Settings $type"
243+
set tSETTINGSParamValue = tSETTINGSParamValue_","_"%PythonPath:Python Settings $type,%PythonRuntimeLibrary:Python Settings $type,%PythonRuntimeLibraryVersion:Python Settings $type,%Venv:Python Settings $type"
244244

245245
#dim tPropClassname As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
246246
Set tPropClassname.Name = "%classname"
@@ -468,10 +468,12 @@ ClassMethod dispatchTestComponent(
468468
ClassMethod SetPythonSettings(
469469
pPythonLib,
470470
pPythonPath,
471-
pPythonVersion)
471+
pPythonVersion) As %Status
472472
{
473473
set currentNS = $namespace
474474
set $NAMESPACE = "%SYS"
475+
set tSC = $$$OK
476+
475477
try {
476478
// Get Config
477479
$$$ThrowOnError(##Class(Config.config).Get(.Properties))
@@ -491,11 +493,11 @@ ClassMethod SetPythonSettings(
491493
}
492494
$$$ThrowOnError(##Class(Config.config).Modify(.Properties))
493495
} catch ex {
494-
set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
495-
set ^PLOG=msg
496+
set tSC = ex.AsStatus()
496497
}
497498

498499
set $NAMESPACE = currentNS
500+
Quit tSC
499501
}
500502

501503
}

0 commit comments

Comments
 (0)