File tree Expand file tree Collapse file tree 2 files changed +37
-21
lines changed Expand file tree Collapse file tree 2 files changed +37
-21
lines changed Original file line number Diff line number Diff line change @@ -187,30 +187,44 @@ def make_sdist(dist_path, files):
187187 dist .addfile (file_info , fileobj = file_bytes )
188188
189189
190- def make_trivial_sdist (dist_path , distname , version ):
190+ def make_trivial_sdist (dist_path , distname , version , setuptools_wheel = None ):
191191 """
192192 Create a simple sdist tarball at dist_path, containing just a simple
193193 setup.py.
194- """
195194
196- make_sdist (
197- dist_path ,
198- [
199- (
200- 'setup.py' ,
201- DALS (
202- f"""\
203- import setuptools
204- setuptools.setup(
205- name={ distname !r} ,
206- version={ version !r}
207- )
208- """
209- ),
195+ If ``setuptools_wheel`` is passed, a ``pyproject.toml`` file will also
196+ be generated and the passed value will be used as location for
197+ setuptools (as build dependency).
198+ """
199+ files = [
200+ (
201+ 'setup.py' ,
202+ DALS (
203+ f"""\
204+ import setuptools
205+ setuptools.setup(
206+ name={ distname !r} ,
207+ version={ version !r}
208+ )
209+ """
210210 ),
211- ('setup.cfg' , '' ),
212- ],
213- )
211+ ),
212+ ('setup.cfg' , '' ),
213+ ]
214+
215+ if setuptools_wheel :
216+ files .append ((
217+ "pyproject.toml" ,
218+ DALS (
219+ f"""\
220+ [build-system]
221+ requires = ["setuptools @ { setuptools_wheel .as_uri ()} "]
222+ build-backend = "setuptools.build_meta"
223+ """
224+ ),
225+ ))
226+
227+ make_sdist (dist_path , files )
214228
215229
216230def make_nspkg_sdist (dist_path , distname , version ):
Original file line number Diff line number Diff line change 1515from distutils .errors import DistutilsSetupError
1616
1717
18- def test_dist_fetch_build_egg (tmpdir ):
18+ def test_dist_fetch_build_egg (tmpdir , setuptools_wheel ):
1919 """
2020 Check multiple calls to `Distribution.fetch_build_egg` work as expected.
2121 """
@@ -25,7 +25,9 @@ def test_dist_fetch_build_egg(tmpdir):
2525 def sdist_with_index (distname , version ):
2626 dist_dir = index .mkdir (distname )
2727 dist_sdist = f'{ distname } -{ version } .tar.gz'
28- make_trivial_sdist (str (dist_dir .join (dist_sdist )), distname , version )
28+ make_trivial_sdist (
29+ str (dist_dir .join (dist_sdist )), distname , version , setuptools_wheel
30+ )
2931 with dist_dir .join ('index.html' ).open ('w' ) as fp :
3032 fp .write (
3133 DALS (
You can’t perform that action at this time.
0 commit comments