Creating an extension for ByteString for parsing pip stdout and modifying PyEnv install method.
This commit is contained in:
parent
dafde6dda2
commit
e4225d0bb1
6
src/ExtEnvi/ByteString.extension.st
Normal file
6
src/ExtEnvi/ByteString.extension.st
Normal file
@ -0,0 +1,6 @@
|
||||
Extension { #name : #ByteString }
|
||||
|
||||
{ #category : #'*ExtEnvi' }
|
||||
ByteString >> parsePipInstallStdout [
|
||||
^ self lines collect: [ :line | line splitOn: ':' ]
|
||||
]
|
@ -57,18 +57,19 @@ PyEnv >> install: packageName [
|
||||
|
||||
{ #category : #accessing }
|
||||
PyEnv >> install: aPackageName in: anEnvDirName [
|
||||
| bins pip |
|
||||
| bins pip stdout |
|
||||
(envs includesKey: anEnvDirName)
|
||||
ifFalse: [ InformDebugger inform: 'Env doesn''t exist'.
|
||||
^ self ].
|
||||
bins := (envs at: anEnvDirName) / 'bin'.
|
||||
pip := (bins / 'pip') fullName.
|
||||
^ GtSubprocessWithInMemoryOutput new
|
||||
workingDirectory: workingDirectory;
|
||||
command: pip;
|
||||
arguments: #('install' 'instaloader');
|
||||
runAndWait;
|
||||
stdout
|
||||
stdout := GtSubprocessWithInMemoryOutput new
|
||||
workingDirectory: workingDirectory;
|
||||
command: pip;
|
||||
arguments: #('install' 'instaloader');
|
||||
runAndWait;
|
||||
stdout.
|
||||
^ stdout parsePipInstallStdout
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user