Creating PyEnv class and fixing baseline.

This commit is contained in:
ruidajo 2024-09-09 18:13:17 -05:00
parent 80e4dcf5a3
commit 30b0d3f721
2 changed files with 42 additions and 3 deletions

View File

@ -7,7 +7,5 @@ Class {
{ #category : #baseline }
BaselineOfExtEnvi >> baseline: spec [
<baseline>
^ spec
for: #common
do: [ spec package: 'ExtEnvi' with: [ spec requires: #('GToolkit-Utility-System') ] ]
^ spec for: #common do: [ spec package: 'ExtEnvi' ]
]

View File

@ -0,0 +1,41 @@
Class {
#name : #PyEnv,
#superclass : #Object,
#instVars : [
'workingDirectory',
'pyVersion',
'pyBinLocation'
],
#category : #ExtEnvi
}
{ #category : #'as yet unclassified' }
PyEnv >> initialize [
super initialize
]
{ #category : #'as yet unclassified' }
PyEnv >> python3 [
pyVersion := (GtSubprocessWithInMemoryOutput new
command: 'python3';
arguments: #('--version');
runAndWait;
stdout) trimmed.
pyBinLocation := (GtSubprocessWithInMemoryOutput new
command: 'which';
arguments: #('python3');
runAndWait;
stdout) trimmed asFileReference.
^ {'location' -> pyBinLocation.
'version' -> pyVersion} asDictionary
]
{ #category : #accessing }
PyEnv >> workingDirectory [
^ workingDirectory ifNil: [ workingDirectory := (FileLocator documents / 'TempPythonEnv') ensureCreateDirectory ]
]
{ #category : #accessing }
PyEnv >> workingDirectory: aDirReference [
workingDirectory := aDirReference
]