Skip to content

Commit

Permalink
Fix API documentation workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Dec 11, 2024
1 parent 79b8e7a commit 0d47047
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-and-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: |
cd yoda/docker/compose
docker exec provider.yoda sh -c 'set -x ; cd /etc/irods/yoda-ruleset && sudo chown irods:irods -R /etc/irods/yoda-ruleset && sudo -u irods git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && sudo -u irods git pull && sudo -u irods git status'
docker exec provider.yoda sh -c "set -x ; cd /etc/irods/yoda-ruleset && sudo -u irods git checkout ${{ steps.extract_branch.outputs.branch }} && sudo -u irods python -m pip --no-cache-dir install --user -r /etc/irods/yoda-ruleset/requirements.txt && sudo -u irods make && sudo -u irods make install"
docker exec provider.yoda sh -c "set -x ; cd /etc/irods/yoda-ruleset && sudo -u irods git checkout ${{ steps.extract_branch.outputs.branch }} && sudo -u irods python3 -m pip --no-cache-dir install --user --break-system-packages -r /etc/irods/yoda-ruleset/requirements.txt && sudo -u irods make && sudo -u irods make install"
docker exec provider.yoda sh -c "set -x ; sudo -u irods /var/lib/irods/irodsctl restart"
- name: Pull and install latest version of portal
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/api-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [2.7]
python-version: [3.12]
steps:
- uses: actions/checkout@v4

- name: Set up Python
# setup-python stopped supporting Python 2.7, use https://github.com/MatteoH2O1999/setup-python
uses: MatteoH2O1999/[email protected]
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-build: info
cache-build: true
architecture: x64

- name: Install dependencies
run: |
Expand Down
29 changes: 17 additions & 12 deletions tools/api/generate-openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,21 @@
This module imports (and therefore executes) ruleset code.
Do not run it on untrusted codebases.
"""
from __future__ import print_function

__copyright__ = 'Copyright (c) 2020-2024, Utrecht University'
__license__ = 'GPLv3, see LICENSE'

__author__ = ('Chris Smeele')
__author__ = ('Lazlo Westerhof')
__author__ = ('Chris Smeele')
__author__ = ('Lazlo Westerhof')
# (in alphabetical order)

import sys
import re
import argparse
import inspect
import json

from importlib import import_module
import re
import sys
from collections import OrderedDict

import argparse
from importlib import import_module

parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('ruleset', metavar='RULESET', type=str,
Expand All @@ -44,6 +41,7 @@
core = args.core
module = args.module


# Strategy: Import the requested ruleset with an instrumented environment, and
# apply introspection to extract API function information.

Expand All @@ -55,9 +53,15 @@ class Sandbag(object):
Used as a stub for various internal irods modules so that we can import
rulesets without errors.
"""
def __init__(self, *_, **kw): self._data = kw
def __call__(self, *_, **__): return Sandbag()
def __getattr__(self, k): return self._data.get(k, Sandbag())
def __init__(self, *_, **kw):
self._data = kw

def __call__(self, *_, **__):
return Sandbag()

def __getattr__(self, k):
return self._data.get(k, Sandbag())

def __setattr__(self, k, v):
if k == '_data':
return super(Sandbag, self).__setattr__(k, v)
Expand All @@ -80,6 +84,7 @@ def f(g):
return g
return f


# Inject iRODS modules.
sys.modules['irods_types'] = Sandbag()
sys.modules['genquery'] = Sandbag()
Expand Down

0 comments on commit 0d47047

Please sign in to comment.