Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

SConstruct to build wheel #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

dholth
Copy link

@dholth dholth commented Dec 4, 2016

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 dholth changed the title demonstration of building wheel with SCons SConstruct to build wheel Dec 4, 2016
@mitsuhiko
Copy link
Member

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

@dholth
Copy link
Author

dholth commented Dec 6, 2016

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
Copy link
Author

dholth commented Dec 6, 2016

Fwiw enscons is < 1000 loc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants