Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a workaround for the conflict of the module name #26

Merged
merged 1 commit into from
May 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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