File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97 )
1717* Pull-first with local build fallback for container images during deployment. (#97 )
1818
19+ ### Fixed
20+
21+ * Upload .py source instead of .pyc bytecode to decouple host Python version. (#38 , #59 )
22+
1923### Changed
2024
2125* Completed [ ARCHITECTURE.md] ( ./docs/ARCHITECTURE.md ) (#93 )
Original file line number Diff line number Diff line change 3939import functools
4040import io
4141import logging
42- import marshal
4342import os
4443import pathlib
4544import random
@@ -124,12 +123,9 @@ def run_python_container_command(self, command: str) -> dict:
124123 mode = "r" ,
125124 encoding = "utf-8"
126125 ) as memfile :
127- code_object = compile (memfile .read () + command , filename = nonce , mode = "exec" )
128- pyc_file = io .BytesIO ()
129- pyc_file .write (b'o\r \r \n \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 ' )
130- marshal .dump (code_object , pyc_file )
131- self .upload_file (content = pyc_file .getvalue (), remote_file_path = f'/opt/{ nonce } .pyc' )
132- _ , stdout , stderr = self .ssh_client .exec_command (f"python3 /opt/{ nonce } .pyc" )
126+ source = memfile .read () + command
127+ self .upload_file (content = source , remote_file_path = f'/opt/{ nonce } .py' )
128+ _ , stdout , stderr = self .ssh_client .exec_command (f"python3 /opt/{ nonce } .py" )
133129 return {
134130 "output" : stdout .read ().decode (),
135131 "error" : stderr .read ().decode ()
You can’t perform that action at this time.
0 commit comments