From 35aa496b8e89dcf082299df14fac71acc25e2f27 Mon Sep 17 00:00:00 2001 From: Andrew Grigorev Date: Tue, 10 Sep 2024 10:37:31 +0300 Subject: [PATCH 1/3] Use scikit-build-core as build system --- .gitignore | 2 ++ CMakeLists.txt | 8 ++++++++ MANIFEST.in | 2 +- pyproject.toml | 32 ++++++++++++++++++++++++++++++++ setup.py | 50 -------------------------------------------------- 5 files changed, 43 insertions(+), 51 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index add68a0..4db9f6b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ nose*.egg/ pylint.txt valgrind-python.supp violations.pyflakes.txt +CMakeCache.txt +CMakeFiles/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..84239cc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.18...3.22) + +project(${SKBUILD_PROJECT_NAME} LANGUAGES C) + +find_package(Python COMPONENTS Interpreter Development.Module REQUIRED) + +Python_add_library(GeoIP MODULE py_GeoIP.c WITH_SOABI) +install(TARGETS GeoIP DESTINATION .) diff --git a/MANIFEST.in b/MANIFEST.in index 881cb08..7be06bb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -include ChangeLog.md LICENSE README.rst py_GeoIP.c +include ChangeLog.md LICENSE README.rst CMakeLists.txt py_GeoIP.c recursive-include examples *.py recursive-include tests *.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..82629de --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,32 @@ +[build-system] +requires = ["scikit-build-core"] +build-backend = "scikit_build_core.build" + +[project] +name = "GeoIP" +version = "1.3.2" +description = "MaxMind GeoIP Legacy Database - Python API" +readme = "README.rst" +license = { file = "LICENSE" } +authors = [ + { name = "MaxMind, Inc.", email = "support@maxmind.com" } +] +maintainers = [ + { name = "Andrew Grigorev", email = "andrew@ei-grad.ru" } +] +classifiers = [ + "Development Status :: 6 - Mature", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Programming Language :: Python", + "Topic :: Internet" + "Topic :: Internet :: Proxy Servers", +] + +[project.optional-dependencies] +test = ["pynose"] + +[project.urls] +Homepage = "https://github.com/ei-grad/geoip-api-python" +"Bug Tracker" = "https://github.com/ei-grad/geoip-api-python/issues" diff --git a/setup.py b/setup.py deleted file mode 100644 index d14ea69..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -import sys - -try: - from setuptools import setup, Extension -except ImportError: - from distutils.core import setup, Extension - -libs = ['GeoIP'] - -if sys.platform == 'win32': - libs.append('ws2_32') - -compile_args = [] -# http://bugs.python.org/issue969718 -if sys.version_info[0] == 2: - compile_args.append('-fno-strict-aliasing') - -module1 = Extension('GeoIP', - libraries=libs, - sources=['py_GeoIP.c'], - extra_compile_args=compile_args) - -setup( - name='GeoIP', - version='1.3.2', - description='MaxMind GeoIP Legacy Database - Python API', - long_description=open('README.rst').read(), - author="MaxMind, Inc.", - author_email="support@maxmind.com", - url='http://www.maxmind.com/', - bugtrack_url='https://github.com/maxmind/geoip-api-python/issues', - license=open('LICENSE').read(), - ext_modules=[module1], - tests_require=['nose'], - test_suite='nose.collector', - classifiers=( - 'Development Status :: 6 - Mature', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python', - 'Topic :: Internet :: Proxy Servers', - 'Topic :: Internet', - ), -) From ff76678db7752add0e9bf4e6e4675889996315cc Mon Sep 17 00:00:00 2001 From: Andrew Grigorev Date: Tue, 10 Sep 2024 11:09:08 +0300 Subject: [PATCH 2/3] Add notice about scikit-build-core --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index ac0974b..58ea690 100644 --- a/README.rst +++ b/README.rst @@ -16,6 +16,15 @@ from Python using `our GeoIP2 Python API `_ for more information. +Scikit-build-core fork +---------------------- + +Setuptools is known for its poor backward compatibility. Some newer versions of +setuptools fail to handle the metadata of the GeoIP package during the build +process. This is a fork of the original GeoIP package that uses +[scikit-build-core](https://scikit-build-core.readthedocs.io) to build the C +extension instead of setuptools. + Requirements ------------ From f0981d364ded6b842528a01f27797597fbfd52b7 Mon Sep 17 00:00:00 2001 From: Andrew Grigorev Date: Tue, 10 Sep 2024 11:10:22 +0300 Subject: [PATCH 3/3] Oops, README is in .rst format --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 58ea690..b9bedf8 100644 --- a/README.rst +++ b/README.rst @@ -22,7 +22,7 @@ Scikit-build-core fork Setuptools is known for its poor backward compatibility. Some newer versions of setuptools fail to handle the metadata of the GeoIP package during the build process. This is a fork of the original GeoIP package that uses -[scikit-build-core](https://scikit-build-core.readthedocs.io) to build the C +`scikit-build-core `_ to build the C extension instead of setuptools. Requirements