Skip to content

Commit

Permalink
Remove dependency on setuptools for pythran -E
Browse files Browse the repository at this point in the history
This should simplify the life of scipy maintainers, see #2228.
  • Loading branch information
serge-sans-paille committed Aug 22, 2024
1 parent 6b61e8a commit 0d06ab4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/no-setuptools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: no-setuptools

on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.12]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scipy-openblas64
- name: Setup
run: |
python -m pip install .
python -m pip uninstall -y setuptools # the goal of that check is to test codegen without setuptools
- name: Testing scipy
run: |
find pythran/tests/scipy/ -name '*.py' -exec pythran -E {} \;
15 changes: 8 additions & 7 deletions pythran/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from pythran.cxxgen import PythonModule, Include, Line, Statement
from pythran.cxxgen import FunctionBody, FunctionDeclaration, Value, Block
from pythran.cxxgen import ReturnStatement
from pythran.dist import PythranExtension, PythranBuildExt
from pythran.errors import PythranCompileError
from pythran.middlend import refine, mark_unexported_functions
from pythran.passmanager import PassManager
Expand All @@ -24,12 +23,6 @@

import sysconfig

try:
# `numpy.distutils is deprecated, may not be present, or broken
from numpy.distutils.core import setup
except Exception:
from setuptools import setup

from tempfile import mkdtemp, NamedTemporaryFile
import gast as ast
import importlib
Expand Down Expand Up @@ -335,6 +328,14 @@ def compile_cxxfile(module_name, cxxfile, output_binary=None, **kwargs):
Raises PythranCompileError on failure
'''
# local import so that we don't depend on setuptools for the code generation
# part
from pythran.dist import PythranExtension, PythranBuildExt
try:
# `numpy.distutils is deprecated, may not be present, or broken
from numpy.distutils.core import setup
except Exception:
from setuptools import setup

builddir = mkdtemp()
buildtmp = mkdtemp()
Expand Down

0 comments on commit 0d06ab4

Please sign in to comment.