This is an archive of the discontinued LLVM Phabricator instance.

[lit] Add pyproject.toml and fix build w/ modern setuptools backend
ClosedPublic

Authored by mgorny on Oct 28 2022, 1:26 PM.

Details

Summary

Add a pyproject.toml file that provides build system information
for PEP 517-compliant builders. While all the commonly used builders
provide fallback to running setup.py for backwards compatibility, this
ensures the best forward compatibility. It also provides a reliable way
of specifying the minimum required setuptools version. Effectively, it
will make it possible to remove setup.py in favor of purely
declarative configuration in the future, or even switch to a different
build system.

Update setup.py to explicitly add the current directory to sys.path
for importing lit. This is necessary, as the modern setuptools
backend does not guarantee that the current directory is present there.

Diff Detail

Event Timeline

mgorny created this revision.Oct 28 2022, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 1:26 PM
Herald added a subscriber: delcypher. · View Herald Transcript
mgorny requested review of this revision.Oct 28 2022, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 1:26 PM

oes the pyproject.toml work in the absence of setup.py? It seems to lack [project] [project.urls] etc? Shall we adopt hatch?

MaskRay accepted this revision.Oct 31 2022, 10:42 PM

Ah, ok, build-backend = "setuptools.build_meta" seems sufficient.

This revision is now accepted and ready to land.Oct 31 2022, 10:42 PM

oes the pyproject.toml work in the absence of setup.py? It seems to lack [project] [project.urls] etc? Shall we adopt hatch?

This one doesn't. I'd personally prefer flit_core as that's literally the simplest build system for Python packages (and the only one that doesn't vendor ad ozen or more random packages) but right now, my goal was to aim for a minimal change.

This revision was landed with ongoing or failed builds.Oct 31 2022, 11:30 PM
This revision was automatically updated to reflect the committed changes.