Skip to content

Commit edd1cf8

Browse files
authored
build(py): Revert dynamic version, ignore pyproject.toml instead (#5313)
1 parent 38917cc commit edd1cf8

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

py/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[project]
22
name = "sentry_relay"
3+
# see setup.py for versioning; we only have this here to make uv happy
4+
# which we intend to use for dependency management, not packaging
5+
version = "0.0.0"
36

47
# note: we're using legacy setup.py for building, but the mere presence
58
# of this file will have setuptools trying to use it
@@ -9,5 +12,4 @@ dynamic = [
912
"description",
1013
"license",
1114
"requires-python",
12-
"version",
1315
]

py/setup.py

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import zipfile
77
import tempfile
88
import subprocess
9+
from contextlib import contextmanager
910
from setuptools import setup, find_packages
1011
from distutils.command.sdist import sdist
1112

@@ -45,6 +46,15 @@ def run(self):
4546
sdist.run(self)
4647

4748

49+
@contextmanager
50+
def ignore_pyproject(*args, **kwargs):
51+
shutil.move("pyproject.toml", "pyproject.toml-bkp")
52+
try:
53+
yield
54+
finally:
55+
shutil.move("pyproject.toml-bkp", "pyproject.toml")
56+
57+
4858
def build_native(spec):
4959
cmd = ["cargo", "build", "-p", "relay-cabi"]
5060
if not DEBUG_BUILD:
@@ -99,28 +109,29 @@ def find_dylib():
99109
)
100110

101111

102-
setup(
103-
name="sentry-relay",
104-
version=version,
105-
packages=find_packages(),
106-
author="Sentry",
107-
license="FSL-1.0-Apache-2.0",
108-
author_email="[email protected]",
109-
description="A python library to access sentry relay functionality.",
110-
long_description=readme,
111-
long_description_content_type="text/markdown",
112-
include_package_data=True,
113-
package_data={"sentry_relay": ["py.typed", "_lowlevel.pyi"]},
114-
zip_safe=False,
115-
platforms="any",
116-
python_requires=">=3.10",
117-
install_requires=["milksnake>=0.1.6"],
118-
# Specify transitive dependencies manually that are required for the build because
119-
# they are not resolved properly since upgrading to python 3.11 in manylinux.
120-
# milksnake -> cffi -> pycparser
121-
# milksnake specifies cffi>=1.6.0 as dependency while cffi does not specify a
122-
# minimum version for pycparser
123-
setup_requires=["milksnake>=0.1.6", "cffi>=1.6.0", "pycparser"],
124-
milksnake_tasks=[build_native],
125-
cmdclass={"sdist": CustomSDist}, # type: ignore
126-
)
112+
with ignore_pyproject():
113+
setup(
114+
name="sentry-relay",
115+
version=version,
116+
packages=find_packages(),
117+
author="Sentry",
118+
license="FSL-1.0-Apache-2.0",
119+
author_email="[email protected]",
120+
description="A python library to access sentry relay functionality.",
121+
long_description=readme,
122+
long_description_content_type="text/markdown",
123+
include_package_data=True,
124+
package_data={"sentry_relay": ["py.typed", "_lowlevel.pyi"]},
125+
zip_safe=False,
126+
platforms="any",
127+
python_requires=">=3.10",
128+
install_requires=["milksnake>=0.1.6"],
129+
# Specify transitive dependencies manually that are required for the build because
130+
# they are not resolved properly since upgrading to python 3.11 in manylinux.
131+
# milksnake -> cffi -> pycparser
132+
# milksnake specifies cffi>=1.6.0 as dependency while cffi does not specify a
133+
# minimum version for pycparser
134+
setup_requires=["milksnake>=0.1.6", "cffi>=1.6.0", "pycparser"],
135+
milksnake_tasks=[build_native],
136+
cmdclass={"sdist": CustomSDist}, # type: ignore
137+
)

0 commit comments

Comments
 (0)