libsourcemap icon indicating copy to clipboard operation
libsourcemap copied to clipboard

SConstruct to build wheel

Open dholth opened this issue 9 years ago • 3 comments

Here's an example SConstruct to build a wheel for your project. It provides build rules with dependency tracking and gives complete control of the wheel tag. Unlike the setup.py build it avoids putting an extraneous purelib/ directory in the wheel.

To build, pip install enscons and python -m SCons. Tested in Python 2.7. enscons is a small project that adds wheel generation to SCons.

dholth avatar Dec 04 '16 16:12 dholth

What we have right now "works" as far as I know. I might however consider that if it fixes something that needs fixing. What does it fix? :D

mitsuhiko avatar Dec 06 '16 08:12 mitsuhiko

New wheel puts everything at the root:

File Name                                             Modified             Size
libsourcemap/highlevel.py                      2016-12-06 13:34:28         8388
libsourcemap/_compat.py                        2016-12-06 13:34:28          516
libsourcemap/__init__.py                       2016-12-06 13:34:28          553
libsourcemap/exceptions.py                     2016-12-06 13:34:28         1559
libsourcemap/_sourcemapnative.py               2016-12-06 13:41:12         2670
libsourcemap/_libsourcemap.so                  2016-12-06 13:41:12      2072564
libsourcemap-0.5.0.dist-info/METADATA          2016-12-06 13:41:12          600
libsourcemap-0.5.0.dist-info/WHEEL             2016-12-06 13:41:12          100
libsourcemap-0.5.0.dist-info/RECORD            2016-12-06 13:41:12          722

Original wheel has an unnecessary purelib/ directory:

File Name                                             Modified             Size
libsourcemap-0.5.0.data/purelib/libsourcemap/__init__.py 2016-12-06 13:34:28          553
libsourcemap-0.5.0.data/purelib/libsourcemap/_compat.py 2016-12-06 13:34:28          516
libsourcemap-0.5.0.data/purelib/libsourcemap/exceptions.py 2016-12-06 13:34:28         1559
libsourcemap-0.5.0.data/purelib/libsourcemap/highlevel.py 2016-12-06 13:34:28         8388
libsourcemap-0.5.0.data/purelib/libsourcemap/_sourcemapnative.py 2016-12-06 13:41:12         2670
libsourcemap-0.5.0.data/purelib/libsourcemap/_libsourcemap.so 2016-12-06 13:41:12      2072564
libsourcemap-0.5.0.dist-info/DESCRIPTION.rst   2016-12-06 13:41:36           10
libsourcemap-0.5.0.dist-info/metadata.json     2016-12-06 13:41:36          785
libsourcemap-0.5.0.dist-info/top_level.txt     2016-12-06 13:41:36           13
libsourcemap-0.5.0.dist-info/WHEEL             2016-12-06 13:41:36          132
libsourcemap-0.5.0.dist-info/METADATA          2016-12-06 13:41:36          584
libsourcemap-0.5.0.dist-info/RECORD            2016-12-06 13:41:36         1221

The extra metadata from bdist_wheel is experimental or not necessary.

SCons build requires no MANIFEST.in. Much simpler to support alternative compliers and generated Python code. In enscons, there is a setup.py that could be copied into any enscons-using project that installs and invokes SCons for pip compatibility, without having to wait for pip to gain native support for pluggable build systems.

TBH enscons is still experimental, producing legal wheels and sdists but not made as robust as possible, but everyone who has to customize distutils wonders if there is a different way, and this is different. When I wrote bdist_wheel I hoped alternative build systems would soon replace it since the installable artifact no longer has to be generated by distutils, but it hangs on.

dholth avatar Dec 06 '16 14:12 dholth

Fwiw enscons is < 1000 loc

dholth avatar Dec 06 '16 14:12 dholth