|
6 | 6 | import zipfile |
7 | 7 | import tempfile |
8 | 8 | import subprocess |
| 9 | +from contextlib import contextmanager |
9 | 10 | from setuptools import setup, find_packages |
10 | 11 | from distutils.command.sdist import sdist |
11 | 12 |
|
@@ -45,6 +46,15 @@ def run(self): |
45 | 46 | sdist.run(self) |
46 | 47 |
|
47 | 48 |
|
| 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 | + |
48 | 58 | def build_native(spec): |
49 | 59 | cmd = ["cargo", "build", "-p", "relay-cabi"] |
50 | 60 | if not DEBUG_BUILD: |
@@ -99,28 +109,29 @@ def find_dylib(): |
99 | 109 | ) |
100 | 110 |
|
101 | 111 |
|
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 | | - |
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 | + |
| 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