Skip to content

Commit

Permalink
[Port]: PythonBridge Pipfile Generation Hack to Latest GT
Browse files Browse the repository at this point in the history
  • Loading branch information
seandenigris committed Dec 28, 2023
1 parent 6ca5922 commit bcdbaa9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
18 changes: 9 additions & 9 deletions src/Dynabook-GToolkit/DbSoup.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Extension { #name : #DbSoup }

{ #category : #'*Dynabook-GToolkit' }
DbSoup class >> addSourceForOlReferencedClass: aClass withBuilder: aBlock [
"Convenience message because usually one wants to add to both ObjectiveLepiter (to support per-instance pages) and DbSoup"

^ self uniqueInstance
addSourceForOlReferencedClass: aClass
withBuilder: aBlock
]

{ #category : #'*Dynabook-GToolkit' }
DbSoup >> addSourceForOlReferencedClass: aClass withBuilder: aBlock [

Expand All @@ -9,12 +18,3 @@ DbSoup >> addSourceForOlReferencedClass: aClass withBuilder: aBlock [

self sources add: aBlock value
]

{ #category : #'*Dynabook-GToolkit' }
DbSoup class >> addSourceForOlReferencedClass: aClass withBuilder: aBlock [
"Convenience message because usually one wants to add to both ObjectiveLepiter (to support per-instance pages) and DbSoup"

^ self uniqueInstance
addSourceForOlReferencedClass: aClass
withBuilder: aBlock
]
22 changes: 2 additions & 20 deletions src/Dynabook-GToolkit/PBPharoPlatform.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,12 @@ Extension { #name : #PBPharoPlatform }
{ #category : #'*Dynabook-GToolkit' }
PBPharoPlatform >> copyApplicationTo: appFolder application: application [
"Copy the PythonBridge runtime environment to the specified folder"
| srcDir cpCommand proc srcFilename dstFilename error defaultPipfile projectPipfiles |

| srcDir defaultPipfile projectPipfiles |
srcDir := self runtimeSourceDirectoryFor: application.
srcDir resolve = appFolder resolve ifTrue: [ ^ self ].

"Copy the runtime directory"
srcFilename := srcDir resolve fullName copyReplaceAll: '"' with: '\"'.
dstFilename := appFolder resolve fullName copyReplaceAll: '"' with: '\"'.
cpCommand := String streamContents: [ :stream |
stream
<< 'cp -a "';
<< srcFilename;
<< '" "';
<< dstFilename;
<< '"' ].
proc := GtSubprocessWithInMemoryOutput new
shellCommand: cpCommand;
runAndWait.
proc isSuccess ifFalse:
[ error := PBPythonProcessError new
messageText: 'Unable to install PythonBridge runtime';
application: application;
process: proc.
error signal ].
srcDir resolve copyAllTo: appFolder resolve.

self flag: 'From here to the end is a hack added by the Dynabook project'.
defaultPipfile := (appFolder / 'Pipfile') ensureDelete ensureCreateFile asRlResource
Expand Down

0 comments on commit bcdbaa9

Please sign in to comment.