Skip to content

Commit f7eaf87

Browse files
authored
Fix building on the main branch (#89)
1 parent 8eb4133 commit f7eaf87

File tree

6 files changed

+88
-105
lines changed

6 files changed

+88
-105
lines changed

.github/workflows/unit-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
build_test:
2222
strategy:
2323
matrix:
24-
os: ["ubuntu-20.04", "macos-11"]
24+
os: ["ubuntu-latest", "macos-latest"]
2525

2626
runs-on: ${{ matrix.os }}
2727

2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030
- name: Set up Python 3.8
3131
uses: actions/setup-python@v4
3232
with:

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: requirements
22
requirements:
3-
python3 -m pip install -r requirements/development.txt ${req_args}
3+
python -m pip install -U -r requirements/development.txt ${req_args}
44

55
.PHONY: check
66
check:
@@ -38,4 +38,5 @@ c_lib:
3838
.PHONY: package
3939
package: c_lib
4040
python -m build --no-isolation
41+
python ./update_sdist.py
4142
twine check dist/*

pyproject.toml

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
11
[build-system]
2-
requires = ["cffi", "setuptools", "urllib3>=2.0.2", "wheel"]
2+
requires = ["cffi", "setuptools", "urllib3", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "ada-url"
7+
version = "1.14.0"
8+
authors = [
9+
{name = "Bo Bayles", email = "[email protected]"},
10+
]
11+
description = 'URL parser and manipulator based on the WHAT WG URL standard'
12+
readme = "README.rst"
13+
requires-python = ">=3.8"
14+
license = {text = "Apache 2.0"}
15+
classifiers = [
16+
"License :: OSI Approved :: Apache Software License",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3 :: Only",
19+
]
20+
dependencies = [
21+
"cffi",
22+
]
23+
24+
[project.urls]
25+
Homepage = "https://www.ada-url.com/"
26+
Documentation = "https://ada-url.readthedocs.io"
27+
Repository = "https://github.com/ada-url/ada-python"
28+
29+
[tool.setuptools.packages.find]
30+
exclude = ["tests"]
31+
32+
[tool.setuptools]
33+
include-package-data = true
34+
35+
[tool.setuptools.package-data]
36+
ada_url = ["*.c", "*.h", "*.o"]
37+
538
[tool.black]
639
line-length = 88
740
target-version = ['py38']
@@ -22,6 +55,11 @@ quote-style = "single"
2255
select = ["E", "F"]
2356
ignore = ["E501"]
2457

58+
[tool.coverage.run]
59+
include = [
60+
"ada_url/**",
61+
]
62+
2563
[tool.cibuildwheel]
2664
build = [
2765
"cp38-*",

requirements/development.txt

+8-56
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,10 @@
1-
# What we want
2-
build==1.2.1
3-
coverage==7.4.3
4-
ruff==0.3.7
5-
setuptools==69.5.1
6-
Sphinx==7.1.2
7-
twine==5.1.0
8-
wheel==0.43.0
9-
10-
# What we need
11-
alabaster==0.7.13;python_version<"3.9"
12-
alabaster==0.7.16;python_version>="3.9"
13-
Babel==2.14.0
14-
backports.tarfile==1.0.0
15-
certifi==2024.2.2
16-
charset-normalizer==3.3.2
17-
docutils==0.20.1
18-
idna==3.7
19-
imagesize==1.4.1
20-
importlib_metadata==7.1.0
21-
importlib_resources==6.4.0
22-
jaraco.classes==3.4.0
23-
jaraco.context==5.3.0
24-
jaraco.functools==4.0.1
25-
Jinja2==3.1.3
26-
keyring==25.2.0
27-
markdown-it-py==3.0.0
28-
MarkupSafe==2.1.5
29-
mdurl==0.1.2
30-
more-itertools==10.2.0
31-
nh3==0.2.17
32-
packaging==24.0
33-
pkginfo==1.11.0
34-
Pygments==2.17.2
35-
pyproject_hooks==1.0.0
36-
pytz==2024.1
37-
readme_renderer==43.0
38-
requests==2.31.0
39-
requests-toolbelt==1.0.0
40-
rfc3986==2.0.0
41-
rich==13.7.1
42-
snowballstemmer==2.2.0
43-
sphinxcontrib-applehelp==1.0.4;python_version<"3.9"
44-
sphinxcontrib-applehelp==1.0.8;python_version>="3.9"
45-
sphinxcontrib-devhelp==1.0.2;python_version<"3.9"
46-
sphinxcontrib-devhelp==1.0.6;python_version>="3.9"
47-
sphinxcontrib-htmlhelp==2.0.1;python_version<"3.9"
48-
sphinxcontrib-htmlhelp==2.0.5;python_version>="3.9"
49-
sphinxcontrib-jsmath==1.0.1
50-
sphinxcontrib-qthelp==1.0.3
51-
sphinxcontrib-serializinghtml==1.1.5;python_version<"3.9"
52-
sphinxcontrib-serializinghtml==1.1.10;python_version>="3.9"
53-
tomli==2.0.1
54-
typing_extensions==4.11.0
55-
urllib3==2.2.1
56-
zipp==3.18.1
1+
build
2+
coverage
3+
ruff
4+
setuptools
5+
Sphinx
6+
twine
7+
urllib3
8+
wheel
579

5810
-r base.txt

setup.cfg

-45
This file was deleted.

update_sdist.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
update_sdist.py
3+
4+
Run this script to remove compiled artifacts from source distribution tarballs.
5+
"""
6+
from pathlib import Path
7+
from tarfile import open as tar_open
8+
from tempfile import TemporaryDirectory
9+
10+
REMOVE_FILES = frozenset(['ada_url/ada.o'])
11+
12+
13+
def update_archive(file_path, removals):
14+
with TemporaryDirectory() as temp_dir:
15+
with tar_open(file_path, mode='r:gz') as tf:
16+
tf.extractall(temp_dir)
17+
18+
dir_path = next(Path(temp_dir).glob('ada_url-*'))
19+
all_files = []
20+
for file_path in Path(temp_dir).glob('**/*'):
21+
if file_path.is_dir():
22+
continue
23+
if str(file_path.relative_to(dir_path)) in REMOVE_FILES:
24+
continue
25+
all_files.append(file_path)
26+
27+
with tar_open(file_path, mode='w:gz') as tf:
28+
for file_path in all_files:
29+
arcname = file_path.relative_to(temp_dir)
30+
print(arcname)
31+
tf.add(file_path, arcname=arcname)
32+
33+
34+
if __name__ == '__main__':
35+
for file_path in Path().glob('dist/*.tar.gz'):
36+
update_archive(file_path, REMOVE_FILES)
37+
print(f'Updated {file_path}')

0 commit comments

Comments
 (0)