This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Python 3 support: Use absolute import by default
ClosedPublic

Authored by thopre on Sep 20 2019, 1:32 AM.

Details

Summary

Forces module import to be absolute by default on Python 2 since this is
the default for Python 3. Adapts relative imports to use the relative
import symtax 'from . import foo' or 'from .pkg import foo'.

Also remove unnecessary circular import dependency between testsuite and
testsuitedb by moving functions used by testsuite but currently in
testsuitedb into module testsuite. Finally adds type hints into
lnt.formats to avoid warnings from mypy due to change to relative import
syntax.

Changes to adapt syntax of relative import was produced by running
futurize's stage1 libfuturize.fixes.fix_absolute_import, while breaking
of circular dependency was done manually.

Diff Detail

Repository
rL LLVM

Event Timeline

thopre created this revision.Sep 20 2019, 1:32 AM
thopre edited the summary of this revision. (Show Details)Sep 20 2019, 2:06 AM
thopre updated this revision to Diff 221178.Sep 21 2019, 8:25 AM

Rebase on top of Hubert Tong similar changes

thopre edited the summary of this revision. (Show Details)Sep 21 2019, 8:26 AM
This revision is now accepted and ready to land.Sep 21 2019, 9:09 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 23 2019, 12:45 AM