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

fix test build #144

Merged
merged 8 commits into from
Aug 29, 2023
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
28 changes: 25 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,40 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['2.7', 'pypy-2.7', '3.9', '3.10', '3.11']
python-version: ['pypy-2.7', '3.9', '3.10', '3.11']
exclude:
- os: macos-latest
python-version: 'pypy-2.7'
- os: windows-latest
python-version: 'pypy-2.7'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install wheel
- name: Install
shell: bash
run: |
SCANDIR_REQUIRE_C_EXTENSION=1 python -m pip -v install .
- name: Run tests
run: |
python test/run_tests.py
build27:
runs-on: ubuntu-latest
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install wheel
- name: Install
run: |
SCANDIR_REQUIRE_C_EXTENSION=1 python -m pip -v install .
- name: Run tests
run: |
python --version
python setup.py install
python test/run_tests.py
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import sys
import logging

require_c_extension = bool(os.environ.get('SCANDIR_REQUIRE_C_EXTENSION'))

cielavenir marked this conversation as resolved.
Show resolved Hide resolved
# Get version without importing scandir because that will lock the
# .pyd file (if scandir is already installed) so it can't be
# overwritten during the install process
Expand All @@ -42,10 +44,13 @@ def build_extension(self, ext):
try:
base_build_ext.build_extension(self, ext)
except Exception:
if require_c_extension:
logging.error('SCANDIR_REQUIRE_C_EXTENSION is set, not falling back to Python implementation')
raise
info = sys.exc_info()
logging.warn("building %s failed with %s: %s", ext.name, info[0], info[1])

extension = Extension('_scandir', ['_scandir.c'], optional=True)
extension = Extension('_scandir', ['_scandir.c'], optional=not require_c_extension)


setup(
Expand Down
Loading