Skip to content

Commit

Permalink
Break python3.6 compatibility by removing redundant parameters from s…
Browse files Browse the repository at this point in the history
…etup.py

Parsing these parameters from pyproject.toml requires setuptools>=61.0
which is only available for python>=3.7.
  • Loading branch information
coldfix committed Dec 27, 2024
1 parent 66750ca commit a5e3d15
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
4 changes: 3 additions & 1 deletion .github/build/linux/cpymad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ python setup.py sdist

for PYBIN in /opt/python/cp3*/bin; do
rm -f src/cpymad/libmadx.c
"${PYBIN}/pip" wheel dist/*.tar.gz --no-deps -w rawdist/
if "${PYBIN}/python" -c "import sys;exit(sys.version_info<(3,7))"; then
"${PYBIN}/pip" wheel dist/*.tar.gz --no-deps -w rawdist/
fi
done

# Bundle external shared libraries into the wheels
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ optional-dependencies.dev = [
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools[core]",
"setuptools[core] >= 61.0",
"cython>=3.1.0a1 ; python_version >= '3.13'", # Cython3.1 needed for free-threaded python
"cython<3 ; python_version < '3.8'", # Cython3.1 dropped support for python<3.8
"cython ; python_version >= '3.8' and python_version < '3.13'", # no particular requirements
Expand Down
25 changes: 0 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ def fix_distutils_sysconfig_mingw():
sysconfig._config_vars['CC'] = 'gcc'


def exec_file(path):
"""Execute a python file and return the `globals` dictionary."""
namespace = {}
with open(path, 'rb') as f:
exec(f.read(), namespace, namespace)
return namespace


def get_extension_args(madxdir, shared, static, **libs):
"""Get arguments for C-extension (include pathes, libraries, etc)."""
# libquadmath isn't available on aarch64, see #101:
Expand Down Expand Up @@ -132,29 +124,12 @@ def get_extension_args(madxdir, shared, static, **libs):


if __name__ == '__main__':
sys.path.append(os.path.dirname(__file__))
fix_distutils_sysconfig_mingw()
options, sys.argv[1:] = command_line_options().parse_known_args()
# NOTE: The "metadata" parameters for setup() may appear to be redundant
# but are curently required on setuptools<61.0 and hence for python3.6
# for which setuptools>=60 is not available. See branch `drop-py36` for
# removal.
metadata = exec_file('src/cpymad/__init__.py')
setup(
name='cpymad',
version=metadata['__version__'],
description=metadata['__summary__'],
ext_modules=cythonize([
Extension('cpymad.libmadx',
sources=["src/cpymad/libmadx.pyx"],
**get_extension_args(**options.__dict__)),
]),
packages=['cpymad', 'cpymad.COPYING'],
package_dir={'': 'src'},
zip_safe=False, # zip is bad for redistributing shared libs
include_package_data=True, # include files matched by MANIFEST.in
install_requires=[
'numpy',
'minrpc>=0.0.8',
],
)

0 comments on commit a5e3d15

Please sign in to comment.