Skip to content

Commit

Permalink
Merge pull request #38 from daimor/master
Browse files Browse the repository at this point in the history
support ipm from embedded python
  • Loading branch information
evshvarov authored Sep 1, 2023
2 parents a5cd806 + 8ac0e9b commit 2297c1c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**
!docker-entrypoint.sh
!iriscli
!iriscli
!iris_ipm.py
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ COPY --from=0 --chown=${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /usr/iriss

ENV PATH="$PATH:/home/irisowner/.local/bin"

RUN pip install irissqlcli
COPY iris_ipm.py /usr/irissys/lib/python/

RUN pip install irissqlcli && \
cat /usr/irissys/lib/python/iris_ipm.py >> /usr/irissys/lib/python/iris.py

COPY iriscli /home/irisowner/bin/

Expand Down Expand Up @@ -88,7 +91,10 @@ COPY --from=0 --chown=${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} /usr/iriss

ENV PATH="$PATH:/home/irisowner/.local/bin"

RUN pip install irissqlcli
COPY iris_ipm.py /usr/irissys/lib/python/

RUN pip install irissqlcli && \
cat /usr/irissys/lib/python/iris_ipm.py >> /usr/irissys/lib/python/iris.py

COPY iriscli /home/irisowner/bin/

Expand Down
41 changes: 41 additions & 0 deletions iris_ipm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
def ipm(cmd, *args):
"""
Executes shell command with IPM:
Parameters
----------
cmd : str
The command to execute
Examples
--------
`ipm('help')`
`ipm('load /home/irisowner/dev -v')`
`ipm('install webterminal')`
"""

import multiprocessing

def shell(cmd, status):
import iris

status.put(True)

res = iris.cls("%ZPM.PackageManager").Shell(cmd)
print('')
if res != 1:
status.get()
status.put(False)

manager = multiprocessing.Manager()
status = manager.Queue()
process = multiprocessing.Process(
target=shell,
args=(
cmd,
status,
),
)
process.start()
process.join()
return status.get()

0 comments on commit 2297c1c

Please sign in to comment.