Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4c0ed2e

Browse files
Fix ada.o object build (#92)
1 parent 3c27c3c commit 4c0ed2e

File tree

11 files changed

+60
-20
lines changed

11 files changed

+60
-20
lines changed

‎.github/workflows/build.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ concurrency:
2626
jobs:
2727
build_wheels:
2828
strategy:
29+
fail-fast: false
2930
matrix:
3031
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
3132

@@ -35,10 +36,10 @@ jobs:
3536
- run: make requirements
3637
- name: Set up QEMU # Needed to build aarch64 wheels
3738
if: runner.os == 'Linux'
38-
uses: docker/setup-qemu-action@v2
39+
uses: docker/setup-qemu-action@v3
3940
with:
4041
platforms: all
41-
- uses: pypa/cibuildwheel@v2.17.0
42+
- uses: pypa/cibuildwheel@v2.20.0
4243
- uses: actions/upload-artifact@v4
4344
with:
4445
path: wheelhouse/*.whl

‎.github/workflows/lint.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
lint:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525
- name: Set up Python
26-
uses: actions/setup-python@v4
26+
uses: actions/setup-python@v5
2727
with:
2828
python-version: "3.8"
2929
- name: Install dependencies

‎.github/workflows/unit-tests.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ concurrency:
2020
jobs:
2121
build_test:
2222
strategy:
23+
fail-fast: false
2324
matrix:
2425
os: ["ubuntu-latest", "macos-latest"]
2526

@@ -28,7 +29,7 @@ jobs:
2829
steps:
2930
- uses: actions/checkout@v4
3031
- name: Set up Python 3.8
31-
uses: actions/setup-python@v4
32+
uses: actions/setup-python@v5
3233
with:
3334
python-version: "3.8"
3435
- name: Install dependencies

‎MANIFEST.in‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include ada_url/*.c
2+
include ada_url/*.cpp
3+
include ada_url/*.h
4+
exclude ada_url/*.o
5+
exclude ada_url/_ada_wrapper.*

‎Makefile‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ clean:
3131
$(RM) ada_url/_ada_wrapper.abi3.so
3232
$(RM) ada_url/ada.o
3333

34-
.PHONY: c_lib
35-
c_lib:
36-
$(CXX) -c "ada_url/ada.cpp" -fPIC -std="c++17" -O2 -o "ada_url/ada.o" $(ARCHFLAGS)
37-
3834
.PHONY: package
39-
package: c_lib
35+
package:
4036
python -m build --no-isolation
41-
python ./update_sdist.py
4237
twine check dist/*

‎ada_url/ada_build.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
from cffi import FFI
22
from os.path import dirname, join
3+
from setuptools.extension import Extension
34
from sys import platform
45

56
file_dir = dirname(__file__)
67

8+
compile_args = ['/std:c++17'] if platform == 'win32' else ['-std=c++17']
9+
10+
ada_obj = Extension(
11+
'ada',
12+
language="c++",
13+
sources=['ada_url/ada.cpp'],
14+
include_dirs=[file_dir],
15+
extra_compile_args=compile_args,
16+
)
17+
718
libraries = ['stdc++'] if platform == 'linux' else []
819

920
ffi_builder = FFI()
1021
ffi_builder.set_source(
1122
'ada_url._ada_wrapper',
1223
'# include "ada_c.h"',
13-
include_dirs=[file_dir],
1424
libraries=libraries,
15-
extra_objects=[join(file_dir, 'ada.o')],
25+
include_dirs=[file_dir],
26+
extra_objects=[ada_obj],
1627
)
1728

1829
cdef_lines = []

‎docs/index.rst‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ After that, you're ready to build the package:
3030
.. code-block:: sh
3131
3232
python -m pip install -r requirements/development.txt
33-
c++ -c "ada_url/ada.cpp" -fPIC -std="c++17" -O2 -o "ada_url/ada.o"
3433
python -m build --no-isolation
3534
3635
This will create a `.whl` file in the `dist` directory. You can install it in other

‎pyproject.toml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["cffi", "setuptools < 74", "urllib3", "wheel"]
2+
requires = ["cffi>=1.17.1", "setuptools", "urllib3", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -73,13 +73,16 @@ build = [
7373

7474
[tool.cibuildwheel.linux]
7575
archs = ["x86_64", "aarch64"]
76-
before-all = "make c_lib"
7776

7877
[tool.cibuildwheel.macos]
7978
archs = ["x86_64", "universal2", "arm64"]
8079
environment = { MACOSX_DEPLOYMENT_TARGET="10.15" }
81-
before-build = "make clean && make c_lib"
80+
before-build = "make clean"
8281

8382
[tool.cibuildwheel.windows]
8483
archs = ["AMD64"]
85-
before-build = '"C:\\Program Files\\Microsoft Visual Studio\2022円\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" && cl "ada_url\\ada.cpp" /c /nologo /Fo"ada_url\\ada.o" /O2 /GL /MD /W3 /EHsc /std:c++17'
84+
85+
# https://github.com/pypy/pypy/issues/5027
86+
[[tool.cibuildwheel.overrides]]
87+
select = "pp39-win_amd64"
88+
environment = { SETUPTOOLS_USE_DISTUTILS="stdlib" }

‎requirements/base.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# What we want
2-
cffi==1.17.0
2+
cffi==1.17.1
33

44
# What we need
55
pycparser==2.22

‎requirements/development.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
build
22
coverage
33
ruff
4-
setuptools<74
4+
setuptools
55
Sphinx
66
twine
77
urllib3

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /