Skip to content

Commit

Permalink
Merge pull request #26 from online-judge-tools/fix/workaround-for-con…
Browse files Browse the repository at this point in the history
…flict

Add a workaround for the conflict of the module name
  • Loading branch information
kmyk authored May 3, 2020
2 parents e184e95 + 9f0a1ef commit 28739b8
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
pip3 install .
pip3 install setuptools wheel
# see https://github.com/online-judge-tools/oj/issues/755<Paste>
- name: Workaround for the conflict of the module name
run: bash workaround_for_conflict.sh

- name: Build package
run: python3 setup.py bdist_wheel

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test-unstable-workaround-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ jobs:
pip3 install --upgrade setuptools
pip3 install .[dev]
# see https://github.com/online-judge-tools/oj/issues/755<Paste>
- name: Workaround for the conflict of the module name
run: bash workaround_for_conflict.sh

- name: Load balancing
id: load-balancing
run: |
python -m tests.load_balancer ${{ matrix.pattern }}
python -m tests_workaround_for_conflict.load_balancer ${{ matrix.pattern }}
- name: Run tests
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test-unstable-workaround-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ jobs:
pip3 install --upgrade setuptools
pip3 install .[dev]
# see https://github.com/online-judge-tools/oj/issues/755<Paste>
- name: Workaround for the conflict of the module name
run: bash workaround_for_conflict.sh

- name: Load balancing
id: load-balancing
run: |
python -m tests.load_balancer ${{ matrix.pattern }}
python -m tests_workaround_for_conflict.load_balancer ${{ matrix.pattern }}
- name: Run tests
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ jobs:
pip3 install --upgrade setuptools
pip3 install .[dev]
# see https://github.com/online-judge-tools/oj/issues/755<Paste>
- name: Workaround for the conflict of the module name
run: bash workaround_for_conflict.sh

- name: Load balancing
id: load-balancing
run: |
python -m tests.load_balancer ${{ matrix.pattern }}
python -m tests_workaround_for_conflict.load_balancer ${{ matrix.pattern }}
- name: Run tests
run: |
Expand Down
19 changes: 19 additions & 0 deletions workaround_for_conflict.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
replace='
s/\(import\|from\) onlinejudge\>/\1 onlinejudge_workaround_for_conflict/
/\('\''\|"\).*onlinejudge/ ! {
s/\<onlinejudge\.\(\w\+\)/onlinejudge_workaround_for_conflict.\1/g
}
'

for src in $(find onlinejudge -name \*.py) onlinejudge/py.typed ; do
dst=${src/onlinejudge/onlinejudge_workaround_for_conflict}
mkdir -p $(dirname $dst)
sed "$replace" < $src > $dst
done

for src in $(find tests -name \*.py) ; do
dst=${src/tests/tests_workaround_for_conflict}
mkdir -p $(dirname $dst)
sed "$replace" < $src > $dst
done

0 comments on commit 28739b8

Please sign in to comment.